Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4052570pxb; Mon, 8 Feb 2021 06:53:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJynnDrmTariaysltXwFhrvAlqaCzz61sEcft9obqFaJXZxuhOMVa13/dh1zAnLzdw4IYrkX X-Received: by 2002:a05:6402:1589:: with SMTP id c9mr17970003edv.282.1612796015566; Mon, 08 Feb 2021 06:53:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612796015; cv=none; d=google.com; s=arc-20160816; b=S6scO3lM3QX03Yh/QDSKt1tuBy+P6gqoiLxWPVT3pRUXzkzBW9q39pxOAbu9L6Zgww yfJg9hdj19lr64z6A0P/Aqd6zkH4D6oa+EOwl5QcOh8U37B7u30b3OOKjecQlSRzXuCU O0BuK/G0irLDQDBxuCwXrNdYcYS4xKWWI1vJDAFq7xYtfenZ17oPgx6Tg2JMHhmKQs6x bId4Ha34jHx03hpFo8tceO5GRBNcrq1xTpI68KXVX0JVeuNhLKsHMH1aPszdcVKZXBmO t2FZGLoQ9A74sQus0XQQVDIupLUMxG6ZgAvRRA0ePjWuSo8IAW8KgJVRf+h+koOdet2M 2PGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=YlcUV5VKMaqTlunHEZkRi8ARj8gp9fyCSEXGPHqErzQ=; b=bwPlMS7YiHX+Q5ljoJoEqKb+1C9HkN9nWLDHC11kN3AlaJIes0AF1YDHcJvvPVQxkz lx/jP2Fr9BcD94sK0I2IhUtq2mcdfuvtSlw2M/XWyHtgtSO/ixklP/JBgpRqE+Fz7KBi uI9nyXtlysHzWby98P9i0w3wyWf+pETlf2h3hWaOhLTbL4SqAHjPikmXJS7NMUoWK6d/ I+C1XPouVF5x2Xmh4HUK0BwGqQ7C/ekoLB4nsBdSryjKhQXagh0jD9e/OLbOCCyS4KJ7 b/f61CtpF+un7MW9tAP4A3gFdP8V2L18LWbBw/SFKvx/READwwMUggSNnUNMnwm/xxM4 cjzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qcMSda+h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v14si12284351edc.56.2021.02.08.06.53.11; Mon, 08 Feb 2021 06:53:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qcMSda+h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232072AbhBHOuQ (ORCPT + 99 others); Mon, 8 Feb 2021 09:50:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:47426 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231742AbhBHOl0 (ORCPT ); Mon, 8 Feb 2021 09:41:26 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0B1A764E87 for ; Mon, 8 Feb 2021 14:40:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612795246; bh=uzVP/yUTZ26j2flqJpYpKjVHor/lpsoGXsqXFjLI8Ac=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=qcMSda+hMlq6oiVFD7V7aK7jrnYayHkeWCwg6mSQSQC4KSe68pSYAhQ9MLQxRHhSp 7cnuxD90DJ6ukwjMLeq16FJJ9bqf4suMkJipKYJo71DMqcRK1fX6o8PpiDIkgR4w8v hiZ68kFrY6oAMB/WH3Dk/mEfC4lsSrq5WjSZdmT6MKhhLzej/oHkShYc0zNah/IBmZ DtrS+HRpa2aPFbvOUepqfj/xU09Xz1zaO/u0jRTx99Swb5v87m8k3s2Pdlodof9dkV FWwwsyOr+bW0uxzNpongew++F50MbGErul6TGcEWMv3VRT/st9ZTAwG9GtnXD0WFin o6P/x1TELi3Wg== Received: by mail-ot1-f45.google.com with SMTP id 63so14393516oty.0 for ; Mon, 08 Feb 2021 06:40:45 -0800 (PST) X-Gm-Message-State: AOAM532kferdlj5GW9NikMl4dRgRBJozgFVKSRbuMpRb1Z7y41JyEacN RDk8Uu1fuRv5XuK7aMTqZCZ3vODVCK2CcRMTiMc= X-Received: by 2002:a05:6830:13ce:: with SMTP id e14mr1791419otq.108.1612795245250; Mon, 08 Feb 2021 06:40:45 -0800 (PST) MIME-Version: 1.0 References: <20210208095732.3267263-1-maz@kernel.org> <20210208143248.GA25934@willie-the-truck> In-Reply-To: <20210208143248.GA25934@willie-the-truck> From: Ard Biesheuvel Date: Mon, 8 Feb 2021 15:40:33 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v7 00/23] arm64: Early CPU feature override, and applications to VHE, BTI and PAuth To: Will Deacon Cc: Marc Zyngier , Linux ARM , kvmarm , Linux Kernel Mailing List , Catalin Marinas , Mark Rutland , David Brazdil , Alexandru Elisei , Jing Zhang , Ajay Patil , Prasad Sodagudi , Srinivas Ramana , Hector Martin , James Morse , Julien Thierry , Suzuki K Poulose , Android Kernel Team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 8 Feb 2021 at 15:32, Will Deacon wrote: > > Hi Marc, > > On Mon, Feb 08, 2021 at 09:57:09AM +0000, Marc Zyngier wrote: > > It recently came to light that there is a need to be able to override > > some CPU features very early on, before the kernel is fully up and > > running. The reasons for this range from specific feature support > > (such as using Protected KVM on VHE HW, which is the main motivation > > for this work) to errata workaround (a feature is broken on a CPU and > > needs to be turned off, or rather not enabled). > > > > This series tries to offer a limited framework for this kind of > > problems, by allowing a set of options to be passed on the > > command-line and altering the feature set that the cpufeature > > subsystem exposes to the rest of the kernel. Note that this doesn't > > change anything for code that directly uses the CPU ID registers. > > I applied this locally, but I'm seeing consistent boot failure under QEMU when > KASAN is enabled. I tried sprinkling some __no_sanitize_address annotations > around (see below) but it didn't help. The culprit appears to be > early_fdt_map(), but looking a bit more closely, I'm really nervous about the > way we call into C functions from __primary_switched. Remember -- this code > runs _twice_ when KASLR is active: before and after the randomization. This > also means that any memory writes the first time around can be lost due to > the D-cache invalidation when (re-)creating the kernel page-tables. > Not just cache invalidation - BSS gets wiped again as well. -- Ard.