Message ID | 20221108174934.3384275-1-nathan@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2856460wru; Tue, 8 Nov 2022 09:51:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf7EY0bpRh49xnDwnlegm5pxXRZ2f2XZe9Ra7LyisyKZFoqoMmnf99Ll15eldCY6uupBrPbh X-Received: by 2002:a17:906:d89:b0:7ae:6ba5:f324 with SMTP id m9-20020a1709060d8900b007ae6ba5f324mr10087025eji.299.1667929875502; Tue, 08 Nov 2022 09:51:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667929875; cv=none; d=google.com; s=arc-20160816; b=bz1Zl9zQ3ighG+vJv0AIMhnLu0imzt2Hbg6m0KWUSuP6mkV9BIId4lGfhu944U0T1b EXFPKMlnL0tU32zozw6yTwRktSENgcYDf9MnHqQjrlN8bnv7IQ05ivz/hvzIYpmD6HUp FCcI4o5SubED+W0Sm1ifrjOOWtk6AUO5o85BkRbtJgEAIEIPC9Gr/X7Mcz/yodJ30lfd L7c5djwEZ14e+F+qJn8g3HOSNwT73wtxQ0hFBwFAUTo9HAnSCzZYiNrB3i8ax60RZsGZ 5NRkSRJ0qgpSxo5prK5RZgtov/yLAurt5cOBHT4fsBxha+4PjDnXHsYgLThLTsphN217 2wWg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=kLkB994OsC2+35KKaFGH5GI/b9wD1ZQaJN3ks33zRHM=; b=Zd2Q9xKplCWDv7sl9z/0nZQc79pr6Zf9CtWIba+QFM+Vg9ZMyWwje1QichKTWvF6EI S6cS8AFXrTekmQGCeRljfIXk7Im3IquMRvylIoM5zgbtakLuVULaJDKGvk3CHWqNYji3 vkGRCyfSARrc0jg/oZXA4M2PFGuS2k1s8rytp9SMvQerZ0lIoK2qibyxruAq5xmE8g9v LO0tUs5Z6gGHd2mbwpQij06wKlhCZ/MSV13uebCXkq8QrKkuQ33simn1E2bFSvMejW/l nVLqTKxcDB1tmCChfk2orrkLS92FVSldhDAAzZdrOEeHJqiCOFqGrFqyf/dkW8P0Iihx m6iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="kohT8c/A"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n15-20020aa7db4f000000b0046159da6233si11042741edt.145.2022.11.08.09.50.51; Tue, 08 Nov 2022 09:51:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="kohT8c/A"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234660AbiKHRty (ORCPT <rfc822;tony84727@gmail.com> + 99 others); Tue, 8 Nov 2022 12:49:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234686AbiKHRtm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 8 Nov 2022 12:49:42 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C18F212ABE; Tue, 8 Nov 2022 09:49:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7AD55B81BE1; Tue, 8 Nov 2022 17:49:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AF38C433D7; Tue, 8 Nov 2022 17:49:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667929778; bh=LMhru1+YgBAfi13lBX6Nu1827mByiikg16DD/vba9ec=; h=From:To:Cc:Subject:Date:From; b=kohT8c/A1pFM9cKfrnQiKB/0EL7Yd81dJj1XkPIDip0mbUj/1VHCst+eGjYmjl6/f MScOjDjtsMDMMQrNqzzefQiqSHHxnq4X+q0e1o7I588SbzLVUjLQrS07gufK0i71tL 6HyxWnImwR8m4ejUyyO7D60iwdSZ5V/jHCCVquOYyy+LvqGk6nUY43GsVIC/StXJg+ REW9Dlyhe1QSmlFjq3/zFupSN14aqHZ42bZupr2k4jYoxnSu/5ingp8akG+o/uqGc2 GvAdzuy/TY0ng+3WEVwzUf2frjNpuPHQO8e/zPoBbqV3xNpeBPE/JbHInqSo/rEQGP ohwTxi1rSyzag== From: Nathan Chancellor <nathan@kernel.org> To: Arnd Bergmann <arnd@arndb.de>, Kees Cook <keescook@chromium.org> Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Nathan Chancellor <nathan@kernel.org>, stable@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>, Zhao Wenhui <zhaowenhui8@huawei.com>, xiafukun <xiafukun@huawei.com> Subject: [PATCH] vmlinux.lds.h: Fix placement of '.data..decrypted' section Date: Tue, 8 Nov 2022 10:49:34 -0700 Message-Id: <20221108174934.3384275-1-nathan@kernel.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748951237104688660?= X-GMAIL-MSGID: =?utf-8?q?1748951237104688660?= |
Series |
vmlinux.lds.h: Fix placement of '.data..decrypted' section
|
|
Commit Message
Nathan Chancellor
Nov. 8, 2022, 5:49 p.m. UTC
Commit d4c639990036 ("vmlinux.lds.h: Avoid orphan section with !SMP") fixed an orphan section warning by adding the '.data..decrypted' section to the linker script under the PERCPU_DECRYPTED_SECTION define but that placement introduced a panic with !SMP, as the percpu sections are not instantiated with that configuration so attempting to access variables defined with DEFINE_PER_CPU_DECRYPTED() will result in a page fault. Move the '.data..decrypted' section to the DATA_MAIN define so that the variables in it are properly instantiated at boot time with CONFIG_SMP=n. Cc: stable@vger.kernel.org Fixes: d4c639990036 ("vmlinux.lds.h: Avoid orphan section with !SMP") Link: https://lore.kernel.org/cbbd3548-880c-d2ca-1b67-5bb93b291d5f@huawei.com/ Debugged-by: Ard Biesheuvel <ardb@kernel.org> Reported-by: Zhao Wenhui <zhaowenhui8@huawei.com> Tested-by: xiafukun <xiafukun@huawei.com> Signed-off-by: Nathan Chancellor <nathan@kernel.org> --- include/asm-generic/vmlinux.lds.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: f0c4d9fc9cc9462659728d168387191387e903cc
Comments
On Tue, 8 Nov 2022 10:49:34 -0700, Nathan Chancellor wrote: > Commit d4c639990036 ("vmlinux.lds.h: Avoid orphan section with !SMP") > fixed an orphan section warning by adding the '.data..decrypted' section > to the linker script under the PERCPU_DECRYPTED_SECTION define but that > placement introduced a panic with !SMP, as the percpu sections are not > instantiated with that configuration so attempting to access variables > defined with DEFINE_PER_CPU_DECRYPTED() will result in a page fault. > > [...] Applied to for-linus/hardening, thanks! [1/1] vmlinux.lds.h: Fix placement of '.data..decrypted' section https://git.kernel.org/kees/c/000f8870a47b
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index d06ada2341cb..3dc5824141cd 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -347,6 +347,7 @@ #define DATA_DATA \ *(.xiptext) \ *(DATA_MAIN) \ + *(.data..decrypted) \ *(.ref.data) \ *(.data..shared_aligned) /* percpu related */ \ MEM_KEEP(init.data*) \ @@ -995,7 +996,6 @@ #ifdef CONFIG_AMD_MEM_ENCRYPT #define PERCPU_DECRYPTED_SECTION \ . = ALIGN(PAGE_SIZE); \ - *(.data..decrypted) \ *(.data..percpu..decrypted) \ . = ALIGN(PAGE_SIZE); #else