Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3957556rwb; Tue, 8 Nov 2022 10:13:35 -0800 (PST) X-Google-Smtp-Source: AMsMyM4XdX6uMHQDDeFexInGOGy44qqCfl64nxtawOVrfmTXm1FlxGWHrDtKVpEB0j/1TiRQJB9V X-Received: by 2002:a17:902:ea09:b0:187:3274:2460 with SMTP id s9-20020a170902ea0900b0018732742460mr42986807plg.153.1667931215605; Tue, 08 Nov 2022 10:13:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667931215; cv=none; d=google.com; s=arc-20160816; b=Tugnw3+RPauQaeScQ19lh86wU3KgH/kCuV+w+RQn/8WYnjW2AmdO/BxZ8U/hgw4LjE fr7q3Nfwz1n22hdj1vNCoa6pL9Cqr5oVV76bLk8Q7SvYo95vh6qZefL5jFK0aVrLNQXK Gs9ds6t87dgFv43LEZHjS6z42sFpjBWOUkiw0o9KW2QBfs7cMCgSYn01+rp9j/PMY8Pc MBvAl6uojrO5VwvPWTjkzkreqHXFNV51WbQz6IOz3Hap/iPW3/9KcA5pb5XJkLxTGVId 4QpJcgbYeTLiMRirnfeJs2beMBnCe18hdTuxAVhlLoyf/ndge+SOps4BteFkSlOBuk9J Sujg== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z21-20020a630a55000000b0046ef5b35735si13820853pgk.654.2022.11.08.10.13.23; Tue, 08 Nov 2022 10:13:35 -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 + 92 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 ); 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 To: Arnd Bergmann , Kees Cook Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Nathan Chancellor , stable@vger.kernel.org, Ard Biesheuvel , Zhao Wenhui , xiafukun 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reported-by: Zhao Wenhui Tested-by: xiafukun Signed-off-by: Nathan Chancellor --- include/asm-generic/vmlinux.lds.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 base-commit: f0c4d9fc9cc9462659728d168387191387e903cc -- 2.38.1