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=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 9A306C33CAF for ; Thu, 16 Jan 2020 20:36:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6AC9420730 for ; Thu, 16 Jan 2020 20:36:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="dryW2bgx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388024AbgAPUgP (ORCPT ); Thu, 16 Jan 2020 15:36:15 -0500 Received: from mail-vk1-f193.google.com ([209.85.221.193]:39068 "EHLO mail-vk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729637AbgAPUgP (ORCPT ); Thu, 16 Jan 2020 15:36:15 -0500 Received: by mail-vk1-f193.google.com with SMTP id t129so6054447vkg.6 for ; Thu, 16 Jan 2020 12:36:13 -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=RV6fXTo3b3qoT7vSlLu9LZXPKWnKYVEBYLBa7aJ3coE=; b=dryW2bgxQT3TcmKHyF7k3/UkFi2E2Qunh6WctF3kjeRnNJDiSxf7obYQetkLkkmU/f rsRO4G1R9NHiQfiB7IbS/g3e201MDYpYRfm3I3lKZQuJ6YOovOwoFVhI0kbjkNwOxZtP m0dEx+VXLI9Cl6w4dCABDOZNZ3pChr94FxH3Dz3EX4sWv6ulIjkhtRpxwc+9VzwfxebA cjQgmaLfTXvQy+lU5KMD7jPpMrGjZ09Pd0UPfHvYS5HSHD7Naska9ofDRIcdvtGMBkNE kQkpg/ELqolO16Xjr3izfosdUsgTcuHhXOL5clFLaqYqXnnDVzR4Q0VRcIwAYcdwoE7u IvEA== 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=RV6fXTo3b3qoT7vSlLu9LZXPKWnKYVEBYLBa7aJ3coE=; b=tNhX/dPUUOBon9FKfbtIFtGUGlHEjTVW+FdifQsZP7xVTXI954paflMC3VdfdjVSwP XcSveyEkbRwuyx51NYJpHIg/CiblBVu/c/l/d2ZAxUgk2+64IiOSsEbqSh6n7OyuVT3E 8BSbvOLaNC8dnuCoW7A9LczhGgrIWQSuMQWwwyydqU1FblAmrnrQ5BgPGGFkDC3S31H2 4bUwYjMmd2Ofs7jf6oV0g8HMTBw4vD17CLmhmfyR1jeb9he9lL7iruD9g+AwnNsmfpUr JacUl2UUXVpnZLWPkDkHW/nbR4v6UOQXvJpGMDT1BQVWs32spOHQ4/PJ38XdtuvR45Hf ebfg== X-Gm-Message-State: APjAAAVaewlAN0Krk01V+Mq7J71Ik6L//YSzYpgL1VPXNXXsEOOV5d+1 r3wCth48K4LKwJHlRzBjAQ5A49Z3TGNgCwYHQkk12w== X-Google-Smtp-Source: APXvYqy3hookrrU/Buxl44KY5o3vqIMbrfDIWbbyEY39r9m+d/9XpIDAayToTJcBMK5GJtdqCaMmmDL594aQGbaPCAk= X-Received: by 2002:a1f:2910:: with SMTP id p16mr18939592vkp.71.1579206972944; Thu, 16 Jan 2020 12:36:12 -0800 (PST) MIME-Version: 1.0 References: <20191018161033.261971-1-samitolvanen@google.com> <20191206221351.38241-1-samitolvanen@google.com> <20191206221351.38241-12-samitolvanen@google.com> <20200116174450.GD21396@willie-the-truck> In-Reply-To: <20200116174450.GD21396@willie-the-truck> From: Sami Tolvanen Date: Thu, 16 Jan 2020 12:36:01 -0800 Message-ID: Subject: Re: [PATCH v6 11/15] arm64: efi: restore x18 if it was corrupted To: Will Deacon Cc: Catalin Marinas , Steven Rostedt , Masami Hiramatsu , Ard Biesheuvel , Mark Rutland , Dave Martin , Kees Cook , Laura Abbott , Marc Zyngier , Nick Desaulniers , Jann Horn , Miguel Ojeda , Masahiro Yamada , clang-built-linux , Kernel Hardening , linux-arm-kernel , LKML 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, Jan 16, 2020 at 9:45 AM Will Deacon wrote: > > On Fri, Dec 06, 2019 at 02:13:47PM -0800, Sami Tolvanen wrote: > > -0: b efi_handle_corrupted_x18 // tail call > > +0: > > +#ifdef CONFIG_SHADOW_CALL_STACK > > + /* > > + * Restore x18 before returning to instrumented code. This is > > + * safe because the wrapper is called with preemption disabled and > > + * a separate shadow stack is used for interrupts. > > + */ > > + mov x18, x2 > > +#endif > > Why not restore it regardless of CONFIG_SHADOW_CALL_STACK? The ifdefs are here only because restoring the register without SCS isn't actually necessary, but I'm fine with dropping them (and editing the comment) in the next version if you prefer. Sami 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=-0.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,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 B9F3DC33CAF for ; Thu, 16 Jan 2020 20:36:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 8BDB520730 for ; Thu, 16 Jan 2020 20:36:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uSfrZk6c"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="dryW2bgx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8BDB520730 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=hebAaIR4CzOQHkxHgcRHSE9bEsId5I+TVoSjvViYhHM=; b=uSfrZk6cBP23r+ YLb2RVcpu+syrwm4bxofdpQimESWCYPQY7fvjQvKgSs8H4vw2gP5g82fZOvlXmgoIo/uL+Iy0mY9u 6/sW5w4gYSFPVgFxiz46DBXJVWlD1ZBrVDgANwtD6jP4qFYKJ8O1CqKZD4V19KT4kvi3R9TSD+MBR kBjJY7I1vetS/1jD7I149UI7aqwLuKWblX9b7GQqskGN2aagzEZeftrnVOyUa2rj+e7BgeXiL6kYD hJnX4ota0dR1rZTf4/xxHUS4qGihCcrO5Pppwnxq7JDHpDjelEquBjkIRCNGh+e8RzG2GjaB/qtPL K4uVTaMV9YoMUSuSW+Qw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1isBsK-00084t-81; Thu, 16 Jan 2020 20:36:20 +0000 Received: from mail-vk1-xa43.google.com ([2607:f8b0:4864:20::a43]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1isBsH-00083i-BT for linux-arm-kernel@lists.infradead.org; Thu, 16 Jan 2020 20:36:18 +0000 Received: by mail-vk1-xa43.google.com with SMTP id d17so6045898vke.5 for ; Thu, 16 Jan 2020 12:36:14 -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=RV6fXTo3b3qoT7vSlLu9LZXPKWnKYVEBYLBa7aJ3coE=; b=dryW2bgxQT3TcmKHyF7k3/UkFi2E2Qunh6WctF3kjeRnNJDiSxf7obYQetkLkkmU/f rsRO4G1R9NHiQfiB7IbS/g3e201MDYpYRfm3I3lKZQuJ6YOovOwoFVhI0kbjkNwOxZtP m0dEx+VXLI9Cl6w4dCABDOZNZ3pChr94FxH3Dz3EX4sWv6ulIjkhtRpxwc+9VzwfxebA cjQgmaLfTXvQy+lU5KMD7jPpMrGjZ09Pd0UPfHvYS5HSHD7Naska9ofDRIcdvtGMBkNE kQkpg/ELqolO16Xjr3izfosdUsgTcuHhXOL5clFLaqYqXnnDVzR4Q0VRcIwAYcdwoE7u IvEA== 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=RV6fXTo3b3qoT7vSlLu9LZXPKWnKYVEBYLBa7aJ3coE=; b=aSV86yiQkdkEspi3yf8egyWMXGhPEKQQXU0JD7ZEGIcC3MJXhsbaxnJc6hRazQX0MR Ma6F+qBEnE5tkQgAaNujjvexQH5SFYlaRLjcO4wpWZA9UeWuka2FrbY+gwKAMTBfDtH+ K2Ulh5XLKJu/v26p9L71mRRHvoLq61dP/NHgOQw7xMZ63ATPqnaru6gQN4QAk90d1j53 WdfAfC5NAW34s76tVGb74b/m8v00tyoh3QfT4wOW8N8bwH8UJbvIDqQBmqgRqKF9yNZp 9k9jlHp7yjDmNE+bSk/tAmiDIbeeBzsmyM8srQWWxpqY/9giX77DA1MCXiohdhziVzhf E3tA== X-Gm-Message-State: APjAAAXZZEWBlfrQZi1IuEKc2wjb49Gs72FC5f8s9NMSYZxhguG3Q9+O UbD5W7TGdBKfCY0rOiwToUAL25gtPs1WAcPJeZ6Gqg== X-Google-Smtp-Source: APXvYqy3hookrrU/Buxl44KY5o3vqIMbrfDIWbbyEY39r9m+d/9XpIDAayToTJcBMK5GJtdqCaMmmDL594aQGbaPCAk= X-Received: by 2002:a1f:2910:: with SMTP id p16mr18939592vkp.71.1579206972944; Thu, 16 Jan 2020 12:36:12 -0800 (PST) MIME-Version: 1.0 References: <20191018161033.261971-1-samitolvanen@google.com> <20191206221351.38241-1-samitolvanen@google.com> <20191206221351.38241-12-samitolvanen@google.com> <20200116174450.GD21396@willie-the-truck> In-Reply-To: <20200116174450.GD21396@willie-the-truck> From: Sami Tolvanen Date: Thu, 16 Jan 2020 12:36:01 -0800 Message-ID: Subject: Re: [PATCH v6 11/15] arm64: efi: restore x18 if it was corrupted To: Will Deacon X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200116_123617_416693_DE67BCC9 X-CRM114-Status: UNSURE ( 9.92 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Kees Cook , Ard Biesheuvel , Masahiro Yamada , Catalin Marinas , Jann Horn , Nick Desaulniers , LKML , Steven Rostedt , Miguel Ojeda , clang-built-linux , Masami Hiramatsu , Marc Zyngier , Kernel Hardening , Laura Abbott , Dave Martin , linux-arm-kernel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jan 16, 2020 at 9:45 AM Will Deacon wrote: > > On Fri, Dec 06, 2019 at 02:13:47PM -0800, Sami Tolvanen wrote: > > -0: b efi_handle_corrupted_x18 // tail call > > +0: > > +#ifdef CONFIG_SHADOW_CALL_STACK > > + /* > > + * Restore x18 before returning to instrumented code. This is > > + * safe because the wrapper is called with preemption disabled and > > + * a separate shadow stack is used for interrupts. > > + */ > > + mov x18, x2 > > +#endif > > Why not restore it regardless of CONFIG_SHADOW_CALL_STACK? The ifdefs are here only because restoring the register without SCS isn't actually necessary, but I'm fine with dropping them (and editing the comment) in the next version if you prefer. Sami _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 D6579C33CAF for ; Thu, 16 Jan 2020 20:36:31 +0000 (UTC) Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.kernel.org (Postfix) with SMTP id 2F67C20730 for ; Thu, 16 Jan 2020 20:36:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="dryW2bgx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F67C20730 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernel-hardening-return-17580-kernel-hardening=archiver.kernel.org@lists.openwall.com Received: (qmail 9226 invoked by uid 550); 16 Jan 2020 20:36:25 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Received: (qmail 8182 invoked from network); 16 Jan 2020 20:36:25 -0000 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=RV6fXTo3b3qoT7vSlLu9LZXPKWnKYVEBYLBa7aJ3coE=; b=dryW2bgxQT3TcmKHyF7k3/UkFi2E2Qunh6WctF3kjeRnNJDiSxf7obYQetkLkkmU/f rsRO4G1R9NHiQfiB7IbS/g3e201MDYpYRfm3I3lKZQuJ6YOovOwoFVhI0kbjkNwOxZtP m0dEx+VXLI9Cl6w4dCABDOZNZ3pChr94FxH3Dz3EX4sWv6ulIjkhtRpxwc+9VzwfxebA cjQgmaLfTXvQy+lU5KMD7jPpMrGjZ09Pd0UPfHvYS5HSHD7Naska9ofDRIcdvtGMBkNE kQkpg/ELqolO16Xjr3izfosdUsgTcuHhXOL5clFLaqYqXnnDVzR4Q0VRcIwAYcdwoE7u IvEA== 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=RV6fXTo3b3qoT7vSlLu9LZXPKWnKYVEBYLBa7aJ3coE=; b=ara3ZmYkcohyzLYqcWu7AXnjslWkc2fC5Z4gs50ce9JdZi3q5rgVzMsbPkWdPcf2j4 mFGWi9VV7oNRPgdsG/zLv5QgjMbSgNXpDC2Hq0YQ/GmN28WvYKbAHjark4n5HxDqArXZ 8PV1EHD6pUy78ljIbjMEX/F/RYA9na1MiN1RKE13UAp9rL/TGbtv6iU5quRantH//Jln GEGoqbKDco0fXefLZd/5BWOhSsz930vn9nHpNelOIigErf7nMl0jDVS+RiVS4nHsNRLY pl5iJISD1sPG66Z5Tcj5rd0BzL+PEb6w8ImyQzLbWyRagaByIgSto8Ooxujhs63KFK8I vPvQ== X-Gm-Message-State: APjAAAVNW7x5PMIOHMjcUbF5RvRCLbp7JCCdIXP5ntG+il00c/x+otE+ fXjDhLqKXHRVeuRIyF/ArC2025BWTxdQOtzOt7jH6Q== X-Google-Smtp-Source: APXvYqy3hookrrU/Buxl44KY5o3vqIMbrfDIWbbyEY39r9m+d/9XpIDAayToTJcBMK5GJtdqCaMmmDL594aQGbaPCAk= X-Received: by 2002:a1f:2910:: with SMTP id p16mr18939592vkp.71.1579206972944; Thu, 16 Jan 2020 12:36:12 -0800 (PST) MIME-Version: 1.0 References: <20191018161033.261971-1-samitolvanen@google.com> <20191206221351.38241-1-samitolvanen@google.com> <20191206221351.38241-12-samitolvanen@google.com> <20200116174450.GD21396@willie-the-truck> In-Reply-To: <20200116174450.GD21396@willie-the-truck> From: Sami Tolvanen Date: Thu, 16 Jan 2020 12:36:01 -0800 Message-ID: Subject: Re: [PATCH v6 11/15] arm64: efi: restore x18 if it was corrupted To: Will Deacon Cc: Catalin Marinas , Steven Rostedt , Masami Hiramatsu , Ard Biesheuvel , Mark Rutland , Dave Martin , Kees Cook , Laura Abbott , Marc Zyngier , Nick Desaulniers , Jann Horn , Miguel Ojeda , Masahiro Yamada , clang-built-linux , Kernel Hardening , linux-arm-kernel , LKML Content-Type: text/plain; charset="UTF-8" On Thu, Jan 16, 2020 at 9:45 AM Will Deacon wrote: > > On Fri, Dec 06, 2019 at 02:13:47PM -0800, Sami Tolvanen wrote: > > -0: b efi_handle_corrupted_x18 // tail call > > +0: > > +#ifdef CONFIG_SHADOW_CALL_STACK > > + /* > > + * Restore x18 before returning to instrumented code. This is > > + * safe because the wrapper is called with preemption disabled and > > + * a separate shadow stack is used for interrupts. > > + */ > > + mov x18, x2 > > +#endif > > Why not restore it regardless of CONFIG_SHADOW_CALL_STACK? The ifdefs are here only because restoring the register without SCS isn't actually necessary, but I'm fine with dropping them (and editing the comment) in the next version if you prefer. Sami