From: Florian Weimer <fweimer@redhat.com>
To: "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org>
Subject: Re: [PATCH] x86: Move CET control to _dl_x86_feature_control [BZ #25887]
Date: Mon, 18 May 2020 09:19:31 +0200 [thread overview]
Message-ID: <87mu65g16k.fsf@oldenburg2.str.redhat.com> (raw)
In-Reply-To: <CAMe9rOo7vBxcj=veaHybF07pZZdeFEpiNXn7Uh-PYaMmu4yMfg@mail.gmail.com> (H. J. Lu via Libc-alpha's message of "Sat, 16 May 2020 16:44:04 -0700")
* H. J. Lu via Libc-alpha:
> Here is the updated patch to use bitfields.
Thanks, I like this better.
> diff --git a/sysdeps/x86/cet-tunables.h b/sysdeps/x86/cet-control.h
> similarity index 61%
> rename from sysdeps/x86/cet-tunables.h
> rename to sysdeps/x86/cet-control.h
> index 5e1e42df10..3a314f9609 100644
> --- a/sysdeps/x86/cet-tunables.h
> +++ b/sysdeps/x86/cet-control.h
> @@ -16,14 +16,26 @@
> License along with the GNU C Library; if not, see
> <https://www.gnu.org/licenses/>. */
>
> -/* 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
> +#ifndef _CET_CONTROL_H
> +#define _CET_CONTROL_H
> +
> +/* For each CET feature, IBT and SHSTK, valid control values */
Missing ”.” at end of comment.
> +enum dl_x86_cet_control
> +{
> + /* Enable CET features based on ELF property note. */
> + elf_property = 0,
> + /* Always enable CET features. */
> + always_on,
> + /* Always disable CET features. */
> + always_off,
> + /* Enable CET features permissively. */
Missing double space after “.”.
> + permissive
> +};
Given enum constantse are not not scoped and this is a widely-included
header, I think you should include at least a “cet_” prefix in these
enum constants.
It's still not clear to me why CET control variables have to be in
_rtld_global. Regular global variables would likely lead to clearer
code, I think. _rtld_global is needed for read-write data that is
shared with libc/libdl, and this does not seem to apply to CET control
settings.
Thanks,
Florian
next prev parent reply other threads:[~2020-05-18 7:19 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-28 21:52 [PATCH 0/3] x86: Add --enable-cet=permissive H.J. Lu
2020-04-28 21:52 ` [PATCH 1/3] CET: Rename CET_MAX to CET_CONTROL_MASK [BZ #25887] H.J. Lu
2020-05-16 16:37 ` PING: " H.J. Lu
2020-05-16 17:27 ` Florian Weimer
2020-05-16 23:44 ` [PATCH] x86: Move CET control to _dl_x86_feature_control " H.J. Lu
2020-05-18 7:19 ` Florian Weimer [this message]
2020-05-18 12:26 ` V2 " H.J. Lu
2020-05-18 12:36 ` Florian Weimer
2020-04-28 21:52 ` [PATCH 2/3] rtld: Get architecture specific initializer in rtld_global H.J. Lu
2020-05-16 16:38 ` PING: " H.J. Lu
2020-05-16 17:51 ` Florian Weimer
2020-05-16 18:01 ` H.J. Lu
2020-05-16 18:07 ` Florian Weimer
2020-05-16 18:24 ` V2 [PATCH] " H.J. Lu
2020-04-28 21:52 ` [PATCH 3/3] x86: Add --enable-cet=permissive H.J. Lu
2020-04-29 17:19 ` [PATCH 0/3] " Adhemerval Zanella
2020-04-29 20:29 ` H.J. Lu
2020-04-29 20:46 ` Florian Weimer
2020-04-29 21:14 ` Adhemerval Zanella
2020-05-18 13:50 ` V2 [PATCH] " H.J. Lu
2020-05-18 14:43 ` Florian Weimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mu65g16k.fsf@oldenburg2.str.redhat.com \
--to=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).