From patchwork Wed Nov 22 22:18:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 168581 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:6f03:b0:164:83eb:24d7 with SMTP id r3csp1537148rwn; Wed, 22 Nov 2023 14:18:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHw8dtrz3NPdPXx58mFFGnvWyOdwtHll4UwXFX92Pmnk2hXnwMPZSvjjMJAUattrtTbwnpi X-Received: by 2002:a17:902:c94d:b0:1cc:5258:845c with SMTP id i13-20020a170902c94d00b001cc5258845cmr4074070pla.57.1700691526968; Wed, 22 Nov 2023 14:18:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700691526; cv=none; d=google.com; s=arc-20160816; b=v6+lOPS+89oftPQBypMqlGeDdiOXYpfNlv4ZSxDZ3I5lCsU8FY/TYB6oLUvLts/4dm Nz818GteLuziXOu6SEXg8PdswZBdNjtp2ipA1AqmgpySF1BtMt1Vc7F2YR4CNXokL4ke DH+l+15cu3YnM6/la2v7kudezsyvuzLfty4TVH+ZHaAQbAzM1/7GGs249oCs/0tEnQe1 rFsAAm93Yde9li78nHuZVjEFqXVyQoKVRY7op86m2zFAJktn4PIZyduA0twz0fQuX53T v1upSfSUbVjngSfx+g8/yXkTW/P3DsAnK2gVg38lH6/TXedpR0MeA3wQ29ZlOyFVf6+p wbhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=VITu87Pl3VKgeOzJVXV4EdGm4xnooqaitfGti+g61fk=; fh=p1Qf4H5TYe6x87oeu/ZwD97uWE3f/aSmdhLxEgeh+tk=; b=hVSTSmjUMKvowaUM5hRP/jZ2y5aJjmX1VU4wciry+AtFU/dMMNMyTmHrdnCFTAvjzo BUXmKxyFDoXQSKHzAnqqkR5lFczN4UFBslcTSmTYtxFefuOta9VWLY/CtaE2N7d7TkaR LvXWgkhEtP/BLurkwro0z87grAojhtLlpViw+vmzszy0zahkHAsRUZEY0zDecpozvp9j WuYjbko3gh+EDoE1n8EXC40YjlBMgRSM1kV3pKmM5ENfu4u4HnTqbgS1Zo0Lb6xwMRIf PG6kbeR6a95uDGmZAQyQ5o3zVFUtiQGkZ9EsbhRDDJelEfz5B/oXsalvn9rVsKMUGA2Y U07Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m2h70Ph0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id p9-20020a170902bd0900b001cc23d2bb92si285853pls.650.2023.11.22.14.18.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 14:18:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m2h70Ph0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 6CE7F825B4A9; Wed, 22 Nov 2023 14:18:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344678AbjKVWS3 (ORCPT + 99 others); Wed, 22 Nov 2023 17:18:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344659AbjKVWSY (ORCPT ); Wed, 22 Nov 2023 17:18:24 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA60BD49 for ; Wed, 22 Nov 2023 14:18:20 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08242C433CA; Wed, 22 Nov 2023 22:18:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700691500; bh=xbM7UwIkiSdSjSS3CBuDr633BLrw+vGBgZ7TQFhbsLY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=m2h70Ph0oAZb/KX4nmAIJIgAmgEZEAHewd+1aGGUOhZc0ygMNSOWeUiEp1Yg2WYgy vN3jz96ggTWzf1Bzay6hfnIGbpcm6KWoXWDKgTCPKRFBnwnJo53wEurBHbmta/5y+F MtE0afBV1dJSy4Js5ujpLxMDxY+lmy3oDFmunIGryqALbZSCSERfm4NW6NBKDd/cZY Vrb7l60r4giYrU3WZ2eflFchwcLkYBTML9vieiuIqzr3zvsWKZRmMvmalsDisaSBhM S79EOfk01xMSaLSuK1QPOMEwM4smNWNix8Jo/Kdp4fF7Ulk7r0ZUUllRLeCLj4URPW hAYOhMY02eQkA== From: deller@kernel.org To: linux-kernel@vger.kernel.org, Masahiro Yamada , Arnd Bergmann , linux-modules@vger.kernel.org, linux-arch@vger.kernel.org, Luis Chamberlain Subject: [PATCH 1/4] linux/export: Fix alignment for 64-bit ksymtab entries Date: Wed, 22 Nov 2023 23:18:11 +0100 Message-ID: <20231122221814.139916-2-deller@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231122221814.139916-1-deller@kernel.org> References: <20231122221814.139916-1-deller@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 22 Nov 2023 14:18:37 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783304318623414526 X-GMAIL-MSGID: 1783304318623414526 From: Helge Deller An alignment of 4 bytes is wrong for 64-bit platforms which don't define CONFIG_HAVE_ARCH_PREL32_RELOCATIONS (which then store 64-bit pointers). Fix their alignment to 8 bytes. Signed-off-by: Helge Deller Acked-by: Masahiro Yamada --- include/linux/export-internal.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/export-internal.h b/include/linux/export-internal.h index 69501e0ec239..cd253eb51d6c 100644 --- a/include/linux/export-internal.h +++ b/include/linux/export-internal.h @@ -16,10 +16,13 @@ * and eliminates the need for absolute relocations that require runtime * processing on relocatable kernels. */ +#define __KSYM_ALIGN ".balign 4" #define __KSYM_REF(sym) ".long " #sym "- ." #elif defined(CONFIG_64BIT) +#define __KSYM_ALIGN ".balign 8" #define __KSYM_REF(sym) ".quad " #sym #else +#define __KSYM_ALIGN ".balign 4" #define __KSYM_REF(sym) ".long " #sym #endif @@ -42,7 +45,7 @@ " .asciz \"" ns "\"" "\n" \ " .previous" "\n" \ " .section \"___ksymtab" sec "+" #name "\", \"a\"" "\n" \ - " .balign 4" "\n" \ + __KSYM_ALIGN "\n" \ "__ksymtab_" #name ":" "\n" \ __KSYM_REF(sym) "\n" \ __KSYM_REF(__kstrtab_ ##name) "\n" \ From patchwork Wed Nov 22 22:18:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 168580 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:6f03:b0:164:83eb:24d7 with SMTP id r3csp1537113rwn; Wed, 22 Nov 2023 14:18:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3IK185RNMdbkZYeJTYQGlHH3ipTiuVPtccnurZUkznN1QIyW2pJSPjDKLF4YCvYQa04SV X-Received: by 2002:a05:6a00:1c8c:b0:6be:5a1a:3b93 with SMTP id y12-20020a056a001c8c00b006be5a1a3b93mr3602956pfw.4.1700691521969; Wed, 22 Nov 2023 14:18:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700691521; cv=none; d=google.com; s=arc-20160816; b=bnE1dGRe+GCF5ibCR/fPQffB7zaEgyXOzKnTAPmdcvag/SM/v2pAp7fdVyyTYMlDCv CDo/43JyTVg9GxYHLf2ZqrWZLlugRgnTwdlPEZ49etd5o1iELy7sQ4An8qHA//c/b/h3 Ul9oq/oR3yG1OaFEIQR7vxVsqcdTGO6svr/PEP0U4ReA3fyraxxtYAx8p/wU4qmwx3ge AyYiMlVDkWWJ9lqMvaCg3n9YvMNsnriYMM+gyq2xP2i7QZxru8S9k+y0BKiuEcwk0+cA qJST0fEWKH/ZrIFWeOoAehIYJpSAZvBTDB9J8ClJe26b2eoZ43vfMQQfqkxHHyDvJXLt hxRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=//rM/jtPk29ZexVoO3S4krAhI8Q91c//MPYQhR89e/E=; fh=p1Qf4H5TYe6x87oeu/ZwD97uWE3f/aSmdhLxEgeh+tk=; b=hAMssxuCWxkxUIe+QkW2ptSrHXqydIxbP1dL+k3g56opWSAuBpsA+SY4SGj2Cuosvn wqpux9hj2tt7UqZEjGAnu/WF03qdl25i0EawaihR5AbMPUcHeCgbNWfIr+vG75I6qxXM pGJgTPdxPetVJFS1Cvkzh9kGmi0dhRArrCnMd40bk8oBl3YeYCPIX/uTFbdOk9eCwRUl PU/NK91pQSrVxBbGKEfNkZHnvPa3oE+QpwsgjbXctDh2erPbFyyf3Oo3JfJuLLFDPrw8 NFSgWkyQxtJsaKi6mRbj9DpSPxxXsTcOEAH2CsqvxnTiXo/BUGiRxHYOIp8k4YzSZeJq eA9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DDxAjeN0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id l2-20020a056a00140200b0068a65b26fc6si426415pfu.43.2023.11.22.14.18.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 14:18:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DDxAjeN0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A75BE825A6C0; Wed, 22 Nov 2023 14:18:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344685AbjKVWSb (ORCPT + 99 others); Wed, 22 Nov 2023 17:18:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344661AbjKVWS0 (ORCPT ); Wed, 22 Nov 2023 17:18:26 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D83F0D42 for ; Wed, 22 Nov 2023 14:18:22 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AC02C433CC; Wed, 22 Nov 2023 22:18:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700691502; bh=naPsrd6dgZmrcqFRnBTJLF85zK+mznbfmwCxwvHg1bc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DDxAjeN0PF56HLuHq+owxFyRf1SXkUc0Z3SIxrGBECInqJ9bI5WTebiKUjB+kdXgc 4GAAJFWkwGKOeLi4wqgSc5qKmWrSDg2dC/VcMaTpnvQB/ctWee/LrWjppfZMvUUEZT +Xt4fRitwdPMjB5F1t2+G/fVNeDMtj/EVVXtakgp2AUggs4s5bljxWU2MTDNSB4ElI e5d9Yb4xkQhock5YbwJnwZ+TbIKMpPf7s/cT+0vH51VrCbGGPqjMw2BFSh1//YguKf ZXpMGYJ71+KG4ilzh78AGFUUbGJIONjGDFGHncsmOLm0RinIWC8kHlcjJce+uJ0aNU YM+gqd4jArNIg== From: deller@kernel.org To: linux-kernel@vger.kernel.org, Masahiro Yamada , Arnd Bergmann , linux-modules@vger.kernel.org, linux-arch@vger.kernel.org, Luis Chamberlain Subject: [PATCH 2/4] modules: Ensure 64-bit alignment on __ksymtab_* sections Date: Wed, 22 Nov 2023 23:18:12 +0100 Message-ID: <20231122221814.139916-3-deller@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231122221814.139916-1-deller@kernel.org> References: <20231122221814.139916-1-deller@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 14:18:38 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783304313326062221 X-GMAIL-MSGID: 1783304313326062221 From: Helge Deller On 64-bit architectures without CONFIG_HAVE_ARCH_PREL32_RELOCATIONS (e.g. ppc64, ppc64le, parisc, s390x,...) the __KSYM_REF() macro stores 64-bit pointers into the __ksymtab* sections. Make sure that those sections will be correctly aligned at module link time, otherwise unaligned memory accesses may happen at runtime. The __kcrctab* sections store 32-bit entities, so use ALIGN(4) for those. Signed-off-by: Helge Deller Cc: # v6.0+ Signed-off-by: Luis Chamberlain --- scripts/module.lds.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/module.lds.S b/scripts/module.lds.S index bf5bcf2836d8..b00415a9ff27 100644 --- a/scripts/module.lds.S +++ b/scripts/module.lds.S @@ -15,10 +15,10 @@ SECTIONS { *(.discard.*) } - __ksymtab 0 : { *(SORT(___ksymtab+*)) } - __ksymtab_gpl 0 : { *(SORT(___ksymtab_gpl+*)) } - __kcrctab 0 : { *(SORT(___kcrctab+*)) } - __kcrctab_gpl 0 : { *(SORT(___kcrctab_gpl+*)) } + __ksymtab 0 : ALIGN(8) { *(SORT(___ksymtab+*)) } + __ksymtab_gpl 0 : ALIGN(8) { *(SORT(___ksymtab_gpl+*)) } + __kcrctab 0 : ALIGN(4) { *(SORT(___kcrctab+*)) } + __kcrctab_gpl 0 : ALIGN(4) { *(SORT(___kcrctab_gpl+*)) } .ctors 0 : ALIGN(8) { *(SORT(.ctors.*)) *(.ctors) } .init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) } From patchwork Wed Nov 22 22:18:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 168583 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:6f03:b0:164:83eb:24d7 with SMTP id r3csp1537283rwn; Wed, 22 Nov 2023 14:19:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHA10e5rNFN1DZeLgKUuVjbVVOz2kviKKUcH7eIdxsMciHQaUzd3NojBGfMJpG/2cMY2Opb X-Received: by 2002:a05:6808:1141:b0:3ae:1351:d0f with SMTP id u1-20020a056808114100b003ae13510d0fmr5205193oiu.22.1700691542180; Wed, 22 Nov 2023 14:19:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700691542; cv=none; d=google.com; s=arc-20160816; b=BR0Jd1k7mKpbURmX3vfjqatq5kO9EnP5kIMLMQnq2SS3CT0Ztbx01AeaRNH/M40tVV rZwhnX9jFE7dxReZNP/NljUap0sr9ea01FePbkmLOo+pgvW0oA4NuDTeGHo8415707ck 597cybhd8TIa0MpZHbyCAFG64CUCDziGsEupVR7JpidMjAt5RyTszSMeVl+ZecoANBym 2WMcWqGPvIqB0OfR0uNJ69BnyaLk85wTDFuzBtMoefZA5VrELiAQyJ0UJhQmbAlqafq/ VVyBdxRNALQ/5zDhWX84OoF6pMPdQUSG2K2iAsYHq2tGkJoR6NTQgQ/TyW3UhVtVYP4M i9FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=P0Az5Jp7l7jQRvdJqQLa77xwQnuLvLdqqZ5nKDT3r9s=; fh=p1Qf4H5TYe6x87oeu/ZwD97uWE3f/aSmdhLxEgeh+tk=; b=PIM1hDDi/AqGLJa6Ik1PWl92TGtDmRQfKi9AdghxKJIvI7/jzs53ZnGND/l0d4c4+9 LZYfKbIl6zhA1IG3S4HCTuYrRYHQliGeOrsRO73JaMGroinxHo4D/R5k71SNU0HgOy+O Zln+VXh/T1DfdA5TqkDNRteAYgXOo4lL73t4ab/OU7M21fHkv+aBFlhANBtlXU0GLvZd Yt7kTdacS68fLqprsG3Ob+zaJcBpkZIc/lNg+MTY5uD2+0PqjZOwYoE5YcIPYrRsprpE YgLHSW4fw/ORXiOOx0FZdZS3sROVOSwRXj0XQQE+IM47zEhrkvE67IiH3PB03f6ngCsu QZAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=d4Yov3+O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id j14-20020a634a4e000000b005bd5a50b559si8463pgl.715.2023.11.22.14.18.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 14:19:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=d4Yov3+O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id BD6FF82691A1; Wed, 22 Nov 2023 14:18:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344700AbjKVWSh (ORCPT + 99 others); Wed, 22 Nov 2023 17:18:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344652AbjKVWS2 (ORCPT ); Wed, 22 Nov 2023 17:18:28 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2D401BD for ; Wed, 22 Nov 2023 14:18:24 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04A14C433C8; Wed, 22 Nov 2023 22:18:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700691504; bh=OEYsi17tOKR7Yn0RX96OmFEl8yOfWLgmEUuZLjzMjVw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=d4Yov3+O5pJZYtO+vAquTnBX0iikeSqBxlGU2Gli2xi78IA03yNmk9fyQbbo1bUKy USXCZ0TgaqwsYqNgrN9RxOE/iLncTbx6jFokMFv7xi/puqkUnVBny2fLDJBlzBjEgd VNMknv62dWvQ4bduSYJIvxhYEqiyoAS68ikNdyJpKg5B1sqD0cEJntPOZX6eTEuKXm H4LAl9o7KqFrHVXUFXpSkYn/yymkDBfZhVFzA4Aj9+5xP4PT/dZK6VG4Q6yJvGVmw5 PMhCtOZQzVPwHjoc+itTW0E6Qq+o2h8hFh4Yxo+ORbInR5eRhdlSP8Xw7NPsKYQ9MW im5YtndDD/e3Q== From: deller@kernel.org To: linux-kernel@vger.kernel.org, Masahiro Yamada , Arnd Bergmann , linux-modules@vger.kernel.org, linux-arch@vger.kernel.org, Luis Chamberlain Subject: [PATCH 3/4] vmlinux.lds.h: Fix alignment for __ksymtab*, __kcrctab_* and .pci_fixup sections Date: Wed, 22 Nov 2023 23:18:13 +0100 Message-ID: <20231122221814.139916-4-deller@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231122221814.139916-1-deller@kernel.org> References: <20231122221814.139916-1-deller@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 14:18:45 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783304334553344615 X-GMAIL-MSGID: 1783304334553344615 From: Helge Deller On 64-bit architectures without CONFIG_HAVE_ARCH_PREL32_RELOCATIONS (e.g. ppc64, ppc64le, parisc, s390x,...) the __KSYM_REF() macro stores 64-bit pointers into the __ksymtab* sections. Make sure that the start of those sections is 64-bit aligned in the vmlinux executable, otherwise unaligned memory accesses may happen at runtime. The __kcrctab* sections store 32-bit entities, so make those sections 32-bit aligned. The pci fixup routines want to be 64-bit aligned on 64-bit platforms which don't define CONFIG_HAVE_ARCH_PREL32_RELOCATIONS. An alignment of 8 bytes is sufficient to guarantee aligned accesses at runtime. Signed-off-by: Helge Deller Cc: # v6.0+ --- include/asm-generic/vmlinux.lds.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index bae0fe4d499b..fa4335346e7d 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -467,6 +467,7 @@ } \ \ /* PCI quirks */ \ + . = ALIGN(8); \ .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \ BOUNDED_SECTION_PRE_LABEL(.pci_fixup_early, _pci_fixups_early, __start, __end) \ BOUNDED_SECTION_PRE_LABEL(.pci_fixup_header, _pci_fixups_header, __start, __end) \ @@ -484,6 +485,7 @@ PRINTK_INDEX \ \ /* Kernel symbol table: Normal symbols */ \ + . = ALIGN(8); \ __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ __start___ksymtab = .; \ KEEP(*(SORT(___ksymtab+*))) \ @@ -491,6 +493,7 @@ } \ \ /* Kernel symbol table: GPL-only symbols */ \ + . = ALIGN(8); \ __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \ __start___ksymtab_gpl = .; \ KEEP(*(SORT(___ksymtab_gpl+*))) \ @@ -498,6 +501,7 @@ } \ \ /* Kernel symbol table: Normal symbols */ \ + . = ALIGN(4); \ __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \ __start___kcrctab = .; \ KEEP(*(SORT(___kcrctab+*))) \ @@ -505,6 +509,7 @@ } \ \ /* Kernel symbol table: GPL-only symbols */ \ + . = ALIGN(4); \ __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \ __start___kcrctab_gpl = .; \ KEEP(*(SORT(___kcrctab_gpl+*))) \ From patchwork Wed Nov 22 22:18:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 168584 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:6f03:b0:164:83eb:24d7 with SMTP id r3csp1537284rwn; Wed, 22 Nov 2023 14:19:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IG0ndrssT565riykGCpwFBnuQQMIU2s46zr7vF9O0U2RQaWBFKXCQnSP8QpQgzn+0ZNurca X-Received: by 2002:a05:6a21:1c8d:b0:18a:d55f:6a27 with SMTP id sf13-20020a056a211c8d00b0018ad55f6a27mr3460254pzb.26.1700691542164; Wed, 22 Nov 2023 14:19:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700691542; cv=none; d=google.com; s=arc-20160816; b=Hz84T+EPrJp7Uujc+zZsBjsBroPOMCUmke80f1jCBF3O5+9ILNO16Uz8BeBaBNKhV7 Z/MltjF29YyYEgkDYpHqxENtLvMVN6NFatrdK/2WANsI5QdA0z+1NHOrGbbsLHR6yECu BLStNIuW8k4CgE5eXJDJKNUmaiD50GPRDd8ayoH/q+h03YneIv+gPQxBuokA7j89c16Q CS18mTzNAN9BKQZOvZhSKURGQHzXVuwif/dttkZzY42XW1SpEoGYwVwmn1BIjLWmJDNJ 9YoZPzJ6RhsfIFUG+v4lUYxQczRm0Y3pON9/cZmhmiZZSjv9x3UzgnO9oUwidv2HXw2F Q1Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Wu/GUoL+MRnrnubC/F98+5Yk/scqktKko/FHpbTalF0=; fh=p1Qf4H5TYe6x87oeu/ZwD97uWE3f/aSmdhLxEgeh+tk=; b=euNL1l/54W7A7xP8SrzuvCFHu5X23rZSTJQgcXV+3Y11mdi3zvVdRUU7dPnVgn//ND 0cJJHacl9lEq0aROvIkDg4KXDYk5oDrFWmeW3KDNO8m0juYBwuc5cXL31rRJXw10Jn+G YS8FkNoQzltXOHLwBQNjfHS8n6ogCYENCgZUD7ikgl+2wtmPtY9lfdydCuXgtritZcNj LJawbQCrCqhKHIJgvKp5mzNn1k/8iFysSsr6J0vl8HrHA1/LUB0LF2aPJbj6nLFhT0aT iYCA2nH/b47vs6tCotf70BLPW5+YkSlFzRlcUvKbBO1SJ9eJnnIkfoONSZI9SDieswep uCiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=laW49S+9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id b19-20020a63d313000000b00584ca25959csi5346pgg.540.2023.11.22.14.18.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 14:19:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=laW49S+9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B449582691A5; Wed, 22 Nov 2023 14:18:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344699AbjKVWSk (ORCPT + 99 others); Wed, 22 Nov 2023 17:18:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235269AbjKVWSg (ORCPT ); Wed, 22 Nov 2023 17:18:36 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EC4DD50 for ; Wed, 22 Nov 2023 14:18:27 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02699C433C9; Wed, 22 Nov 2023 22:18:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700691506; bh=z8B55/ejcoe2WW+RVahNts4dxuwsQAuxIT3oPjNu21M=; h=From:To:Subject:Date:In-Reply-To:References:From; b=laW49S+9ECP9y1T3wKde/cIOj+JYD94ZcV2pI72RtAoICnQozqPsFxDWdxqSrefDs ZjJqCBW5+z6y6DzbG/csYQ6qH+PKfJG30uVSgEA5HoqOs885iuMwXWhUKNjPsAwbdw XxvuGpQBeGw7woppvooV/6F5QcCuM+r8430xkQV5fEQ3z29cskCKuvxCiK6dt3ldAO qaVCT/uPkCtPeBI2ntkUjI5j8N8ms+wmJIo8CjN8FD9esa5RfFYHm3KKeJJfq4DzBB ppL8aFHiNtClGNGSAJOItlB/hWNweuQwonVMF7Ot9M2RAfSPlcInsxxZjHopGYk+fw Q2mrXvH3TOBDQ== From: deller@kernel.org To: linux-kernel@vger.kernel.org, Masahiro Yamada , Arnd Bergmann , linux-modules@vger.kernel.org, linux-arch@vger.kernel.org, Luis Chamberlain Subject: [PATCH 4/4] modules: Add missing entry for __ex_table Date: Wed, 22 Nov 2023 23:18:14 +0100 Message-ID: <20231122221814.139916-5-deller@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231122221814.139916-1-deller@kernel.org> References: <20231122221814.139916-1-deller@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 14:18:47 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783304334381473117 X-GMAIL-MSGID: 1783304334381473117 From: Helge Deller The entry for __ex_table was missing, which may make __ex_table become 1- or 2-byte aligned in modules. Add the entry to ensure it gets 32-bit aligned. Signed-off-by: Helge Deller Cc: # v6.0+ --- scripts/module.lds.S | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/module.lds.S b/scripts/module.lds.S index b00415a9ff27..488f61b156b2 100644 --- a/scripts/module.lds.S +++ b/scripts/module.lds.S @@ -26,6 +26,7 @@ SECTIONS { .altinstructions 0 : ALIGN(8) { KEEP(*(.altinstructions)) } __bug_table 0 : ALIGN(8) { KEEP(*(__bug_table)) } __jump_table 0 : ALIGN(8) { KEEP(*(__jump_table)) } + __ex_table 0 : ALIGN(4) { KEEP(*(__ex_table)) } __patchable_function_entries : { *(__patchable_function_entries) }