Received: by 10.192.165.148 with SMTP id m20csp4397234imm; Tue, 8 May 2018 07:52:16 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoMidcQJb07hkSReERaq7rxRgZgnYg81GMJKrZWDOH/vF+C+HfwGVrkdx7oFXhhvvDELyQa X-Received: by 2002:a17:902:700a:: with SMTP id y10-v6mr42215388plk.265.1525791136791; Tue, 08 May 2018 07:52:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525791136; cv=none; d=google.com; s=arc-20160816; b=yC2wqpJoT5mul2npl+8yKUgOMs/1HnABKpM0i+gvMogDa5sYfkw1fKpv9GGzZKbqeU 9sah6QhAr4wU+PZHv5nAt5QEe3DjhK9leAc9kIPzPV7NU5+I2T5P8+LIgWVPj4qeio5B qpMlR5kGfCyrBHVxO53zYkD7nRhnotFJW037/Ck4qSV5xBQpA1FgfByJpN7HJfatV2PF 7apKDHRG2nt6WE0JPubv0FIxBzNwQgVRuYpclHXic5iGJtCMPpwW3PrsEty4kgzedwQe uPi6AxW0FARi2ZoBj4iy6cBg1V7q+06Y9RHVfd3CW8WWQ6vMGC2qt+zYoR6kcJpVjd4L 3myw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature:arc-authentication-results; bh=UuBBlxj09TgnbBTPuJzpmcCb8Bv79S0IRMuAxkYj9us=; b=b0+wKvWK2kujY+8y5tSFEdC4XLzc6zKHbWFqtwBFjQn0hYaZZWWpLfU5q72er3gsZT FFpgIAy3ErQcFFGV1yspRn07pgvpc9f1evKbohBVp2LCcTm0+eiaGSZGygNq2BtSVwCG 52RTJmXEcI4bKK21/kAcuI6UUWoe2Z8K2Rj6xiuZyArIE33IqpApdhce+5gbaaCAhM15 46hA/OCbG809r8Sq+CjIfXNcflVufx9vO4ZRMnXw9M6xGOXyps96EmP31G23Do0x5iYZ N49Ev40VbIVKc42TWjA7HBQQbnNXqKi5T97dhNFL/5Y74t19RN8lNxcTrh+nu9fzave9 tikg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hd3WY2fg; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g6-v6si20137823pgr.72.2018.05.08.07.52.02; Tue, 08 May 2018 07:52:16 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=hd3WY2fg; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932759AbeEHOuQ (ORCPT + 99 others); Tue, 8 May 2018 10:50:16 -0400 Received: from mail-vk0-f65.google.com ([209.85.213.65]:45518 "EHLO mail-vk0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932452AbeEHOuO (ORCPT ); Tue, 8 May 2018 10:50:14 -0400 Received: by mail-vk0-f65.google.com with SMTP id 203-v6so19802890vka.12 for ; Tue, 08 May 2018 07:50:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=UuBBlxj09TgnbBTPuJzpmcCb8Bv79S0IRMuAxkYj9us=; b=hd3WY2fggUyNSjI4CxDs1Gqpdpe++vEQL4D+YAGXDUl4j+ozknACiDevSFrnwX6sec Hpqe+vEqSoMmyHxfl0FywwSuB3UaYx8Zj8ERpl+3SC6iTxY5smgnRp4BOXrDbBGQg0tg uRQE/qx/7KdLF8pe5K0IUoUvZ2LTcBploPVmkgYOHVNw5K1MxVuo3/gS33Ltj688OV7I tDpEz738uZ/nt/ptIN++hCS+GJ6HybZUDx/plxEplDFKUxI54dZZbBmGB72pJol63dr1 9WhIMqgVFGQFN2vr9HErHdKIXTGA4E00r2DeWOfgD4Wj+g1XfVVaTXnpt5K5QlGBrFr0 MXNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=UuBBlxj09TgnbBTPuJzpmcCb8Bv79S0IRMuAxkYj9us=; b=lFQU6T/lxm3vI4QWg0rRJDBgajpxu1DsNvkxQvHIf3s8pSNf+x5/MF+eoUiDwkXYBl NtJjv6MqbqXFvekvEJtBwU4LpfdFp7XwxBLunZU2UOjsCMjpPE2rDBahj1jOsZFn8dNE i85tmeA6l0X39bjzpYin7FlvbHcF41ReIkwqDEo2hgV6+ZYWshVCa7mRf8/0yocjyiCY mra6haYpHpOfp8cOr8YPjFkdGipa+Jnu0sGA+ooi295E7bKAvZ0lhQ033vY5siyS/gFt hyWk3Qnx1Ktc7GvXhnXlxS0nED6C+Vsu4zKID+/48x3Dyp8lm7aJ1kELDJQ2SyoYWU4Y cNjw== X-Gm-Message-State: ALQs6tBx4bs3Tm6cgv35R4jrQn4yGDFjJNRCpXlph2JXH0CzykYNp4iU IN/ohtOMr4ypx1zrIP4frrMM5yHtS+HnJeWiys9fzb8Y X-Received: by 2002:a1f:2ad8:: with SMTP id q207-v6mr34625917vkq.72.1525791013775; Tue, 08 May 2018 07:50:13 -0700 (PDT) MIME-Version: 1.0 References: <20180508121638.174022-1-glider@google.com> <1f69bdb6-df5e-d709-064a-4f6fdd6e11a7@linux.intel.com> In-Reply-To: <1f69bdb6-df5e-d709-064a-4f6fdd6e11a7@linux.intel.com> From: Alexander Potapenko Date: Tue, 08 May 2018 14:50:02 +0000 Message-ID: Subject: Re: [PATCH] x86/boot/64/clang: Use fixup_pointer() to access '__supported_pte_mask' To: dave.hansen@linux.intel.com Cc: Ingo Molnar , "Kirill A. Shutemov" , Linux Memory Management List , LKML , Matthias Kaehlcke , Dmitriy Vyukov , Michael Davidson Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 8, 2018 at 4:30 PM Dave Hansen wrote: > On 05/08/2018 05:16 AM, Alexander Potapenko wrote: > > 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") > In the interests of standalone changelogs, I'd really appreciate an > actual explanation of what's going on here. Your patch makes the code > uglier and doesn't fix anything functional from what I can see. You're right, sure. I'll send a patch with an updated description. > The other commit has some explanation, so it seems like the rules for > accessing globals in head64.c are different than other files because... > something. The problem as far as I understand it is that the code in __startup_64() can be relocated during execution, but the compiler doesn't have to generate PC-relative relocations when accessing globals from that function. > The functional problem here is that it causes insta-reboots? True. > Do we have anything we can do to keep us from recreating these kinds of > regressions all the time? I'm not really aware of the possible options in the kernel land. Looks like a task for some objtool-like utility? As long as these regressions are caught with Clang, setting up a 0day Clang builder might help. At least I should've added a comment regarding this to __startup_64() last time. --=20 Alexander Potapenko Software Engineer Google Germany GmbH Erika-Mann-Stra=C3=9Fe, 33 80636 M=C3=BCnchen Gesch=C3=A4ftsf=C3=BChrer: Paul Manicle, Halimah DeLaine Prado Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg