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 486E0C433F5 for ; Mon, 18 Oct 2021 09:16:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D18A7610C7 for ; Mon, 18 Oct 2021 09:16:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D18A7610C7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 5C6216B006C; Mon, 18 Oct 2021 05:16:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 575AC6B0071; Mon, 18 Oct 2021 05:16:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43D556B0072; Mon, 18 Oct 2021 05:16:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0202.hostedemail.com [216.40.44.202]) by kanga.kvack.org (Postfix) with ESMTP id 316C36B006C for ; Mon, 18 Oct 2021 05:16:33 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D729018041E84 for ; Mon, 18 Oct 2021 09:16:32 +0000 (UTC) X-FDA: 78709002624.22.66E5381 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by imf15.hostedemail.com (Postfix) with ESMTP id 0A84DD000096 for ; Mon, 18 Oct 2021 09:16:29 +0000 (UTC) Received: by mail-pl1-f178.google.com with SMTP id v20so10767649plo.7 for ; Mon, 18 Oct 2021 02:16:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=bk4CmdQz8HPJtWkdQrroAn/KfmHvlYv0QT69F5KgUYY=; b=SIY6SmxSooe6c5+WSnMw0wpVs8QY7NiY+XZuBJ+D71+hWvHEdC2Vbwe6t160uJL/aH SxAjedhuo7/GPRc5DJ/SEAzpZfnAKWBOZFVYti9AdvfYsJcQ4rL3+DM2dFweZBuHNa2+ +plqntehvZ9SJWnhWeMNJxgbPzWwOsSXBy+aWPK6JCymQrSbx9dlArY4Er+FBijnqB2+ KaAdeks2O345KWfd39ueUFOjpMJSBOKHlggozA8hAbjjoen/SEHYJ6ZGB4a5AA4ymoTX S+O+sY98XhFR6qaduHBAgc9j1zJ+556dXM7nA9EQbpd+M4xKLyV6Ni7/OoKNvSsZa2tY Ga4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=bk4CmdQz8HPJtWkdQrroAn/KfmHvlYv0QT69F5KgUYY=; b=Qok6+VgCalfF4j4IuM7utXAQ287KqWsVNpelwLxkVO7CTwVG7wvvKKUK+5Y9YWSPqO lYZ3sjRteuJ1p3Poy0IbMo7J5YKSnTG8ZnQiopEB4OSP6OHiv4vFbCSFWelHdtaOil4r PmIyOiU0M/giuqHSUph9g2s3eAyD+TztjbQuHUPYcONvV1pFXVk7E6TE1iybqd9rqNRW xdyPCb+0HZPMRmmEjA6nAGa3mhIY8G7CjSj+2slKti2F0PxGLlSZs+pzLnm82LkqOIrK GYVNZxjJP6SIJqrL2dsMWThT5n0h3GmfIlYy4DNg+H6/Y3iB9fUKOeKA5kqFnYbMgVh2 U6aA== X-Gm-Message-State: AOAM531syF62MXq0M4WPJqTUIpGvOYlS4unCMd1yvalMJ1fS0rBC1vnI iGHi4MJYYlsgepNdIbIlu0R31xc3y/c= X-Google-Smtp-Source: ABdhPJzhlLMrCQ4LZ3XWVQonDSXYo92dxUzu1RcvXP5BET6OhlsHPRAv2Q264erQZkrgYN002t+nDA== X-Received: by 2002:a17:90a:2c02:: with SMTP id m2mr17579869pjd.109.1634548591342; Mon, 18 Oct 2021 02:16:31 -0700 (PDT) Received: from localhost ([58.171.214.181]) by smtp.gmail.com with ESMTPSA id rj2sm13068038pjb.32.2021.10.18.02.16.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 02:16:31 -0700 (PDT) Date: Mon, 18 Oct 2021 19:16:25 +1000 From: Nicholas Piggin Subject: Re: [PATCH v3 07/12] asm-generic: Define 'func_desc_t' to commonly describe function descriptors To: Andrew Morton , Arnd Bergmann , Benjamin Herrenschmidt , Christophe Leroy , Helge Deller , Greg Kroah-Hartman , "James E.J. Bottomley" , Kees Cook , Michael Ellerman , Paul Mackerras Cc: linux-arch@vger.kernel.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <1634538449.eah9b31bbz.astroid@bobo.none> <802b3ff9-8ada-b45b-2b69-b6a23f0c3664@csgroup.eu> In-Reply-To: <802b3ff9-8ada-b45b-2b69-b6a23f0c3664@csgroup.eu> MIME-Version: 1.0 Message-Id: <1634546857.xamu59z8sr.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 0A84DD000096 X-Stat-Signature: snegjw1xdcjtfi1xi4q6k6nqttu7oukz Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=SIY6SmxS; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of npiggin@gmail.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=npiggin@gmail.com X-HE-Tag: 1634548589-146489 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: Excerpts from Christophe Leroy's message of October 18, 2021 5:07 pm: >=20 >=20 > Le 18/10/2021 =C3=A0 08:29, Nicholas Piggin a =C3=A9crit=C2=A0: >> Excerpts from Christophe Leroy's message of October 17, 2021 10:38 pm: >>> We have three architectures using function descriptors, each with its >>> own type and name. >>> >>> Add a common typedef that can be used in generic code. >>> >>> Also add a stub typedef for architecture without function descriptors, >>> to avoid a forest of #ifdefs. >>> >>> It replaces the similar 'func_desc_t' previously defined in >>> arch/powerpc/kernel/module_64.c >>> >>> Reviewed-by: Kees Cook >>> Acked-by: Arnd Bergmann >>> Signed-off-by: Christophe Leroy >>> --- >>=20 >> [...] >>=20 >>> diff --git a/include/asm-generic/sections.h b/include/asm-generic/secti= ons.h >>> index a918388d9bf6..33b51efe3a24 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; >>> +} func_desc_t; >>> #endif >>> =20 >>=20 >> I think that deserves a comment. If it's just to allow ifdef to be >> avoided, I guess that's okay with a comment. Would be nice if you could >> cause it to generate a link time error if it was ever used like >> undefined functions, but I guess you can't. It's not a necessity though. >>=20 >=20 > I tried to explain it in the commit message, but I can add a comment=20 > here in addition for sure. Thanks. >=20 > By the way, it IS used in powerpc's module_64.c: Ah yes of course. I guess the point is function descriptors don't exist=20 so it should not be used (in general). powerpc module code knows what it is doing, I guess it's okay for it to use it. Thanks, Nick