lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d128fb7d-6b24-5caf-8e3a-99d55922cd95@efficios.com>
Date:   Mon, 17 Oct 2022 12:09:03 -0400
From:   Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To:     Florian Weimer <fweimer@...hat.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
        "Paul E . McKenney" <paulmck@...nel.org>,
        Boqun Feng <boqun.feng@...il.com>,
        "H . Peter Anvin" <hpa@...or.com>, Paul Turner <pjt@...gle.com>,
        linux-api@...r.kernel.org, Christian Brauner <brauner@...nel.org>,
        David.Laight@...LAB.COM, carlos@...hat.com,
        Peter Oskolkov <posk@...k.io>,
        Alexander Mikhalitsyn <alexander@...alicyn.com>
Subject: Re: [PATCH v4 01/25] rseq: Introduce feature size and alignment ELF
 auxiliary vector entries

On 2022-10-10 08:42, Florian Weimer wrote:
> * Mathieu Desnoyers:
> 
>> Export the rseq feature size supported by the kernel as well as the
>> required allocation alignment for the rseq per-thread area to user-space
>> through ELF auxiliary vector entries.
>>
>> This is part of the extensible rseq ABI.
>>
>> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
>> ---
>>   fs/binfmt_elf.c             | 5 +++++
>>   include/uapi/linux/auxvec.h | 2 ++
>>   include/uapi/linux/rseq.h   | 5 +++++
>>   3 files changed, 12 insertions(+)
>>
>> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
>> index 63c7ebb0da89..04fca1e4cbd2 100644
>> --- a/fs/binfmt_elf.c
>> +++ b/fs/binfmt_elf.c
>> @@ -46,6 +46,7 @@
>>   #include <linux/cred.h>
>>   #include <linux/dax.h>
>>   #include <linux/uaccess.h>
>> +#include <linux/rseq.h>
>>   #include <asm/param.h>
>>   #include <asm/page.h>
>>   
>> @@ -288,6 +289,10 @@ create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec,
>>   	if (bprm->have_execfd) {
>>   		NEW_AUX_ENT(AT_EXECFD, bprm->execfd);
>>   	}
>> +#ifdef CONFIG_RSEQ
>> +	NEW_AUX_ENT(AT_RSEQ_FEATURE_SIZE, offsetof(struct rseq, end));
>> +	NEW_AUX_ENT(AT_RSEQ_ALIGN, __alignof__(struct rseq));
>> +#endif
>>   #undef NEW_AUX_ENT
>>   	/* AT_NULL is zero; clear the rest too */
>>   	memset(elf_info, 0, (char *)mm->saved_auxv +
>> diff --git a/include/uapi/linux/auxvec.h b/include/uapi/linux/auxvec.h
>> index c7e502bf5a6f..6991c4b8ab18 100644
>> --- a/include/uapi/linux/auxvec.h
>> +++ b/include/uapi/linux/auxvec.h
>> @@ -30,6 +30,8 @@
>>   				 * differ from AT_PLATFORM. */
>>   #define AT_RANDOM 25	/* address of 16 random bytes */
>>   #define AT_HWCAP2 26	/* extension of AT_HWCAP */
>> +#define AT_RSEQ_FEATURE_SIZE	27	/* rseq supported feature size */
>> +#define AT_RSEQ_ALIGN		28	/* rseq allocation alignment */
>>   
>>   #define AT_EXECFN  31	/* filename of program */
> 
> Do we need the alignment?  Or can we keep it perpetually at 32?  Or we
> could steal some bits from AT_RSEQ_FEATURE_SIZE?  (Not the lower
> bits—they aren't unused due to the way the feature size works.)

I cannot imagine a use-case that would require us to bump the alignment 
requirement over 32 bytes, so we may very well leave it at 32. But 
perhaps someone else has a better imagination than mine ?

Thanks,

Mathieu

> 
> Thanks,
> Florian
> 

-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ