public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug dynamic-link/25887] New: Wasted space in _dl_x86_feature_1[1]
@ 2020-04-28 14:41 hjl.tools at gmail dot com
2020-04-28 14:42 ` [Bug dynamic-link/25887] " hjl.tools at gmail dot com
2020-05-22 13:15 ` hjl.tools at gmail dot com
0 siblings, 2 replies; 3+ messages in thread
From: hjl.tools at gmail dot com @ 2020-04-28 14:41 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=25887
Bug ID: 25887
Summary: Wasted space in _dl_x86_feature_1[1]
Product: glibc
Version: 2.32
Status: NEW
Severity: normal
Priority: P2
Component: dynamic-link
Assignee: unassigned at sourceware dot org
Reporter: hjl.tools at gmail dot com
Target Milestone: ---
Target: i386,x86-64
_dl_x86_feature_1[1] is used to control CET:
/* Valid control values:
0: Enable CET features based on ELF property note.
1: Always disable CET features.
2: Always enable CET features.
3: Enable CET features permissively.
*/
#define CET_ELF_PROPERTY 0
#define CET_ALWAYS_OFF 1
#define CET_ALWAYS_ON 2
#define CET_PERMISSIVE 3
#define CET_MAX CET_PERMISSIVE
For each CET feature, IBT and SHSTK, it takes 2 bits. There are
attribute_hidden
void
TUNABLE_CALLBACK (set_x86_ibt) (tunable_val_t *valp)
{
if (DEFAULT_MEMCMP (valp->strval, "on", sizeof ("on")) == 0)
{
GL(dl_x86_feature_1)[1] &= ~((1 << CET_MAX) - 1);
GL(dl_x86_feature_1)[1] |= CET_ALWAYS_ON;
}
else if (DEFAULT_MEMCMP (valp->strval, "off", sizeof ("off")) == 0)
{
GL(dl_x86_feature_1)[1] &= ~((1 << CET_MAX) - 1);
GL(dl_x86_feature_1)[1] |= CET_ALWAYS_OFF;
}
else if (DEFAULT_MEMCMP (valp->strval, "permissive",
sizeof ("permissive")) == 0)
{
GL(dl_x86_feature_1)[1] &= ~((1 << CET_MAX) - 1);
GL(dl_x86_feature_1)[1] |= CET_PERMISSIVE;
}
}
attribute_hidden
void
TUNABLE_CALLBACK (set_x86_shstk) (tunable_val_t *valp)
{
if (DEFAULT_MEMCMP (valp->strval, "on", sizeof ("on")) == 0)
{
GL(dl_x86_feature_1)[1] &= ~(((1 << CET_MAX) - 1) << CET_MAX);
GL(dl_x86_feature_1)[1] |= (CET_ALWAYS_ON << CET_MAX);
}
else if (DEFAULT_MEMCMP (valp->strval, "off", sizeof ("off")) == 0)
{
GL(dl_x86_feature_1)[1] &= ~(((1 << CET_MAX) - 1) << CET_MAX);
GL(dl_x86_feature_1)[1] |= (CET_ALWAYS_OFF << CET_MAX);
}
else if (DEFAULT_MEMCMP (valp->strval, "permissive",
sizeof ("permissive")) == 0)
{
GL(dl_x86_feature_1)[1] &= ~(((1 << CET_MAX) - 1) << CET_MAX);
GL(dl_x86_feature_1)[1] |= (CET_PERMISSIVE << CET_MAX);
}
}
CET_MAX should be renamed to CET_CONTROL_BITS and set to 2.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug dynamic-link/25887] Wasted space in _dl_x86_feature_1[1]
2020-04-28 14:41 [Bug dynamic-link/25887] New: Wasted space in _dl_x86_feature_1[1] hjl.tools at gmail dot com
@ 2020-04-28 14:42 ` hjl.tools at gmail dot com
2020-05-22 13:15 ` hjl.tools at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: hjl.tools at gmail dot com @ 2020-04-28 14:42 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=25887
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fweimer at redhat dot com
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug dynamic-link/25887] Wasted space in _dl_x86_feature_1[1]
2020-04-28 14:41 [Bug dynamic-link/25887] New: Wasted space in _dl_x86_feature_1[1] hjl.tools at gmail dot com
2020-04-28 14:42 ` [Bug dynamic-link/25887] " hjl.tools at gmail dot com
@ 2020-05-22 13:15 ` hjl.tools at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: hjl.tools at gmail dot com @ 2020-05-22 13:15 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=25887
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |2.32
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed by
commit 674ea88294bfb8d89878a0ebbbcec38a85e118a5
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Apr 28 10:05:25 2020 -0700
x86: Move CET control to _dl_x86_feature_control [BZ #25887]
1. Include <dl-procruntime.c> to get architecture specific initializer in
rtld_global.
2. Change _dl_x86_feature_1[2] to _dl_x86_feature_1.
3. Add _dl_x86_feature_control after _dl_x86_feature_1, which is a
struct of 2 bitfields for IBT and SHSTK control
This fixes [BZ #25887].
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-22 13:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28 14:41 [Bug dynamic-link/25887] New: Wasted space in _dl_x86_feature_1[1] hjl.tools at gmail dot com
2020-04-28 14:42 ` [Bug dynamic-link/25887] " hjl.tools at gmail dot com
2020-05-22 13:15 ` hjl.tools at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).