Bug 2111900 - libglvnd: add BTI landing pads for aarch64
Summary: libglvnd: add BTI landing pads for aarch64
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: libglvnd
Version: 36
Hardware: aarch64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Nicolas Chauvet (kwizart)
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-07-28 12:23 UTC by Leif Liddy
Modified: 2022-08-12 14:14 UTC (History)
4 users (show)

Fixed In Version: libglvnd-1.4.0-4.fc38 libglvnd-1.4.0-4.fc37
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-08-12 09:13:55 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Leif Liddy 2022-07-28 12:23:46 UTC
Description of problem:

When Branch Target Identifier (BTI) is enabled on aarch64,
any software which runs libglvnd will fail with SIGILL, Illegal instruction.

Version-Release number of selected component (if applicable):
Fedora 36
libglvnd: 1.4.0-2

A coredump analysis reveals it's failing on this instruction
"stp x1, x0 [sp, #-16]!"

How reproducible:
The issue manifests itself when starting GDM (or any application links to libglvnd)

Jul 27 03:41:55 fedora systemd-coredump[1122]: Process 1085 (gnome-shell) of user 42 dumped core.

...                                               
           Module libvulkan.so.1 with build-id 67d50cfbcd9385a604b088608e38177128818e19
           Stack trace of thread 1085:
           #0  0x0000ffff6b6ef080 glGetIntegerv (libGLdispatch.so.0 + 0x6f080)
           #1  0x0000ffff6f4786f8 _cogl_context_get_gl_extensions (libmutter-cogl-10.so.0 + 0x186f8)
           #2  0x0000ffff6f4c4000 sysprof_capture_jitmap_iter_next (libmutter-cogl-10.so.0 + 0x64000)
           #3  0x0000aaab6eccdaa0 n/a (n/a + 0x0)
           ELF object binary architecture: AARCH64


Steps to Reproduce:
1.start GDM on a BTI-enabled aarch64 system.


Additional info:
This issue was diagnosed on an m2 macbook air by developer Janne Grunau
https://oftc.irclog.whitequark.org/asahi/2022-07-27#;
https://oftc.irclog.whitequark.org/asahi/2022-07-28


And applying this patch resolved the issue:
https://gitlab.freedesktop.org/glvnd/libglvnd/-/merge_requests/262

Comment 1 Nicolas Chauvet (kwizart) 2022-08-10 20:02:28 UTC
Have you tested this patch on fedora libglvnd ?
I don't know if BTI is enabled in which fedora version, but I might backport the patch for f37+ unless there is a new release upstream...

Comment 2 Leif Liddy 2022-08-10 22:00:24 UTC
So I added that patch to my to the libglvnd SRPM in my local repo. 
Janne Grunau and Linus Torvalds (yes really) both confirmed that it worked. 

https://www.leifliddy.com/asahi-linux/36/source/SRPMS/
https://www.leifliddy.com/asahi-linux/36/aarch64/

I don't have an m2 macbook to test on so I can't personally confirm it. 
But I would consider both Janne and Linus to be reliable sources. 

The dmesg logs posted showed the following:

CPU features: detected: Branch Target Identification

>  but I might backport the patch for f37+ unless there is a new release upstream...
That would definitely work. I mean I could ask the project maintainers if they could just make a new release (that included that commit)
But you would probably have more pull then I would.

Comment 3 Fedora Update System 2022-08-12 09:11:39 UTC
FEDORA-2022-fb41fa9ea6 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2022-fb41fa9ea6

Comment 4 Fedora Update System 2022-08-12 09:13:34 UTC
FEDORA-2022-db6c2e9180 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-db6c2e9180

Comment 5 Fedora Update System 2022-08-12 09:13:55 UTC
FEDORA-2022-fb41fa9ea6 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 6 Nicolas Chauvet (kwizart) 2022-08-12 09:19:26 UTC
Okay backported for f36+
For some reason I cannot link the bug, so here is the bodhi update:
https://bodhi.fedoraproject.org/updates/FEDORA-2022-8890cf0609

Thanks for the report and feedbacks.

Comment 7 Fedora Update System 2022-08-12 14:14:01 UTC
FEDORA-2022-db6c2e9180 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.