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,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 39537CA9EA9 for ; Fri, 18 Oct 2019 17:56:29 +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 1320821835 for ; Fri, 18 Oct 2019 17:56:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PXRAn/nf"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="olkgjhwO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1320821835 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=mt7lp/tydnJ0ZNvVrMHkDtTHTgn5l1poY5VFi6HDBfE=; b=PXRAn/nfFWRBzF yU/2vFOQh3agbxMBLIi7+rw9ozAhNo6vtityVppAtyMKJVYrNjg33UuPGVWJKBQ0PyQCosproN+FR kaCjJ+89HgymtkjihXPsFI0JNb87UTsEmxUGHlFvyYTrGlrnwhghqTwfFP3EGAzk5mn6DiT8feSLx mVyRjX3Q7ITt7sv/rljQkiJyRckGkWpu7BRDXXl3qcOuzruTqcG3YPZZq5DCk2YeCpTyTk3jVEA7o Mc/BkfmMn8VDMYZz1i2ZFgJiQMOGRcQLPMtgh1c/fR3p4Jcp9pF2kXsSRcapEK0e2TYNUs3WdIOEd hhwe8oOyP9p711Zah6iA==; 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 1iLWU8-0003Vy-AO; Fri, 18 Oct 2019 17:56:20 +0000 Received: from mail-vk1-xa44.google.com ([2607:f8b0:4864:20::a44]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iLWU5-0003V5-A8 for linux-arm-kernel@lists.infradead.org; Fri, 18 Oct 2019 17:56:18 +0000 Received: by mail-vk1-xa44.google.com with SMTP id s21so1564002vkm.0 for ; Fri, 18 Oct 2019 10:56:17 -0700 (PDT) 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=aIsMVriT4AZEDHIxtRQpfA6TPy6WxstpPPQy/ZvUwbM=; b=olkgjhwOKrpksh8vSJf+BJb84VfRZZ5qdUP2pzmiiZqrTACZC/i9cIiYRJgmne3ziR ko66mflPJkhk5jRiXb4zXEhdS1luvFe71S6s42yUYccUIDR8gcNMfCwXyOIkQ0Gko0RV 9DDeaxIiSdr21FNjzVaFcXZqf9tjWZCrcL3qRov3yEgYNBhQlxpD7Y0HCFIxH9vXebne d7Vy0l+kXyB43SqiIgm7oTgLYpW6N+mFXKF9Zj9op9b/+csye2MIB4a6S4IXkCsA5zcb Kzwwm71iR1gVBxrHRBPCIqcw4pJfaGoi5yVhy4PX7/KiLlr7HDA6C7r7OOtLcEsTVBPf YuXw== 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=aIsMVriT4AZEDHIxtRQpfA6TPy6WxstpPPQy/ZvUwbM=; b=r0zHydUIT1nGJ9yi+2mgEb3Q+V5+xXOgtOCCHZzJ/l0Tw22hKUeZQn2FT46P7SpgKT b7Z2N+91SJ8bBQ3uma6RXi+aoYVeR3RKabjwJAPt3hJExR7VPyR08BL8sJ+SxJ6YK+CX CC3n4mpzJrmRbxE7i4s4nF8ouCO+YbUwaqf+Ey/9gQoUaLFN4MvylX1dKKw4anx+gbb9 OWmkgxmuHyHdB14AkfA0zxDp+nkML7It9Tog2Ws5zXnDueOTUCB/WMjP/Re6VWAWNGIW AHK2MhUGjbBCVdOJbSKrQSJgDikqBLESeqeyir7BgfdiYr8klp9jb2Jj5hAcJx8QKEgn sbMw== X-Gm-Message-State: APjAAAWoveaK5XPgZRVujUUkZVUpSg7iSx7ADkNYOxDyrNYwMoo2s3wU slqtsE3ytaCzOwL3mqe48VoVYQsH7O43wgVrWQFMbA== X-Google-Smtp-Source: APXvYqyC2iv6T46643JVohCL0ZO6S+yxoXkbTD3puL0IDt0JZj5qGElfVp/07Oy94Ct1iZ+6cOvAdXJjbpJUq0GhLYM= X-Received: by 2002:a1f:b202:: with SMTP id b2mr6023283vkf.59.1571421375752; Fri, 18 Oct 2019 10:56:15 -0700 (PDT) MIME-Version: 1.0 References: <20191018161033.261971-1-samitolvanen@google.com> <20191018161033.261971-7-samitolvanen@google.com> In-Reply-To: From: Sami Tolvanen Date: Fri, 18 Oct 2019 10:56:04 -0700 Message-ID: Subject: Re: [PATCH 06/18] add support for Clang's Shadow Call Stack (SCS) To: Jann Horn X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191018_105617_377032_77EBEE04 X-CRM114-Status: GOOD ( 12.97 ) 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 , Catalin Marinas , Kernel Hardening , Nick Desaulniers , kernel list , Steven Rostedt , clang-built-linux , Laura Abbott , Will Deacon , 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 Fri, Oct 18, 2019 at 10:42 AM Jann Horn wrote: > (As I mentioned in the other thread, the security documentation there > doesn't fit the kernel usecase.) True. I'll add a note about it here too. > Without CONFIG_SHADOW_CALL_STACK_VMAP, after 128 small stack frames, > you overflow into random physmap memory even if the main stack is > vmapped... I guess you can't get around that without making the SCS > instrumentation more verbose. :/ That's correct. In our testing, 128 stack frames is nearly twice the maximum amount that's been used (on an arm64 device), and for many use cases, allocating a full page is simply too costly despite the advantages. > Could you maybe change things so that independent of whether you have > vmapped SCS or slab-allocated SCS, the scs_corrupted() check looks at > offset 1024-8 (where it currently is for the slab-allocated case)? > That way, code won't suddenly stop working when you disable > CONFIG_SHADOW_CALL_STACK_VMAP; and especially if you use > CONFIG_SHADOW_CALL_STACK_VMAP for development and testing but disable > it in production, that would be annoying. Yes, that's a great idea. I'll change this in v2. Sami _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel