From patchwork Wed Oct 10 14:32:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 148556 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp937082lji; Wed, 10 Oct 2018 07:33:19 -0700 (PDT) X-Google-Smtp-Source: ACcGV63RZsB1YTlBcKZepFDT4ecyduy2V0ZYLsGteoO9eAKoYxvr/q3bGHqk1WjiOg6mWa5Oewpg X-Received: by 2002:a17:902:9047:: with SMTP id w7-v6mr4098268plz.4.1539181999761; Wed, 10 Oct 2018 07:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539181999; cv=none; d=google.com; s=arc-20160816; b=jeGJo7qwdWYvpQxIju5YbGCQQ+yUcVOgqdyyvjTm1Z3XqRIQvsMlQvseMwINOuGkbG LtPOwu+C4Xjs4CoanUgjTFIF5SNM6WH7iXnp53xpZ59j9jH9pSi3XoKAky4Z8Ch4dHaU Rk2/js9eX5BaaiLywXczjXOkk+Z30PAveoKp5vSwsK/EXx/bYUCqohl9Mcay0LoBuQc7 ufrYH/RB/EonDPyVY308YGn9b4ABkgSN6PbiHDfD0GzKw6mZPVzemqnsyFWUwya0c1vG YAjGwdq1rWnwDrL3C27v2i22KosFuaQHJ1rj2iFjCVxP0X83WbcmBb400bHRo10sM8+N fY+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=Swerc5xwmcecqFRz9q5NKHDx1bcesgwiIeEUp0Hm3GM=; b=DAQk9STMUxoVo89QJYDr2b6S+pW/ghdHdN7kZ/FvI1VJY+wvAnI0p2J7kzgPbCLDFN NlYA1q6Ef9C5zW/YW/FZa5tegfm6X5/LzSR4DYCdA1YQtjeo+XnaZZV4kqEFyrapUc6c WFhTa5nI37NMnfTTHJxcprGo6FtjdZc4IKDX6aNbtIe2oAgzy3pGdyQ7bvcQk0cRs+MX TUxOOsn9TiqNTE9x/lh31k5h/RaqVdpSzLN2TawI2DRVoh4z9frO7CZ2tOynpVYMAvAQ nqULZCEPzcJvjWPE+Nrxn7al43xhTsLZ1sO/bwaXKrrFPafEoXQ60aAZtwh98KzpAtaL 3o6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d13-v6si25626149pfo.108.2018.10.10.07.33.19; Wed, 10 Oct 2018 07:33:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726810AbeJJVzo (ORCPT + 32 others); Wed, 10 Oct 2018 17:55:44 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:34665 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726636AbeJJVzn (ORCPT ); Wed, 10 Oct 2018 17:55:43 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1M8Qme-1g5rpl2mp6-004QN4; Wed, 10 Oct 2018 16:33:09 +0200 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1M8Qme-1g5rpl2mp6-004QN4; Wed, 10 Oct 2018 16:33:09 +0200 From: Arnd Bergmann To: Lianbo Jiang , Borislav Petkov Cc: Arnd Bergmann , Alexey Dobriyan , Andrew Morton , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH] kdump, proc/vmcore: fix building without CONFIG_ARCH_HAS_MEM_ENCRYPT Date: Wed, 10 Oct 2018 16:32:45 +0200 Message-Id: <20181010143306.2051406-1-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 X-Provags-ID: V03:K1:sIUV+97GrudqYGbBnJuyCQ9m6bGa09gdyaFHCyeBSnNLf0H4KnG dOXBTJ377FgjGApQGHr3zkTNErPFgPJU4HKHz+Hf7K93LnUcQgToplKo0W6GHScsOGXS3ya kQv9mGg4EGIzaQI6qW3A8csyuhSGK5dm1gzmVMUDW+7FcP2SCIe0Z+pJMs3jpPobsRWUlTp 6C2xg+T+PzNJVtS9thqKA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V01:K0:9T8bIs8l1Jk=:fMxJ3iEpO8t0+DQk9bh0F0 PWK8PTkEKUQtkiHnMB6gCLAoxkz2qxNCB7DdmVmi5xdh9DjYLwOMtw2UUgMBsBz/+dFOz+3cg MVufjxTqA/kF9l1fAwKQn3hr/PJ0o+3XQC0xBYwNZ9UZOkVZ7M5FPjrl2T6SLHII51K+ltoHp iFNCYshyd7PkjWfzx8bAjFwaOLMPF5zBG9VFVS4wQVEp27we4Z2O5aL3h+2/7wQJef6eHLisZ 2L0S101W7ALqajL93AVtxW5UZcXOy9r66Tk21Uv6Dygg7fuCY1vpMjYlUvO/tQJejumjdQyM+ DeBxTnajdvoZpUolEUZwOTHI93m+QFdk9xoxVgnJpCTe3NtYmDWqekd85RfXKpf0rMxPFbRsc a0l7gqCye5WRybK8+mpbV9F0aaAFTIloxjbmqMUfU5NIiva0jnsvRimN09oc4fV+T4V/oXBPm YHXSWKLfAdrpp9uokXO1buSvk9K6KunmlLxZJnzUPXP4lK19nlrbtOqahTq/rnL5VFM6026ZV wFkh2IR8XKaQHv6xBTyyxrWgy3r759gAur0tLRrb360E2WqF9bm5RoZFewH8wEuq3j4PZRtjl 71coBAc5vxUyrqrsAivnVSJ5ZDwRQznlZC+qfbluZFZXMUKMcoduwpRkCC1y9kLiaA2j91qCz FMF01gJXk20+O1BXZMW6TqsTEps5HL4qcffyjtsNpM35/aDPwH0tr4AOon4jVSNGenoM= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We get a link failure when calling copy_oldmem_page_encrypted() when the compiler fails to do constant-propagation of the sme_active() result into read_from_oldmem: fs/proc/vmcore.o: In function `read_from_oldmem.part.0': vmcore.c:(.text+0xb7): undefined reference to `copy_oldmem_page_encrypted' Adding an IS_ENABLED() check means the compiler will always know when it cannot be enabled. Fixes: 992b649a3f01 ("kdump, proc/vmcore: Enable kdumping encrypted memory with SME enabled") Signed-off-by: Arnd Bergmann --- There may be a better way of doing this, not sure what kinds of assumptions we want to make here. --- fs/proc/vmcore.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.18.0 diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index d469ce9d8c0c..92e1e520a52d 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c @@ -123,7 +123,9 @@ static ssize_t read_from_oldmem(char *buf, size_t count, if (pfn_is_ram(pfn) == 0) memset(buf, 0, nr_bytes); else { - if (encrypted) + if (IS_ENABLED(CONFIG_X86_64) && + IS_ENABLED(CONFIG_ARCH_HAS_MEM_ENCRYPT) && + encrypted) tmp = copy_oldmem_page_encrypted(pfn, buf, nr_bytes, offset,