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 C99C5C433EF for ; Thu, 14 Oct 2021 06:25:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B4210600CC for ; Thu, 14 Oct 2021 06:25:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230248AbhJNG1L (ORCPT ); Thu, 14 Oct 2021 02:27:11 -0400 Received: from pegase2.c-s.fr ([93.17.235.10]:45337 "EHLO pegase2.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbhJNG1I (ORCPT ); Thu, 14 Oct 2021 02:27:08 -0400 Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4HVK9g0tVkz9sSL; Thu, 14 Oct 2021 08:24:07 +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 zGFPxVrhXCQX; Thu, 14 Oct 2021 08:24:07 +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 4HVK9Z1cVsz9sSb; Thu, 14 Oct 2021 08:24:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 216968B788; Thu, 14 Oct 2021 08:24:02 +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 cZvDhBhYalVd; Thu, 14 Oct 2021 08:24:02 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.202.231]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C59318B763; Thu, 14 Oct 2021 08:24:01 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.16.1/8.16.1) with ESMTPS id 19E5oQ6W2266022 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 14 Oct 2021 07:50:26 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.16.1/8.16.1/Submit) id 19E5oQvM2266021; Thu, 14 Oct 2021 07:50:26 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Andrew Morton , "James E.J. Bottomley" , Helge Deller , Arnd Bergmann , Kees Cook , Greg Kroah-Hartman Cc: Christophe Leroy , 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: [PATCH v2 07/13] asm-generic: Define 'func_desc_t' to commonly describe function descriptors Date: Thu, 14 Oct 2021 07:49:56 +0200 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1634190596; l=3232; s=20211009; h=from:subject:message-id; bh=PspXIPOvak1jV5q03rr+fBd9+AoSM0fwfRZ7nHrjt9c=; b=AO+xrUi7Cl2VbWg0TANbnktYYtOjUAIOnukEhNVT8GFJRJUhbq9nE0gayYXHEQIm3ZiqWm97eWVs P+WasHdDB1+Hq1lIMFt3ZhAohl6HpdwdOKdLMgyn8tJJggN5urr+ X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org 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, 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 Signed-off-by: Christophe Leroy --- arch/ia64/include/asm/sections.h | 1 + arch/parisc/include/asm/sections.h | 2 ++ arch/powerpc/include/asm/sections.h | 1 + arch/powerpc/kernel/module_64.c | 8 -------- include/asm-generic/sections.h | 3 +++ 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/arch/ia64/include/asm/sections.h b/arch/ia64/include/asm/sections.h index 6e55e545bf02..1aaed8882294 100644 --- a/arch/ia64/include/asm/sections.h +++ b/arch/ia64/include/asm/sections.h @@ -11,6 +11,7 @@ #include #define HAVE_FUNCTION_DESCRIPTORS 1 +typedef struct fdesc func_desc_t; #include diff --git a/arch/parisc/include/asm/sections.h b/arch/parisc/include/asm/sections.h index 85149a89ff3e..37b34b357cb5 100644 --- a/arch/parisc/include/asm/sections.h +++ b/arch/parisc/include/asm/sections.h @@ -3,7 +3,9 @@ #define _PARISC_SECTIONS_H #ifdef CONFIG_64BIT +#include #define HAVE_FUNCTION_DESCRIPTORS 1 +typedef Elf64_Fdesc func_desc_t; #endif /* nothing to see, move along */ diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h index bba97b8c38cf..1322d7b2f1a3 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_FUNCTION_DESCRIPTORS 1 +typedef struct ppc64_opd_entry func_desc_t; #endif #include diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c index dc99a3f6cee2..affda7698242 100644 --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c @@ -32,11 +32,6 @@ #ifdef PPC64_ELF_ABI_v2 -/* An address is simply the address of the function. */ -typedef struct { - unsigned long addr; -} func_desc_t; - static func_desc_t func_desc(unsigned long addr) { return (func_desc_t){addr}; @@ -57,9 +52,6 @@ static unsigned int local_entry_offset(const Elf64_Sym *sym) } #else -/* An address is address of the OPD entry, which contains address of fn. */ -typedef struct ppc64_opd_entry func_desc_t; - static func_desc_t func_desc(unsigned long addr) { return *(func_desc_t *)addr; diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index b677e926e6b3..cbec7d5f1678 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 /* random extra sections (if any). Override -- 2.31.1 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 1181FC43217 for ; Thu, 14 Oct 2021 06:28:54 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 90F5861029 for ; Thu, 14 Oct 2021 06:28:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 90F5861029 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgroup.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HVKH76nVzz3cQZ for ; Thu, 14 Oct 2021 17:28:51 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=csgroup.eu (client-ip=93.17.235.10; helo=pegase2.c-s.fr; envelope-from=christophe.leroy@csgroup.eu; receiver=) Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4HVKBc5FmQz3cDG for ; Thu, 14 Oct 2021 17:24:56 +1100 (AEDT) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4HVK9g0tVkz9sSL; Thu, 14 Oct 2021 08:24:07 +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 zGFPxVrhXCQX; Thu, 14 Oct 2021 08:24:07 +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 4HVK9Z1cVsz9sSb; Thu, 14 Oct 2021 08:24:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 216968B788; Thu, 14 Oct 2021 08:24:02 +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 cZvDhBhYalVd; Thu, 14 Oct 2021 08:24:02 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.202.231]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C59318B763; Thu, 14 Oct 2021 08:24:01 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.16.1/8.16.1) with ESMTPS id 19E5oQ6W2266022 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 14 Oct 2021 07:50:26 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.16.1/8.16.1/Submit) id 19E5oQvM2266021; Thu, 14 Oct 2021 07:50:26 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Andrew Morton , "James E.J. Bottomley" , Helge Deller , Arnd Bergmann , Kees Cook , Greg Kroah-Hartman Subject: [PATCH v2 07/13] asm-generic: Define 'func_desc_t' to commonly describe function descriptors Date: Thu, 14 Oct 2021 07:49:56 +0200 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1634190596; l=3232; s=20211009; h=from:subject:message-id; bh=PspXIPOvak1jV5q03rr+fBd9+AoSM0fwfRZ7nHrjt9c=; b=AO+xrUi7Cl2VbWg0TANbnktYYtOjUAIOnukEhNVT8GFJRJUhbq9nE0gayYXHEQIm3ZiqWm97eWVs P+WasHdDB1+Hq1lIMFt3ZhAohl6HpdwdOKdLMgyn8tJJggN5urr+ X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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, 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 Signed-off-by: Christophe Leroy --- arch/ia64/include/asm/sections.h | 1 + arch/parisc/include/asm/sections.h | 2 ++ arch/powerpc/include/asm/sections.h | 1 + arch/powerpc/kernel/module_64.c | 8 -------- include/asm-generic/sections.h | 3 +++ 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/arch/ia64/include/asm/sections.h b/arch/ia64/include/asm/sections.h index 6e55e545bf02..1aaed8882294 100644 --- a/arch/ia64/include/asm/sections.h +++ b/arch/ia64/include/asm/sections.h @@ -11,6 +11,7 @@ #include #define HAVE_FUNCTION_DESCRIPTORS 1 +typedef struct fdesc func_desc_t; #include diff --git a/arch/parisc/include/asm/sections.h b/arch/parisc/include/asm/sections.h index 85149a89ff3e..37b34b357cb5 100644 --- a/arch/parisc/include/asm/sections.h +++ b/arch/parisc/include/asm/sections.h @@ -3,7 +3,9 @@ #define _PARISC_SECTIONS_H #ifdef CONFIG_64BIT +#include #define HAVE_FUNCTION_DESCRIPTORS 1 +typedef Elf64_Fdesc func_desc_t; #endif /* nothing to see, move along */ diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h index bba97b8c38cf..1322d7b2f1a3 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_FUNCTION_DESCRIPTORS 1 +typedef struct ppc64_opd_entry func_desc_t; #endif #include diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c index dc99a3f6cee2..affda7698242 100644 --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c @@ -32,11 +32,6 @@ #ifdef PPC64_ELF_ABI_v2 -/* An address is simply the address of the function. */ -typedef struct { - unsigned long addr; -} func_desc_t; - static func_desc_t func_desc(unsigned long addr) { return (func_desc_t){addr}; @@ -57,9 +52,6 @@ static unsigned int local_entry_offset(const Elf64_Sym *sym) } #else -/* An address is address of the OPD entry, which contains address of fn. */ -typedef struct ppc64_opd_entry func_desc_t; - static func_desc_t func_desc(unsigned long addr) { return *(func_desc_t *)addr; diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index b677e926e6b3..cbec7d5f1678 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 /* random extra sections (if any). Override -- 2.31.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christophe Leroy Date: Thu, 14 Oct 2021 05:49:56 +0000 Subject: [PATCH v2 07/13] asm-generic: Define 'func_desc_t' to commonly describe function descriptors Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Andrew Morton , "James E.J. Bottomley" , Helge Deller , Arnd Bergmann , Kees Cook , Greg Kroah-Hartman Cc: Christophe Leroy , 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 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, 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 Signed-off-by: Christophe Leroy --- arch/ia64/include/asm/sections.h | 1 + arch/parisc/include/asm/sections.h | 2 ++ arch/powerpc/include/asm/sections.h | 1 + arch/powerpc/kernel/module_64.c | 8 -------- include/asm-generic/sections.h | 3 +++ 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/arch/ia64/include/asm/sections.h b/arch/ia64/include/asm/sections.h index 6e55e545bf02..1aaed8882294 100644 --- a/arch/ia64/include/asm/sections.h +++ b/arch/ia64/include/asm/sections.h @@ -11,6 +11,7 @@ #include #define HAVE_FUNCTION_DESCRIPTORS 1 +typedef struct fdesc func_desc_t; #include diff --git a/arch/parisc/include/asm/sections.h b/arch/parisc/include/asm/sections.h index 85149a89ff3e..37b34b357cb5 100644 --- a/arch/parisc/include/asm/sections.h +++ b/arch/parisc/include/asm/sections.h @@ -3,7 +3,9 @@ #define _PARISC_SECTIONS_H #ifdef CONFIG_64BIT +#include #define HAVE_FUNCTION_DESCRIPTORS 1 +typedef Elf64_Fdesc func_desc_t; #endif /* nothing to see, move along */ diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h index bba97b8c38cf..1322d7b2f1a3 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_FUNCTION_DESCRIPTORS 1 +typedef struct ppc64_opd_entry func_desc_t; #endif #include diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c index dc99a3f6cee2..affda7698242 100644 --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c @@ -32,11 +32,6 @@ #ifdef PPC64_ELF_ABI_v2 -/* An address is simply the address of the function. */ -typedef struct { - unsigned long addr; -} func_desc_t; - static func_desc_t func_desc(unsigned long addr) { return (func_desc_t){addr}; @@ -57,9 +52,6 @@ static unsigned int local_entry_offset(const Elf64_Sym *sym) } #else -/* An address is address of the OPD entry, which contains address of fn. */ -typedef struct ppc64_opd_entry func_desc_t; - static func_desc_t func_desc(unsigned long addr) { return *(func_desc_t *)addr; diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index b677e926e6b3..cbec7d5f1678 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 /* random extra sections (if any). Override -- 2.31.1