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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A751C433FE for ; Wed, 13 Oct 2021 07:24:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CB6C460E53 for ; Wed, 13 Oct 2021 07:24:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CB6C460E53 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgroup.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 78C266B006C; Wed, 13 Oct 2021 03:24:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7151B940007; Wed, 13 Oct 2021 03:24:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5B6166B0072; Wed, 13 Oct 2021 03:24:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0025.hostedemail.com [216.40.44.25]) by kanga.kvack.org (Postfix) with ESMTP id 4B7676B006C for ; Wed, 13 Oct 2021 03:24:00 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0CBE8181AF5F7 for ; Wed, 13 Oct 2021 07:24:00 +0000 (UTC) X-FDA: 78690575040.29.E686895 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf12.hostedemail.com (Postfix) with ESMTP id 81CA810000A0 for ; Wed, 13 Oct 2021 07:23:59 +0000 (UTC) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4HTkY93BjVz9sST; Wed, 13 Oct 2021 09:23:57 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4hf0ycKUqtHN; Wed, 13 Oct 2021 09:23:57 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4HTkY929sHz9sSS; Wed, 13 Oct 2021 09:23:57 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 33BA88B77D; Wed, 13 Oct 2021 09:23:57 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 18BEj8t-Aal3; Wed, 13 Oct 2021 09:23:57 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [172.25.230.103]) by messagerie.si.c-s.fr (Postfix) with ESMTP id F2D588B763; Wed, 13 Oct 2021 09:23:56 +0200 (CEST) Subject: Re: [PATCH v1 05/10] asm-generic: Define 'funct_descr_t' to commonly describe function descriptors To: Kees Cook Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Andrew Morton , "James E.J. Bottomley" , Helge Deller , Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org References: <02224551451ab9c37055499fc621c41246c81125.1633964380.git.christophe.leroy@csgroup.eu> <202110130001.11A50456@keescook> From: Christophe Leroy Message-ID: Date: Wed, 13 Oct 2021 09:23:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <202110130001.11A50456@keescook> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr-FR X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 81CA810000A0 X-Stat-Signature: ow7grbjb8wkio1zx9cobdfpimbmw5zrb Authentication-Results: imf12.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf12.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-HE-Tag: 1634109839-853950 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Le 13/10/2021 =C3=A0 09:01, Kees Cook a =C3=A9crit=C2=A0: > On Mon, Oct 11, 2021 at 05:25:32PM +0200, Christophe Leroy wrote: >> We have three architectures using function descriptors, each with its >> own name. >> >> Add a common typedef that can be used in generic code. >> >> Also add a stub typedef for architecture without function descriptors, >=20 > nit: funct_descr_t reads weird to me. why not func_desc_t ? Either way: func_desc_t already exists in powerpc. I have a patch to remove it as it=20 is redundant with struct ppc64_opd_entry, but I didnt' want to include=20 it in this series. But after all I can add it in this series, I'll add it in v2. Christophe >=20 > Reviewed-by: Kees Cook >=20 >=20 >> to avoid a forest of #ifdefs. >> >> Signed-off-by: Christophe Leroy >> --- >> arch/ia64/include/asm/sections.h | 1 + >> arch/parisc/include/asm/sections.h | 1 + >> arch/powerpc/include/asm/sections.h | 1 + >> include/asm-generic/sections.h | 3 +++ >> 4 files changed, 6 insertions(+) >> >> diff --git a/arch/ia64/include/asm/sections.h b/arch/ia64/include/asm/= sections.h >> index 80f5868afb06..929b5c535620 100644 >> --- a/arch/ia64/include/asm/sections.h >> +++ b/arch/ia64/include/asm/sections.h >> @@ -8,6 +8,7 @@ >> */ >> =20 >> #define HAVE_DEREFERENCE_FUNCTION_DESCRIPTOR 1 >> +typedef struct fdesc funct_descr_t; >> =20 >> #include >> #include >> diff --git a/arch/parisc/include/asm/sections.h b/arch/parisc/include/= asm/sections.h >> index 2e781ee19b66..329e80f7af0a 100644 >> --- a/arch/parisc/include/asm/sections.h >> +++ b/arch/parisc/include/asm/sections.h >> @@ -4,6 +4,7 @@ >> =20 >> #ifdef CONFIG_64BIT >> #define HAVE_DEREFERENCE_FUNCTION_DESCRIPTOR 1 >> +typedef Elf64_Fdesc funct_descr_t; >> #endif >> =20 >> /* nothing to see, move along */ >> diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/includ= e/asm/sections.h >> index b7f1ba04e756..d0d5287fa568 100644 >> --- a/arch/powerpc/include/asm/sections.h >> +++ b/arch/powerpc/include/asm/sections.h >> @@ -10,6 +10,7 @@ >> =20 >> #ifdef PPC64_ELF_ABI_v1 >> #define HAVE_DEREFERENCE_FUNCTION_DESCRIPTOR 1 >> +typedef struct ppc64_opd_entry funct_descr_t; >> #endif >> =20 >> #include >> diff --git a/include/asm-generic/sections.h b/include/asm-generic/sect= ions.h >> index 1db5cfd69817..436412d94054 100644 >> --- a/include/asm-generic/sections.h >> +++ b/include/asm-generic/sections.h >> @@ -63,6 +63,9 @@ extern __visible const void __nosave_begin, __nosave= _end; >> #else >> #define dereference_function_descriptor(p) ((void *)(p)) >> #define dereference_kernel_function_descriptor(p) ((void *)(p)) >> +typedef struct { >> + unsigned long addr; >> +} funct_descr_t; >> #endif >> =20 >> /* random extra sections (if any). Override >> --=20 >> 2.31.1 >> >=20