Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1189828ybx; Thu, 7 Nov 2019 08:29:53 -0800 (PST) X-Google-Smtp-Source: APXvYqxpier6aCW+JIUTL9Cyp2iAdyHnX+ftBbzcMcUn+JIEro7OyKpi6hheLNt33fCVWlKUpQHk X-Received: by 2002:a50:f783:: with SMTP id h3mr4525989edn.168.1573144193170; Thu, 07 Nov 2019 08:29:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573144193; cv=none; d=google.com; s=arc-20160816; b=yGSLuXEjvvxnYTq/CrrT8usRyjgVkCX+70nCR9cmzrSeNwMVwOTxtHiNx2Dp2kc2Qs nLla+VSit14Wm+J23h+xCzKt8iP8Qq5A7JvMunCGwuzKGwkPwvo9r7Q1X9hc22k/1qym iPIGXOrwG1km/vq9sYNcwesWG3dlvh+o8/vs6uV/W0Jh48sTZbn2O5eqn075S8phmkG6 +MxdZmk01raspAABIVlsqMOKUg4NSod3xCs+vrl07p4kwWOxGvYu7Ch8Bdj5Qp985LR2 JmMGAMKYaa4h0GS2h1968kVdeoanVM4k3XIDi6D3Xw5g8//l+2TiWx7h1CGD0OXUc/sy Qvzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=AHVtna/ZK+ShoKE32vj/oIbQxq9UojFvas7d10KE8fg=; b=yRcPjwMSeBC6n4H3Qlydw3T3IbbG/gpyxvunLkNi7kCUqhbCYoKyXiJrJtHAib2wGt 76p628OCUI53iPq/SeKvBU8xYLcLVsFLpgGnL/jR6xXc/k5Msy3dSzg+MOTO1Gx3Z3Ae KpF0Pz8GP5A0GQL8ZdZ8BvX92zOaSKkHvDJZb0L/yZ0z5HkEkyRkud0HcdJYANzz64hS NgvP8q5o2Zv/dQOEz0RTcEkRD3Yc9TtG40InkK3VUkIOkZByje62BcNihVv6dUV0GcbC AoTCiJA0T6V8Vm2X4i2nGeCupEcQt5cEAQ6V4yy4aoUXZM5hKDN+z42aFryx/EgS0716 BQ6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jZ5+6wBU; 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 q15si1815993ejm.31.2019.11.07.08.29.29; Thu, 07 Nov 2019 08:29:53 -0800 (PST) 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=jZ5+6wBU; 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 S1729516AbfKGQ0n (ORCPT + 99 others); Thu, 7 Nov 2019 11:26:43 -0500 Received: from mail-ua1-f66.google.com ([209.85.222.66]:32900 "EHLO mail-ua1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726231AbfKGQ0n (ORCPT ); Thu, 7 Nov 2019 11:26:43 -0500 Received: by mail-ua1-f66.google.com with SMTP id c16so779429uan.0 for ; Thu, 07 Nov 2019 08:26:42 -0800 (PST) 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; bh=AHVtna/ZK+ShoKE32vj/oIbQxq9UojFvas7d10KE8fg=; b=jZ5+6wBUk83wQPpJmxaIJELl84GXA/0+SmIJmGXKvPs+KkSBCCgqHgiiibcWA8tRTA HujJfE7DBIWcM4BdMqqm6Hcz+9CU85jfwEisPSpmYX8SNxvApOvMGdldNngt4QFlmguy L9WnpbCJuTK9/aD4SnBylkT5OXPccTKbvcPGHh1zNsTtz8OVlthkWe7v5As5buBEZozX Jz55FqoRAWXkZ9JM6qJpTKAC26iMxf6eygQfKLebtlCRS+d76RCGYyoBCD/ETzxuMdUU WKTMq/WWxlASzp8vUChued4POTmR6TtUPEetUvMBxAXDXrkob1IGUEAmcarqNNHiev2a mTgg== 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=AHVtna/ZK+ShoKE32vj/oIbQxq9UojFvas7d10KE8fg=; b=lTnRP9DavlWOYC0aqLdSRB6Yj5I1gxFZE5mWO1DTxoRxpd7EUHfMOWnmVSm1LIz2St VBxvF306MZpwctHjzhj2bZuHVHJlmO/7niaDPoB4FRjqYDvEGVk1sbaSJRUInGkPfPJk QLqfwcrKQk7cUrDtbcjwCuJVD0RUQ2tSDMl0npbY4/gldSE+YrqazPjrNLJRt8MWO5es cqNZmpNMU4GU/75FuzSP+Jp3Zj22O9acAMPmCHydsjyKPShHHl5obN1JpUglGn6av4ZZ kZtGaOvQiS86gYUhYOGrWaUukGAmyMJ4UkUn0trWJK2IKAzMOicuAWoN+eCLlqajvxVv 9AJQ== X-Gm-Message-State: APjAAAVHYor5pQUBe9UrozDllhV0jrAaN7mgs7ArCP/DTo1ebEtrwNmE klD0XutJ1dItTfemmoTSPPDVvpshEROPkPHOEZK1Zg== X-Received: by 2002:ab0:2381:: with SMTP id b1mr2931374uan.106.1573144001488; Thu, 07 Nov 2019 08:26:41 -0800 (PST) MIME-Version: 1.0 References: <20191018161033.261971-1-samitolvanen@google.com> <20191105235608.107702-1-samitolvanen@google.com> <20191105235608.107702-12-samitolvanen@google.com> In-Reply-To: From: Sami Tolvanen Date: Thu, 7 Nov 2019 08:26:30 -0800 Message-ID: Subject: Re: [PATCH v5 11/14] arm64: efi: restore x18 if it was corrupted To: Ard Biesheuvel Cc: Miguel Ojeda , Will Deacon , Catalin Marinas , Steven Rostedt , Masami Hiramatsu , Dave Martin , Kees Cook , Laura Abbott , Mark Rutland , Marc Zyngier , Nick Desaulniers , Jann Horn , Masahiro Yamada , clang-built-linux , Kernel Hardening , Linux ARM , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 7, 2019 at 2:51 AM Ard Biesheuvel wrote: > > On Wed, 6 Nov 2019 at 05:46, Miguel Ojeda > wrote: > > > > On Wed, Nov 6, 2019 at 12:56 AM Sami Tolvanen wrote: > > > > > > If we detect a corrupted x18 and SCS is enabled, restore the register > > > before jumping back to instrumented code. This is safe, because the > > > wrapper is called with preemption disabled and a separate shadow stack > > > is used for interrupt handling. > > > > In case you do v6: I think putting the explanation about why this is > > safe in the existing comment would be best given it is justifying a > > subtlety of the code rather than the change itself. Ard? > > > > Agreed, but only if you have to respin for other reasons. Sure, sounds good to me. I'll update the comment if other changes are needed. Sami