From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4417BC43381 for ; Wed, 3 Mar 2021 18:42:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 000B364ED4 for ; Wed, 3 Mar 2021 18:42:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1835447AbhCCSDc (ORCPT ); Wed, 3 Mar 2021 13:03:32 -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-Google-Smtp-Source: ABdhPJxWs0EKhEU3+cXlcQKVKJwnoA45aO7AE9vyg48ZK4GwVXG4V6ruO9zr58sUevEavcdfJhR6bEvR0hrBBVCLWxw= 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC7A0C433DB for ; Wed, 3 Mar 2021 22:47:03 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B0E6C60C41 for ; Wed, 3 Mar 2021 22:47:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B0E6C60C41 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LkAGTtqMn2c/dZKP82FkxvqdvcCEjfYn8IgQh0TNiMs=; b=TxoQEMKPXSb1N5ef9dMyQmJCP sR9Ajf3lm8RBwFPm/4sI+7Uh57xsjZCMxai5MZYB9Hbj4WVnenjZ46+AejuzoSczQJgbzLxL9P8lx XAM+rbSXqEmoQucFVUq8AjnwKFJmPccQ1f0DgYHO/ahGiC51CtbmETkM0dZKE3MgVZAGFQixOC9A4 VXT1C16TVIwt088nb6TnvMRUM/FLfS6ciDTZZ97WF+VnOQUtV9CFtWzJj7tKrUj3Jk/+uphMqX0tX WwD5U3S+q7x5IR1BWlzeo6C+TD8O7OsgBVaaY3MO600bHZjfmGfPZP479NxGNAbn3VM8ZyumAW0eX 5KsZgab6w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHaDP-006msk-UT; Wed, 03 Mar 2021 22:43:43 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHTGv-005M7c-7a for linux-arm-kernel@lists.infradead.org; Wed, 03 Mar 2021 15:18:47 +0000 Received: by mail-lf1-x12b.google.com with SMTP id p21so37631659lfu.11 for ; Wed, 03 Mar 2021 07:18:44 -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=en/eJECUGZi0fQVucEqLQtWjgsj0Xle/u+b6sqv1w920kpcBG8ouxaSM1PMIVY6Kwu 2Cwq8Q984Q/9reL9YJp0ByTOyVcQD1r2sFmhf7kuUNlYwnSNXZyxJMCVqMWIKMxapKof c76GdR1i7WS5G83jBmfordZ5dndHYEiZ8S8hnV+3py4x05oPfRl+4iQSEExhKPyN2hyb 2UoyJKFxcR+49/Zq9DCceW/JF509a37TpUFzfsnaMMEwjG1eY0TRvF9upykL6hNP5Lgy TXgtTyR4eiYq6RKEYYKPDJPbCAeKQ9odFHnv+c4/8dTnzlwa9gP8KmOAcmmwM4gMlzqu PlgQ== X-Gm-Message-State: AOAM530pe+84fLT9vaor6KtYEAnDaBZ8qlB8LiqxN890L+pCJYrpwPDv o755TgNIBi6co/jarPnxekBkpR5TXyM++8bDlh9w2Q== X-Google-Smtp-Source: ABdhPJxWs0EKhEU3+cXlcQKVKJwnoA45aO7AE9vyg48ZK4GwVXG4V6ruO9zr58sUevEavcdfJhR6bEvR0hrBBVCLWxw= 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 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel