FS#72583 - [gdb] Upstream patch corrects gdbserver 11.1 MTE detection bug

Attached to Project: Arch Linux
Opened by android (android) - Saturday, 30 October 2021, 00:18 GMT
Last edited by Toolybird (Toolybird) - Monday, 29 May 2023, 05:39 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Anatol Pomozov (anatolik)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

The attached patch file updates the extra/gdb package to version 11.1-2:

0001-The-included-patch-corrects-an-MTE-detection-bug-in-.patch

The patch is based on the git repo retrieved via:

$ asp checkout gdb

A feature branch is created, then one commit is made from the current HEAD at:

cecb9317641192f847ed23575a69ce93a615d9c2

In addition to modifying PKGBUILD, the attached patch file includes a gdbserver patch from upstream, documented in the upstream bug report at:

https://sourceware.org/bugzilla/show_bug.cgi?id=28355

The included patch corrects an MTE detection bug in gdbserver 11.1

From the upstream report:
"If one has a kernel new enough that it has MTE awareness, and use a new enough
gdbserver that knows about the tag_ctl register, it will run into this situation."

The text of the error from gdbserver:
../../gdbserver/regcache.cc:257: A problem internal to GDBserver has been detected.
Unknown register tag_ctl requested

This bug only affects gdbserver 11.1.

Steps to reproduce:

Detailed instructions for reproducing the bug are documented in the upstream bug report.
This task depends upon

Closed by  Toolybird (Toolybird)
Monday, 29 May 2023, 05:39 GMT
Reason for closing:  Fixed
Additional comments about closing:  See comments
Comment by android (android) - Monday, 01 November 2021, 17:50 GMT

This patch is now submitted for review to upstream gdb:

https://sourceware.org/pipermail/gdb-patches/2021-November/182985.html

Can we update extra/gdb to 11.1-2 and incorporate this fix?

Thank you...
Comment by Anatol Pomozov (anatolik) - Tuesday, 02 November 2021, 19:07 GMT
Thank you for pointing to the upstream patch. Once it reviewed and merged to master I'll pull it into the Arch package.
Comment by android (android) - Wednesday, 03 November 2021, 14:48 GMT
Thank you Anatol!

The patch has now been merged upstream:

Luis Machado <luis.machado at linaro dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED

--- Comment #27 from Luis Machado <luis.machado at linaro dot org> ---
Fix pushed to both binutils-gdb-master and gdb-11.
Comment by Anatol Pomozov (anatolik) - Wednesday, 03 November 2021, 16:28 GMT
Thank you for the headsup.

Does this patch applies to 'gdb' package only (i.e. for x86 binary) or aarch64-linux-gnu-gdb needs this patch as well?
Comment by android (android) - Wednesday, 03 November 2021, 16:30 GMT
Thank you Anatol!

The patch has now been merged upstream:

Luis Machado <luis.machado at linaro dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED

--- Comment #27 from Luis Machado <luis.machado at linaro dot org> ---
Fix pushed to both binutils-gdb-master and gdb-11.
Comment by android (android) - Wednesday, 03 November 2021, 16:56 GMT

The patch only affects the gdb package, since it contains the gdbserver binary. Only this package needs to be updated.

It could be possible to eliminate the aarch64-linux-gnu-gdb package by configuring gdb with support for multiple target architectures. I believe the "--enable-targets" config option will accept a list of architectures, but I haven't tried this myself.

Sorry for resending my last comment 8-( When I refreshed the page in my browser, I accidentally resent my last post.

Comment by Anatol Pomozov (anatolik) - Wednesday, 03 November 2021, 17:02 GMT
gdb-common-11.1-2-x86_64 package with your patch just got landed [testing]. Please verify that it works as expected.

> It could be possible to eliminate the aarch64-linux-gnu-gdb package by configuring gdb with support for multiple target architectures.

I would *love* to configure multi-arch support in one package. This will reduce a lot of unneeded work. If you do not mind could you please file a ticket with all the knowledge you have on this topic. And then assign the ticket to me.
Comment by android (android) - Wednesday, 03 November 2021, 22:57 GMT

OK, I've tested the new gdb 11.1-2 with gdbserver on aarch64 and aarch64-linux-gnu-gdb on x86_64.

Everything looks good! Thanks Anatol!

I think the multi-arch gdb would be convenient also, especially if it can be built with a limited number of arch targets (as opposed to --enable-targets=all).

Now that I'm all setup to build gdb, I'll try that out and let you know...

Loading...