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 D813AC43217 for ; Wed, 13 Oct 2021 07:01:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6F7FD6103C for ; Wed, 13 Oct 2021 07:01:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6F7FD6103C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 02B17940007; Wed, 13 Oct 2021 03:01:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F1D136B0071; Wed, 13 Oct 2021 03:01:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E0C35940007; Wed, 13 Oct 2021 03:01:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D022F6B006C for ; Wed, 13 Oct 2021 03:01:51 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A73672D00D for ; Wed, 13 Oct 2021 07:01:50 +0000 (UTC) X-FDA: 78690519180.05.F3BE000 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by imf01.hostedemail.com (Postfix) with ESMTP id 6B9B85079B37 for ; Wed, 13 Oct 2021 07:01:50 +0000 (UTC) Received: by mail-pf1-f174.google.com with SMTP id y7so1609441pfg.8 for ; Wed, 13 Oct 2021 00:01:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=W1TvfEn9hETtgRdpCl58SYxcbENIjjH6xIOozoqUidk=; b=MiMmWBnV7fK/LRulBj97pgznDjd0sTVyvYOHU+wqZXHDzKYsb5IY0/pybu5wCZVeUO 89tP8M8FQFXw1CVUA6arONHwFzF7aXl/UqXncJs22D99krNezbXxMuuF6TpDeG+DvXC3 wMyDgBXJxJzBcQsvICTBtJ/TWHtit/X5eqtpY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=W1TvfEn9hETtgRdpCl58SYxcbENIjjH6xIOozoqUidk=; b=VTYOaPmpvE+AdOe5Vs6iWtjiuFgkIH4Yw7st18dmmcvj2JppJ5iWqIuqBxlQYg/Acf PBuYf/yQmjSW640H4nFw8jUR6gUKvo6k31KP413ZnRqm2NErRSe/wX8xCUidox7DdE9O sewUty22TDkSUdtTi9m8fcvuwfYqFZp2jufbsbI4uIphL6fPiHfe2zkrbSQA+jQ96OBX FNHD63XopXcPWBn6cvY65kIWEByS2kOleUB+xFMHwqmzwxyDbelkufO3/eHK9I+uS08w Uyw6Myi9KuCqjvejj1MymnXnKSZQiFWoI82C7JymS97sUIKcyk/VQVHILBDvCpQF4sss tzKA== X-Gm-Message-State: AOAM530MpAAat6nkhtX0ApDbyC0iyFYXjVYOenMtCEoOou3YE/fr+N73 EbPJJ5lfv2E2lfdbB3NXarsNdA== X-Google-Smtp-Source: ABdhPJwyFLjw/2mnoLszmWzrHimaUwUUOJtR4rLgtHIulRE2XeazTIf6D+X27fVIGJT33rf3Ee5ReA== X-Received: by 2002:a63:9a12:: with SMTP id o18mr17842269pge.419.1634108509519; Wed, 13 Oct 2021 00:01:49 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id a67sm12924857pfa.128.2021.10.13.00.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Oct 2021 00:01:49 -0700 (PDT) Date: Wed, 13 Oct 2021 00:01:48 -0700 From: Kees Cook To: Christophe Leroy 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 Subject: Re: [PATCH v1 05/10] asm-generic: Define 'funct_descr_t' to commonly describe function descriptors Message-ID: <202110130001.11A50456@keescook> References: <02224551451ab9c37055499fc621c41246c81125.1633964380.git.christophe.leroy@csgroup.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <02224551451ab9c37055499fc621c41246c81125.1633964380.git.christophe.leroy@csgroup.eu> Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=MiMmWBnV; spf=pass (imf01.hostedemail.com: domain of keescook@chromium.org designates 209.85.210.174 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 6B9B85079B37 X-Stat-Signature: uzirdhjcwnjmbkrjaoep5dgts3pigbfr X-HE-Tag: 1634108510-517839 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: 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, nit: funct_descr_t reads weird to me. why not func_desc_t ? Either way: Reviewed-by: Kees Cook > 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 @@ > */ > > #define HAVE_DEREFERENCE_FUNCTION_DESCRIPTOR 1 > +typedef struct fdesc funct_descr_t; > > #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 @@ > > #ifdef CONFIG_64BIT > #define HAVE_DEREFERENCE_FUNCTION_DESCRIPTOR 1 > +typedef Elf64_Fdesc funct_descr_t; > #endif > > /* nothing to see, move along */ > diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/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 @@ > > #ifdef PPC64_ELF_ABI_v1 > #define HAVE_DEREFERENCE_FUNCTION_DESCRIPTOR 1 > +typedef struct ppc64_opd_entry funct_descr_t; > #endif > > #include > diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.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 > > /* random extra sections (if any). Override > -- > 2.31.1 > -- Kees Cook