This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] x86/CET: Renumber ARCH_CET_LEGACY_BITMAP to 0x3006


* 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]