This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] x86/CET: Renumber ARCH_CET_LEGACY_BITMAP to 0x3006
- From: Florian Weimer <fweimer at redhat dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 20 Nov 2018 17:07:03 +0100
- Subject: Re: [PATCH] x86/CET: Renumber ARCH_CET_LEGACY_BITMAP to 0x3006
- References: <20181120142214.20783-1-hjl.tools@gmail.com>
* H. J. Lu:
> The current CET kernel:
>
> https://github.com/yyu168/linux_cet
>
> changed legacy region bitmap allocation from kernel to user space and
> renumbered the prctl number from 0x3005 to 0x3006. This patch updates
> glibc with:
>
> /* Enable legacy region bitmap with unsigned long long *addr:
> address: addr[0].
> size: addr[1].
> */
> # define ARCH_CET_LEGACY_BITMAP 0x3006
The patch looks okay in general, but I suggest to wait until this is
actually merged into an upstream kernel, so that we don't have to change
the number again.
> + /* Allocate and enable legacy bitmap. */
> + size_t legacy_bitmap_size
> + = ((uintptr_t) __libc_stack_end
> + / GLRO(dl_pagesize) / 8);
> + void *legacy_bitmap_addr
> + = __mmap (NULL, legacy_bitmap_size,
> + PROT_READ | PROT_WRITE,
> + MAP_ANON | MAP_PRIVATE | MAP_NORESERVE,
> + -1, 0);
> + if (legacy_bitmap_addr == MAP_FAILED)
> + {
> + if (program)
> + _dl_fatal_printf ("%s: mmap legacy bitmap failed\n",
> + l->l_name);
> + else
> + _dl_signal_error (EINVAL, l->l_name, "dlopen",
> + N_("mmap legacy bitmap failed"));
Maybe you can log the size of the mapping attempt? That could be useful
to diagnose failures.
Thanks,
Florian