Bug 26625 - [2.33 Regression] CET is disabled
Summary: [2.33 Regression] CET is disabled
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.33
: P2 normal
Target Milestone: 2.33
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-16 12:16 UTC by H.J. Lu
Modified: 2021-01-29 12:07 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2020-09-16 12:16:06 UTC
commit 04bba1e5d84b6fd8d3a3b006bc240cd5d241ee30
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Aug 5 13:51:56 2020 -0700

    x86: Set CPU usable feature bits conservatively [BZ #26552]
    
    Set CPU usable feature bits only for CPU features which are usable in
    user space and whose usability can be detected from user space, excluding
    features like FSGSBASE whose enable bit can only be checked in the kernel.

clears the usable bit of IBT and SHSTK since we don't know if IBT and SHSTK
are usable much later.  But there are:

sysdeps/x86/cpu-features.c:	  if (!CPU_FEATURE_USABLE (IBT))
sysdeps/x86/cpu-features.c:	  if (!CPU_FEATURE_USABLE (SHSTK))
sysdeps/x86/dl-cet.c:	  enable_ibt &= (CPU_FEATURE_USABLE (IBT)
sysdeps/x86/dl-cet.c:	  enable_shstk &= (CPU_FEATURE_USABLE (SHSTK)
sysdeps/x86/tst-get-cpu-features.c:  CHECK_CPU_FEATURE_USABLE (SHSTK);
sysdeps/x86/tst-get-cpu-features.c:  CHECK_CPU_FEATURE_USABLE (IBT);
Comment 1 H.J. Lu 2020-09-17 12:31:09 UTC
Fixed by

commit 94cd37ebb293321115a36a422b091fdb72d2fb08
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Sep 16 05:27:32 2020 -0700

    x86: Use HAS_CPU_FEATURE with IBT and SHSTK [BZ #26625]
Comment 2 H.J. Lu 2021-01-27 04:01:32 UTC
This caused the regression since

GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK

can no longer be used to disable IBT nor SHSTK.  We should treat
IBT and SHSTK as special cases:

1. Set usable feature bits if CPU supports it and CET is enabled.
2. Clears the usable feature bits for GLIBC_TUNABLES or kernel
doesn't support it.
Comment 3 H.J. Lu 2021-01-29 12:07:21 UTC
Fixed by

commit 04dff6fc0d4ad44fc4491f89fed6574380b78251
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Jan 26 20:48:45 2021 -0800

    x86: Properly set usable CET feature bits [BZ #26625]