Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7281673imu; Wed, 14 Nov 2018 14:49:06 -0800 (PST) X-Google-Smtp-Source: AJdET5c091dirjRwCknALQibuC3ndSpsdNItdE07mm+AWgV9KuXrHLU6M+wixBCYRX3JNRLffOgX X-Received: by 2002:a62:2c16:: with SMTP id s22-v6mr3846324pfs.6.1542235746698; Wed, 14 Nov 2018 14:49:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542235746; cv=none; d=google.com; s=arc-20160816; b=tEoehWy2kg/BRVZHFSQGRid7JqiJ3DfEQZaMU1+E8QIfvB6qk0oIwoVr0lhz1owcoy AqRo0wGXYlshObWymbh4dveEhVPjn2qUETV627WcVkJWuqWz9zXWKZ2sBMD3A/J3gIfX X8FOUtm42T8SMyfw/5385BFqoHjsixfW/uDOfMWYIsYlwgzZ9nkDY9VmjHPsO2oRLSoN /KKmtwmgj8l3/4C/NqwczetmkjhTJ9eWaocDW6thI6gPtvuumzi16ZHd2V50cWLZ2YGc JLI0ZCw3r7wedCJOdHURE2B0s64PcxXWvSgkhQXbOsemQGqdaVjvdekY26+fYJ9eDvlR drnA== 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 :references:in-reply-to:mime-version:dkim-signature; bh=SY0zlOONuREE8Rl0qImCyrFTm0DYI7yiTyIKNGmeAJw=; b=Gz2siJxPGFOFn+gP29biDkHeKiiMLBb+64i0ugg+cS7QQybrflFGzOTwGVb1ZB5q8d y+cGE5aBh1jVL2K1Qm6mpF8rw5gOzXTKLJteK5/NXlFVYgGKMn484PZYcDY31Pu5JxoS whz+TJC8eFxYUN/6W73i4/bis2Y9Hqb3cNwmbepApU02Q83Yk5vjCJh8NSoHtxtgbw4A aWWpE9vk1MG0dI7P//HfRlO7rB32BNnj0cpFysTIgxOzbhRgH8vA9iyk/+tm+g7v4aAw OfyeTLhvq6U/cDxqWzvvsUMUDJgvm7DNFmR2nFML1WmrKbWHEEGvsKs+qgS9SetYHG6V JS6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TBiBlagL; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v8-v6si27650646pfk.264.2018.11.14.14.48.52; Wed, 14 Nov 2018 14:49:06 -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=@chromium.org header.s=google header.b=TBiBlagL; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728405AbeKOIx2 (ORCPT + 99 others); Thu, 15 Nov 2018 03:53:28 -0500 Received: from mail-yb1-f196.google.com ([209.85.219.196]:42792 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725895AbeKOIx2 (ORCPT ); Thu, 15 Nov 2018 03:53:28 -0500 Received: by mail-yb1-f196.google.com with SMTP id o204-v6so7588114yba.9 for ; Wed, 14 Nov 2018 14:48:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=SY0zlOONuREE8Rl0qImCyrFTm0DYI7yiTyIKNGmeAJw=; b=TBiBlagL1QyupAp9ljD4IST7uGM2x9BED81N7wKsxdGS+7gsyAq6WkiYVPfp+ZkiDx g7/XU8qIKFw9H1iNoz1kI1W58ddtZDgNa8IwCZuKdUogpRY+mQ3qsO4OHB62d4ylx3Zo 62n7OGfiUKD7AuSZNmKxbXD8NKk+TBV8w4Uf0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=SY0zlOONuREE8Rl0qImCyrFTm0DYI7yiTyIKNGmeAJw=; b=isxz9nmq2o7i5K8MJY8o6zThyyffIP7Ip/pTrFOllFTn6Z6e8EYlMHRP6mrt2kzsu6 pl1ggXnR0qkGZWlAuRp4gt0/G0IFTWZIXuSkdo4RVBbUyPh7XEuE2lbTIK0cs6+4bBE7 9d7pfkIhy8r7ZKE8Q8LczBea0dnUKcHt9Xjp25Zk/MlyZaziF4MhPRcQUjmEwYuWkvpu fMQyvAg0FeDuLneZ+bZJ9jRqtqWqRg4/H7W6T059Vi7Jkue65VKfXP4oAxrb6E6UxBuu RYZzz4Jqwkw1U4VouW80Igg/9CDmDlkOPEkBjbDSjt1QUQDqJX1gVlqULK9G6kAU9Vz7 CVfw== X-Gm-Message-State: AGRZ1gKhURL7Lm3zjmc43bbtgp5L6hEPwbc+A6EAVIp7qYPwHQFA0WL6 KpbFWZMtUsjA3WWfH5NNAwovZ4KPcBQ= X-Received: by 2002:a25:2585:: with SMTP id l127-v6mr3715001ybl.324.1542235695271; Wed, 14 Nov 2018 14:48:15 -0800 (PST) Received: from mail-yw1-f52.google.com (mail-yw1-f52.google.com. [209.85.161.52]) by smtp.gmail.com with ESMTPSA id q2-v6sm11900910ywa.24.2018.11.14.14.48.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 14:48:13 -0800 (PST) Received: by mail-yw1-f52.google.com with SMTP id r199so309111ywe.4 for ; Wed, 14 Nov 2018 14:48:13 -0800 (PST) X-Received: by 2002:a0d:e984:: with SMTP id s126-v6mr3551902ywe.47.1542235692507; Wed, 14 Nov 2018 14:48:12 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a25:b906:0:0:0:0:0 with HTTP; Wed, 14 Nov 2018 14:48:11 -0800 (PST) In-Reply-To: <20181114214701.gdnrznakwtm76jlt@blommer> References: <20181005084754.20950-1-kristina.martsenko@arm.com> <20181114214701.gdnrznakwtm76jlt@blommer> From: Kees Cook Date: Wed, 14 Nov 2018 16:48:11 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 00/17] ARMv8.3 pointer authentication support To: Mark Rutland Cc: Kristina Martsenko , linux-arm-kernel , Adam Wallis , Amit Kachhap , Andrew Jones , Ard Biesheuvel , Arnd Bergmann , Catalin Marinas , Christoffer Dall , Dave P Martin , Jacob Bramley , Marc Zyngier , Ramana Radhakrishnan , "Suzuki K . Poulose" , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-arch , 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 Wed, Nov 14, 2018 at 3:47 PM, Mark Rutland wrote: > On Tue, Nov 13, 2018 at 05:09:00PM -0600, Kees Cook wrote: >> On Tue, Nov 13, 2018 at 10:17 AM, Kristina Martsenko >> wrote: >> > When the PAC authentication fails, it doesn't actually generate an >> > exception, it just flips a bit in the high-order bits of the pointer, >> > making the pointer invalid. Then when the pointer is dereferenced (e.g. >> > as a function return address), it generates the usual type of exception >> > for an invalid address. >> >> Ah! Okay, thanks. I missed that detail. :) >> >> What area of memory ends up being addressable with such bit flips? >> (i.e. is the kernel making sure nothing executable ends up there?) >> >> > So when a function return fails in user mode, the exception is handled >> > in __do_user_fault and a forced SIGSEGV is delivered to the task. When a >> > function return fails in kernel mode, the exception is handled in >> > __do_kernel_fault and the task is killed. >> > >> > This is different from stack protector as we don't panic the kernel, we >> > just kill the task. It would be difficult to panic as we don't have a >> > reliable way of knowing that the exception was caused by a PAC >> > authentication failure (we just have an invalid pointer with a specific >> > bit flipped). We also don't print out any PAC-related warning. >> >> There are other "guesses" in __do_kernel_fault(), I think? Could a >> "PAC mismatch?" warning be included in the Oops if execution fails in >> the address range that PAC failures would resolve into? > > I'd personally prefer that we didn't try to guess if a fault is due to a failed > AUT*, even for logging. > > Presently, it's not possible to distinguish between a fault resulting from a > failed AUT* and a fault which happens to have hte same bits/clear, so there are > false positives. The architecture may also change the precise details of the > faulting address, and we'd have false negatives in that case. > > Given that, I think suggesting that a fault is due to a failed AUT* is liable > to make things more confusing. Okay, no worries. It should be pretty clear from the back trace anyway. :) As long as there isn't any way for the pointer bit flips to result in an addressable range, I'm happy. :) -Kees -- Kees Cook