Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1580911pxb; Thu, 4 Mar 2021 15:24:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzW+18Hw/OfZiDLIDu/Ti6t9CFGUZdcNrlVBJyrVMVUtQssaA3ipPgRcup+REAQJyJgONa5 X-Received: by 2002:a5e:8c16:: with SMTP id n22mr5638697ioj.156.1614900245359; Thu, 04 Mar 2021 15:24:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614900245; cv=none; d=google.com; s=arc-20160816; b=m7hTJqg//kgMsBxl0Zl6zrKeW8Q0SXMlfyRpVxe5NgEw4waTs4mfGfJF/YMfe0odOI A5H30p5UyiiGUh/ZgnNMRJi1i179nlkgV0ikBqpamnOaEqpKuEIiZ3NxSvf6p075SOCN +j6dr1HphqiEPUW2RtQruG7Dr/MRwXOv7Bs8qQQqOv4gtmP0QwxwO1t+NkvMMep4T+9s ZXssrhNYvEep9Q/mpX6HCNNalepKmOOvtHlWDmySRLIbXsCb28b3wFAiuppyt+5KBe/6 taNLs4HFJaHAoTGdDZe48Ovwppcjz9GWrqjPZK6HY1g9OlhmIbD74iPM9+NT2fkdEWD2 JEzg== 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=c1EgmR4iNgHLIiSmovii//tHLOrgOuYElC0B+L466FE=; b=tBUnd8plLKKWk7xwih949k4k1QrcgyP2049INYFpFiGR2NNIYAQjNJvXR5mI7OceCH LM5fXzkTHa0LJWll8BaamPuflApUW1GZbGqCVMF9XL1cMyQs/wE/5gwmISxb6dwpQOuD jh6lfSD+eo330kQNK0cd9CHRkKCjab0tmYHXZHIHT/GoOOCV5Gawl7BCzF3n6g5n1s2E l9NngyQTYpZ1MP1ZhWDAoXHtcBK0Iwuz3nT7MTpeFl6Yp7wfE7CD9M9NwMJqaJpWFCAB i25+WVh58APCeJks4fpGnK2K0dEb1r+BOEj4NS7fpnvRWsyQUYtam4o7CaDbYfSp8cXk 8zSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MeXdy5EL; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n6si840633jaj.81.2021.03.04.15.23.52; Thu, 04 Mar 2021 15:24:05 -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=@linaro.org header.s=google header.b=MeXdy5EL; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1835436AbhCCSDa (ORCPT + 99 others); Wed, 3 Mar 2021 13:03:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345292AbhCCPTn (ORCPT ); Wed, 3 Mar 2021 10:19:43 -0500 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D1A0C061762 for ; Wed, 3 Mar 2021 07:18:45 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id d3so37645740lfg.10 for ; Wed, 03 Mar 2021 07:18:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=c1EgmR4iNgHLIiSmovii//tHLOrgOuYElC0B+L466FE=; b=MeXdy5ELJ8KysVIcMymUJ6XoMIVkBzMk/q9/3VqZ9qXhae+QwDzQD6/d6JAYsLZiKg Im7F7MfmsqLrmn+e/eoDa/PWyQqlsSlWGOfe4WYjNTxocdmJA3Z9RDkOQVlReDlMdiIH zrDGzNjqqgB/3ihvoEhRlQMEV+3Q87FFBsqe2IuvBH95gSru/Lq/aexiN6BjshpEHRl2 7P0qttdG7VTVNmtPtOR5baaYS1vZp7PAKYPWag4ascvIh4+NgjbGxVCFMckDz0nxvZqv cAbUfMr/ejIBgtC83hLMGHP5TfstRhDcjbRtdyDtRaFqEZ6vAevN2vgRDLDGM4Cifqyd ubYQ== 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; bh=c1EgmR4iNgHLIiSmovii//tHLOrgOuYElC0B+L466FE=; b=Sr9j1oUr6ej8S+kfmy/w00a9w8bamRXRNw8xC6zgl0U2Zoj8u/1FjGZfQeYl/CjI3W CpaO/jYUmbiI8LzpJL4LtpbRTFtmwl2WnX4r7LEqZGFz6UPlgGHWDZ2c5DA2fjDAAw3s ZEo45G7p39HCKHCXxcjNHffIjHrITcQ/C06eZOe5WR8IGwey2WxeZLmI6S4uokjRZL0o 2BM+gyDJd8Bsz7TiBc4IbaJ/hoGTeDh+G8nosQymq0Wo11suhvLD7JMXZK3k6NIEtERe 8kMHOcUgR+brQ2oNLTfQoUjQgciv9FA9Kcx0Eew+AR9C0WOKNe8J05hFAyy8dMdaemZl z0Ig== X-Gm-Message-State: AOAM533rWDEzhOQnN3xDqy3OpUK/nih5wz9XTb5Ptf5Z1z2tqzVJel7o IxLR+JK5YnY9tgC06a9Ry0vfB9VV/V8jCho22ZA0Gw== X-Received: by 2002:a19:548:: with SMTP id 69mr13152043lff.465.1614784724064; Wed, 03 Mar 2021 07:18:44 -0800 (PST) MIME-Version: 1.0 References: <20210219201852.3213914-1-jiancai@google.com> <20210219230841.875875-1-jiancai@google.com> <20210222115816.GA8605@willie-the-truck> <20210223100453.GB10254@willie-the-truck> In-Reply-To: <20210223100453.GB10254@willie-the-truck> From: Linus Walleij Date: Wed, 3 Mar 2021 16:18:32 +0100 Message-ID: Subject: Re: [PATCH v4] ARM: Implement SLS mitigation To: Will Deacon Cc: Jian Cai , Nick Desaulniers , Manoj Gupta , Luis Lozano , clang-built-linux , Nathan Chancellor , David Laight , Russell King , Catalin Marinas , James Morris , "Serge E. Hallyn" , Arnd Bergmann , Masahiro Yamada , Kees Cook , Ard Biesheuvel , =?UTF-8?Q?Andreas_F=C3=A4rber?= , Ingo Molnar , Marc Zyngier , Andrew Morton , Mike Rapoport , Mark Rutland , David Brazdil , James Morse , Linux ARM , Linux Kernel Mailing List , linux-security-module@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 23, 2021 at 11:05 AM Will Deacon wrote: > On Mon, Feb 22, 2021 at 01:50:06PM -0800, Jian Cai wrote: > > I am not sure if there are any plans to protect assembly code and I > > will leave it to the Arm folks since they know a whole lot better. But > > even without that part, we should still have better protection, > > especially when overhead does not look too bad: I did some preliminary > > experiments on ChromeOS, code size of vmlinux increased 3%, and there > > were no noticeable changes to run-time performance of the benchmarks I > > used. > > If the mitigation is required, I'm not sure I see a lot of point in only > doing a half-baked job of it. It feels a bit like a box-ticking exercise, > in which case any overhead is too much. I wrote some suggestions on follow-ups in my reply, and I can help out doing some of the patches, I think. Since ARM32 RET is mov pc, <> git grep 'mov.*pc,' | wc -l gives 93 sites in arch/arm. I suppose these need to come out: mov pc, lr dsb(nsh); isb(); As ARM32 doesn't have sb my idea is to make a macro "sb" that resolves to dsb/isb when this is enabled and then we could start patching all the assembly users with that as well. I need the Kconfig symbol from this patch though. I also suggest selecting this mitigation as part of HARDEN_BRANCH_PREDICTOR, by the token that either you want all of them or none of them. Yours, Linus Walleij