Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp799746ybx; Thu, 7 Nov 2019 02:54:26 -0800 (PST) X-Google-Smtp-Source: APXvYqzoC7qCWdgMXVeUvgf4lrTDgwh38fBKTcMKdS8R4R5tsh5yq5zD1sxRT1r55RNl5S32MTYP X-Received: by 2002:a17:906:13d5:: with SMTP id g21mr2311767ejc.72.1573124066115; Thu, 07 Nov 2019 02:54:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573124066; cv=none; d=google.com; s=arc-20160816; b=OXZRmOCLCrqKLKK9+TIOOT97JcQA5SbFe6bYOnxCzjuxuRmEiqq+JkqgHBsK5D4rBQ MZxpbvCa5WGk0SnnDdufT+PnwTjNagkhi35iY6qDozslYZbcl9CQ1gSp1g+qEEYDHFYi 0qIQouS/bJQpPBP0HLVl5OEaWweNE59Xj3eijBcJNwa//qFe3zuUoIEDm/UXxhmcqEum Pb+9zHwMT4WmCXe7asP82nRDz4sbB9cQjGwiGiJCiBEbpktTFG2kQl1R39hUr0KuLE4B 0RP6znU2ZKmBnhNl25FTRI7+Fj2zHvA10SkHoZTPYhFy4d078SKICbf20eOzTckXgUsv BV1w== 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=OvMY+y9t+JrwQeXlyarqTJXF9VkquzjWewr7iQbYsdg=; b=E1Qnp8SpKjSPh7r3oZn0ndHwWrG3+dUQigUL48w0rX9HbIBony9r2OawuUD4KG/bh7 EWrFvLALyfldtPVCNdkYqFsdveEuBtC0fW7w0dJedmFwdOyqaP+6J9JDpcr2Y0jaCp8k nrirqXiiLDt/gek1aRCBSBFreLp0a3v9okFJ/q6NMNH+kqHksORCXYWvZsze3pk5gla+ oO0yRe/6zV2fqt0b6MqU43/5eSgr+P95UA7yczP2+rTLiYWQ8fk9186B/w5hIz0ymfUB ZZnCd5mo1M75B2jUSeUZrTwGXYpLDMEM/Ny18qws3BZcYup8Nv26McrPh1xAyMwkztXL WTKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HKwEOayk; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k63si1265721edc.347.2019.11.07.02.54.02; Thu, 07 Nov 2019 02:54:26 -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=@linaro.org header.s=google header.b=HKwEOayk; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388204AbfKGKvw (ORCPT + 99 others); Thu, 7 Nov 2019 05:51:52 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:54624 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727528AbfKGKvw (ORCPT ); Thu, 7 Nov 2019 05:51:52 -0500 Received: by mail-wm1-f66.google.com with SMTP id z26so1937996wmi.4 for ; Thu, 07 Nov 2019 02:51:50 -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=OvMY+y9t+JrwQeXlyarqTJXF9VkquzjWewr7iQbYsdg=; b=HKwEOaykRl1GaA5HUx+9TcTEGGb7oNvHt2Y9owJSyCUoyem7fwAkvwQBHkQI2FPvWP uD0rulX0IgiMsrRSKmb0gtmwI0JV854FA+6gSUC796H6UFIZXFzBZJ2xOUivRHTVQ7hz 7wCtkr90dGCFRE9MIxHYuABRTVM2CaXJ2g8zZntLAHf9IB+LEKPFIzPuvH4ZT93oEQRw CkmsEypotk24LHmyt9u5PQ+ufkPLAAuWaKVGxSQQlNXe6maf3XOUhitNWnifjM/Y/KdZ 9bZxWAB3xnwJN98FAhenJ2RmIObgbkD+CCxooE1AqOAT7pNw5Zsa/8pH6e9bXw4Thfeb Hl0g== 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=OvMY+y9t+JrwQeXlyarqTJXF9VkquzjWewr7iQbYsdg=; b=X2lkEKKj/uQAe6Lcg4xcBi17ca1A6OyN3EpLvOY+GCzm8q/oW86WHit/EB27cceslz eAMs81rcctfHvYXAkoXMxZJnieBXgTdiEK/i1PyoAqvJODKZpI7nWgXxy9l9Ph34i+6C rPk0FVZd6d/G3kuBehlmMGksEamHxLlmwBolvr6qtVw/pwGB6+G0kiH1N5iKPICLMwJh ikmGnYESQUL6wruyXdVFSu7a9LQWk8cCK3UiXZCo8iD06+3YxDj7YkKln0FYjVWObhpG zlAugtEpGYUxIpJ4tYr+KzC9xA+D8p3r0MxGhoqgViFLOdJMRsAJ4MQR9RJyMCToltTE gp8g== X-Gm-Message-State: APjAAAUJSxm4iZTFBWjDdrb5YPXX/FOC6Tek1gd0ye5CzVTMYB7iD/RM 0/PkVj5KL50fHOCoB0UjYCD7bRgtioFGK9IYirlo5Q== X-Received: by 2002:a1c:b1c3:: with SMTP id a186mr2297717wmf.10.1573123909498; Thu, 07 Nov 2019 02:51:49 -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: Ard Biesheuvel Date: Thu, 7 Nov 2019 11:51:38 +0100 Message-ID: Subject: Re: [PATCH v5 11/14] arm64: efi: restore x18 if it was corrupted To: Miguel Ojeda Cc: Sami Tolvanen , 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 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.