[PATCH] x86: Remove ARCH_CET_LEGACY_BITMAP [BZ #25397]
Florian Weimer
fw@deneb.enyo.de
Mon Mar 9 10:03:37 GMT 2020
* H. J. Lu:
> diff --git a/sysdeps/x86/dl-cet.c b/sysdeps/x86/dl-cet.c
> index ca3b5849bc..2be7a3a49f 100644
> --- a/sysdeps/x86/dl-cet.c
> +++ b/sysdeps/x86/dl-cet.c
> + /* IBT is enabled only if it is enabled in executable as
> + well as all shared objects. */
> + enable_ibt &= (enable_ibt_type == CET_ALWAYS_ON
> + || (l->l_cet & lc_ibt) != 0);
As a general comment, I think we should add more logging as to way
processes lose protection. But that does not need to happen with this
patch.
> + /* When IBT is enabled, we can't dlopening a shared
> + object without IBT. */
“we cannot dlopen”
> + if (enable_ibt != ibt_enabled)
> + _dl_signal_error (EINVAL, l->l_name, "dlopen",
> + N_("indirect branch tracking isn't enabled"));
I think the error message should say *where* indirect branch tracking
is not enabled. I assume this is a property of the loaded object.
> + /* When SHSTK is enabled, we can't dlopening a shared
> + object without SHSTK. */
> + if (enable_shstk != shstk_enabled)
> + _dl_signal_error (EINVAL, l->l_name, "dlopen",
> + N_("shadow stack isn't enabled"));
See above.
> diff --git a/sysdeps/x86/tst-cet-legacy-7.c b/sysdeps/x86/tst-cet-legacy-7.c
> new file mode 100644
> index 0000000000..e6f5d6f145
> --- /dev/null
> +++ b/sysdeps/x86/tst-cet-legacy-7.c
> + funcp = mmap (NULL, 0x1000, PROT_EXEC | PROT_READ | PROT_WRITE,
> + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
> + if (funcp == MAP_FAILED)
> + FAIL_EXIT1 ("mmap failed (errno=%d)", errno);
You could use xmmap here.
Rest of the patch looks okay to me.
More information about the Libc-alpha
mailing list