From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 096FEC433FE for ; Mon, 10 Oct 2022 12:42:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230501AbiJJMmz (ORCPT ); Mon, 10 Oct 2022 08:42:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230471AbiJJMmy (ORCPT ); Mon, 10 Oct 2022 08:42:54 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF3CD5300C for ; Mon, 10 Oct 2022 05:42:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665405771; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BZsgFIaUtMtPOAUv6onkZwQ4ROTArLHZaqizv0UA7y8=; b=UbMmQ0KJSWa0R+bnvzDdm0yxPNytBOj1EXwEnWupdxjfDBv5+4Sfhy5lIOo2eD6xp6uSYF FCTkEK7ufIrxyFYhAG/bQqcpASJYkFzhDHLKUb8rWUL7x5e2QVwppIRVczUoRiztLqBayc 1wPVT/yQ9aarCkoEhhpPLF/6lliBXvQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-13-JZ7A8OJQM6CxKAIYT4lcFg-1; Mon, 10 Oct 2022 08:42:48 -0400 X-MC-Unique: JZ7A8OJQM6CxKAIYT4lcFg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AEDEB3803903; Mon, 10 Oct 2022 12:42:47 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.124]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9DBA541136E5; Mon, 10 Oct 2022 12:42:44 +0000 (UTC) From: Florian Weimer To: Mathieu Desnoyers Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, Thomas Gleixner , "Paul E . McKenney" , Boqun Feng , "H . Peter Anvin" , Paul Turner , linux-api@vger.kernel.org, Christian Brauner , David.Laight@ACULAB.COM, carlos@redhat.com, Peter Oskolkov , Alexander Mikhalitsyn Subject: Re: [PATCH v4 01/25] rseq: Introduce feature size and alignment ELF auxiliary vector entries References: <20220922105941.237830-1-mathieu.desnoyers@efficios.com> <20220922105941.237830-2-mathieu.desnoyers@efficios.com> Date: Mon, 10 Oct 2022 14:42:42 +0200 In-Reply-To: <20220922105941.237830-2-mathieu.desnoyers@efficios.com> (Mathieu Desnoyers's message of "Thu, 22 Sep 2022 06:59:16 -0400") Message-ID: <877d1726kd.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org * 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 > --- > 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 > #include > #include > +#include > #include > #include >=20=20 > @@ -288,6 +289,10 @@ create_elf_tables(struct linux_binprm *bprm, const s= truct 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 */ >=20=20 > #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=E2=80=94they aren't unused due to the way the feature size works.) Thanks, Florian