[PATCH 2/5] linux: Implement mprotect in C (BZ 34917)

Florian Weimer fweimer@redhat.com
Fri Nov 6 09:38:16 GMT 2026


* Adhemerval Zanella:

> On x86_64, x32, and aarch64 the upper half of a register holding a 32-bit
> argument is unspecified, so a valid call can fail, for instance:
>
>   __attribute__ ((noipa)) int
>   f (void *addr, size_t len, long int prot)
>   {
>     return mprotect (addr, len, prot);
>   }
>
>   f (addr, len, PROT_READ | ~0xffffffffL)
>
> returns -1 with EINVAL.
>
> Implement mprotect in C, where INLINE_SYSCALL_CALL extends the argument
> to the full register on these ABIs.
>
> Checked on x86_64-linux-gnu.

Okay.

Reviewed-by: Florian Weimer <fweimer@redhat.com>

Thanks,
Florian



More information about the Libc-alpha mailing list