From patchwork Tue May 8 12:16:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 10386073 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C5BC760236 for ; Tue, 8 May 2018 12:16:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6A8E28D53 for ; Tue, 8 May 2018 12:16:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA6E328D91; Tue, 8 May 2018 12:16:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3701B28D53 for ; Tue, 8 May 2018 12:16:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A9006B0275; Tue, 8 May 2018 08:16:50 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 357C76B0276; Tue, 8 May 2018 08:16:50 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26EA66B0277; Tue, 8 May 2018 08:16:50 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f70.google.com (mail-wm0-f70.google.com [74.125.82.70]) by kanga.kvack.org (Postfix) with ESMTP id BFFFA6B0275 for ; Tue, 8 May 2018 08:16:49 -0400 (EDT) Received: by mail-wm0-f70.google.com with SMTP id f188-v6so4068857wme.2 for ; Tue, 08 May 2018 05:16:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id; bh=Dm5vK2TyQeBKYovPXgvyw+ZGv+lHdZayI75pIoiwkh0=; b=DjfRwRzYr6IESp/X2RaHRRJ6SXIAnEHA4QRXl1R3it3Z7ZgddjD2KE6YtwtGBFX7vK YJbisKI3VuYTGb7c+BnuUIiKMBavZsFRSPV2o7OhPelGsqKBEq4RnqtAhvaZdK3lIjBf 10LFy9Pef2bdw3i1bY22/x1WdU6R9V+NIgTRFqPuzHqBGhgpbZkrj/jPD844flZiL/GR favpnvtDsRZAsxkqWA9hnL8LhdQMXIld4H4cBdKWQRR+JcH/jWttl2lu+wAQXNDefFUw ZYBEWJk8ziAPaMhnnd7BlUJkMK4qGX+ywZl0lF3XSmFFHN1MuloJ3l6KZktru1N3r45E /nOA== X-Gm-Message-State: ALQs6tD/YPyaDMbxg1oQipPG32y4OvHzLvnCyVxU+H23JK215aXtS/v2 36mHTYyJTZU/V4RG/kwv8yaZHSSudjZ/lv8MXuIpRll/uvt+9bIRcZ3y6YzH1EcBb/t+O6Wjakn 5TCb5SlpdRrWeLmgnf/+WCWlElc7ZS8Bqn6jKCz+r6bLqTUEYGDTga3X15GzZ7LrgAB5INCiNJ0 scaNTlqw59rNCldzKsaNJPv/Hl3ztunEKn1WNKk3GwxVLm/wlFKFh46t33TE3FIjcgPNXqTcsAp lmCRe+JiLsHirLYVOVmi7dcchpnQpf4IGNQRYUmbd6/YlM4PRJt5w3eJ2FB8vEv6urBHOE62qaT ArXaGjXe7At07XLx9I2vm0h+P0K7HOBCognQvGoKXTuDVdgV/rsSS/qRIwh0ZCnrW320doVuKUr R X-Received: by 2002:adf:b067:: with SMTP id g36-v6mr32289566wra.128.1525781809333; Tue, 08 May 2018 05:16:49 -0700 (PDT) X-Received: by 2002:adf:b067:: with SMTP id g36-v6mr32289525wra.128.1525781808622; Tue, 08 May 2018 05:16:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525781808; cv=none; d=google.com; s=arc-20160816; b=ZSeCsfWQPWuNEVVZcJFWoekjkuSV4sQAvtYZvspAY7jghwuj+cRAjpcd7AvfxF9/UF u1levVANfwaJxfr7XOfkEcfvWW9ki2w7dvOJNE76oGGGWlngftiiUjUQ/fwDiN/xohYb JFi5zMi6AEA7jgAUHMyy79tV9fGn/7MYBVJ8z1GkY4qZjg1K7TL8oRPZMsV0v82UfoUd +zNfTCqJmXZkJSHYD+wId/O+/zpQV2YrNWtTm1QlRSZhZupTfWpsVaxboruSkdAQ6bTq atDC0tBEnL/p2jPaoV/w+eDFzkSqaDgeqWdCuyP9NC1AGLJ5zImjofRWoSCf9GL4KAST He0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Dm5vK2TyQeBKYovPXgvyw+ZGv+lHdZayI75pIoiwkh0=; b=sQcK9uANYJzji7B12bts6QHVKZccMuc/6fiO0ImsTyd8X52qWwsCrAmpbLu1r2N4D+ LpoDX8bR7XoG/YSV89Y72bYwn71Bhyjb8o/lHZvZ6lw+OTMKdxjORbyB/T5fxrlgRL52 WhjR16YqaKO+zS9Ua+bwcUGT+SGtHBIBIuGE645bPi/1Nbik6jelibM6HFQYtwXBZG4A zBKSvl5cc/NbqkDpdI523qvgLOxU2tKUy3+pJzBK5epPkfVjvp2e84r6bRyMMyZ6VXB3 MXezSkjvh96tarjGuEdE1TZIDpnmyNOBz2VIk/ht7qdpdZQn+bojaHJRpaJiuNUMa5HW XG4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=MvIL6jpk; spf=pass (google.com: domain of glider@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=glider@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id z133sor826376wmc.68.2018.05.08.05.16.48 for (Google Transport Security); Tue, 08 May 2018 05:16:48 -0700 (PDT) Received-SPF: pass (google.com: domain of glider@google.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=MvIL6jpk; spf=pass (google.com: domain of glider@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=glider@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Dm5vK2TyQeBKYovPXgvyw+ZGv+lHdZayI75pIoiwkh0=; b=MvIL6jpkjidVliyvUSm3hkskstvUlh4lJvSqNaGa1A5BjXpv8Rr1Xly7xqd8sxJnVM RU3mrS4ZeONR/FS8CyqQJU6fxy+GnYjygo2g87SgYQJEKHvVkGZEhfeOXWNDwy8+kxrG 5fzJ0plUTwQ0b1iSK4X7zPD/lnPflGo02duNRJX9gtIXj/+GVX2MTxL7trX+Uf903p/l wSsr290QjX7x9Kcgx0nI2DB1Z108lrV/3qauP06enG+2FGCU+5NS+u6ugBcHB3WDDm5p LXqu+UnsVt1ZvTVV3Y8gEDwPNC6CFlz0S1xCgmtaTh/k+GFLOJEuFkAH1JqO4/QT2b1z 1zUQ== X-Google-Smtp-Source: AB8JxZqwNfFLaZygmI1QivyUJbbWQnDYASG2afF4n/Y6TS35LQn9mNKyW8UhTx8iXiumSw+k2rZmog== X-Received: by 2002:a1c:eb0e:: with SMTP id j14-v6mr2986495wmh.87.1525781807919; Tue, 08 May 2018 05:16:47 -0700 (PDT) Received: from glider0.muc.corp.google.com ([2a00:79e0:15:10:e0c7:92b9:c022:f69b]) by smtp.gmail.com with ESMTPSA id k28-v6sm37350084wrk.46.2018.05.08.05.16.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 05:16:47 -0700 (PDT) From: Alexander Potapenko To: dave.hansen@linux.intel.com, mingo@kernel.org, kirill.shutemov@linux.intel.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, mka@chromium.org, dvyukov@google.com, md@google.com Subject: [PATCH] x86/boot/64/clang: Use fixup_pointer() to access '__supported_pte_mask' Date: Tue, 8 May 2018 14:16:38 +0200 Message-Id: <20180508121638.174022-1-glider@google.com> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Similarly to commit 187e91fe5e91 ("x86/boot/64/clang: Use fixup_pointer() to access 'next_early_pgt'"), '__supported_pte_mask' must be also accessed using fixup_pointer() to avoid position-dependent relocations. Signed-off-by: Alexander Potapenko Fixes: fb43d6cb91ef ("x86/mm: Do not auto-massage page protections") --- arch/x86/kernel/head64.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index 0c408f8c4ed4..1b36ae4d0035 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -113,6 +113,7 @@ unsigned long __head __startup_64(unsigned long physaddr, p4dval_t *p4d; pudval_t *pud; pmdval_t *pmd, pmd_entry; + pteval_t *mask_ptr; bool la57; int i; unsigned int *next_pgt_ptr; @@ -196,7 +197,8 @@ unsigned long __head __startup_64(unsigned long physaddr, pmd_entry = __PAGE_KERNEL_LARGE_EXEC & ~_PAGE_GLOBAL; /* Filter out unsupported __PAGE_KERNEL_* bits: */ - pmd_entry &= __supported_pte_mask; + mask_ptr = (pteval_t *)fixup_pointer(&__supported_pte_mask, physaddr); + pmd_entry &= *mask_ptr; pmd_entry += sme_get_me_mask(); pmd_entry += physaddr;