Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3390536ybz; Mon, 27 Apr 2020 15:11:32 -0700 (PDT) X-Google-Smtp-Source: APiQypLmCy3vzs5Jxhe07HisJqltVvX4mmoK5EzKptHxqVP4n374/Dm8eWb7Ji405HlDHkAEcJE6 X-Received: by 2002:a05:6402:6cb:: with SMTP id n11mr20716459edy.210.1588025492573; Mon, 27 Apr 2020 15:11:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588025492; cv=none; d=google.com; s=arc-20160816; b=RZmK1LW6TUYvb4S7hdSC5l069QRGzSwu0OmQNT2HSioyMJu9eolsy3Sf9u9c1aid9a 3HixjBDwy++a+lBle1ofpeZ1E7NHrGCSFEOtEmw5Ku7qsTWS2qew8oW54UNeNBX9YGIU naEx6bTcLQ7hBwsQZAlxO2A5Ynu3Wqm5eIakwUZnJnk1TzZ+occDU0XXjHh4/5qlLJlp bL3cETq80jzwuGeWSnr7FpGO8InEU8QTkF5QENawz6hkD4+Ph1QpsgQEbVFd+j1IXra7 /WWjcLdugAAYLQS0j5LVw+0Nc34Pt/zPI0ZOJ9JarF7YetxyzE/Z3A67h1HpQtfcnrc0 X8ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Xe8RUkEJu/E4jWUvQIevudFni0eW89aFKGU5bjDlftc=; b=hADbUqSw0dzjzmUL3E+xZ/mbV+sR39n13Dr2IG14k/dqP+hNPVhJA1cIuebBAfPe1X /HHpgjBV9raUCEdMPuWGZ9/2jiAuItcczcm/VXu2KUiQnHdlEvQK1ifZs01WA603fQ1V vQzmF5kwV1XaNz3jMop5dbj9s5RbROuTN8cDGpgjMP3S/CZbOGGoY0f9W5rNM8qcLZst 9OalJJO5/qckjhH7bqa39WOCeecWaVVNhZi2os6DUcLySu2YsL3tfQqzeTYwbne4szJz eAM4M2k8lDFc0gMKMk3mSwUKb525o3l8V0X6GrjQ4MHdA8e3mPRfgoOqPriVcspqx+lP jvFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=axOblyzY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id d9si579846ejb.387.2020.04.27.15.11.10; Mon, 27 Apr 2020 15:11:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=axOblyzY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726264AbgD0WJv (ORCPT + 99 others); Mon, 27 Apr 2020 18:09:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726182AbgD0WJv (ORCPT ); Mon, 27 Apr 2020 18:09:51 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E430FC0610D5 for ; Mon, 27 Apr 2020 15:09:50 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id 18so8451689pfv.8 for ; Mon, 27 Apr 2020 15:09:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Xe8RUkEJu/E4jWUvQIevudFni0eW89aFKGU5bjDlftc=; b=axOblyzYYZwm23zJs/yIhW4AiXhyGbo1u4AhSQWZk6aCS3SbgYhrO3uxU/GIgXJe+R lZFY51Gu9ZAm1+Wx8ojNeFt262o3xlrjkkPW0UDsqW7aQHJ1kxx3GUTkZZ+SHEwEx4sj qIXCdTHxBwmKDJGtD8EE1vu3RoM8rdzvr7zJDbahVKaFbLW3BvoGBtbrg30QQDm9ZjL4 NPsfDMvwSpCub92zGM4zYe+Jb2mMQ9YPQ+DnbHm8ALegArlm8BVMTVmhVxMj9B3OIDe9 C66WGlEQ/5l6bbT1mq3LFfU7EdwlU0npz53O3fl3EQgOzkoYeSp2jk4DOPWs1j31cN1R XZyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Xe8RUkEJu/E4jWUvQIevudFni0eW89aFKGU5bjDlftc=; b=FCcVLYZ6mTyfcqf5VELLYt6ClwxnrsvNRPJcqdl/fEtL8C/LWJ21x7PhcHJswMxdBv 5Q1d2kgs5K0niBi7SCzWDlQMnyOzNUZEdySbjlpwMAwA0EyJy7YThUYOgWOpxwhBg27o xVVsbGfDcDgtXFooA1TsGHsEJ3J8odwx+Carpv2fFJjry8lFVEBhqYEEGLMZ/g7ufrbf tmsMOJXqsUKyLFT9r3EebfxALWMVgfjoKDdw76piPGML+smXJ8/sXDj/Ej8KleuxIDEL UY6ziIfM5fy8Dth7q79BM+h6/JPWYyIKkjx3vGEVg42QpEscAKZtamt3FgmXCmW3jEtA CZGw== X-Gm-Message-State: AGi0Pub0pHVo7Ufgyndwh0ULliBL1dfh1MbidHqOgA+fCvSttSkYhlDz IrsCB5nbrjp4yDuI0aak8KWTFQ== X-Received: by 2002:aa7:951a:: with SMTP id b26mr25384503pfp.44.1588025389927; Mon, 27 Apr 2020 15:09:49 -0700 (PDT) Received: from google.com ([2620:15c:201:2:ce90:ab18:83b0:619]) by smtp.gmail.com with ESMTPSA id l8sm3554016pga.60.2020.04.27.15.09.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 15:09:49 -0700 (PDT) Date: Mon, 27 Apr 2020 15:09:42 -0700 From: Sami Tolvanen To: Ard Biesheuvel Cc: Will Deacon , Catalin Marinas , James Morse , Steven Rostedt , Ard Biesheuvel , Mark Rutland , Masahiro Yamada , Michal Marek , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kees Cook , Jann Horn , Marc Zyngier , kernel-hardening@lists.openwall.com, Nick Desaulniers , Linux Kernel Mailing List , Miguel Ojeda , Masami Hiramatsu , clang-built-linux , Laura Abbott , Dave Martin , Linux ARM Subject: Re: [PATCH v13 00/12] add support for Clang's Shadow Call Stack Message-ID: <20200427220942.GB80713@google.com> References: <20191018161033.261971-1-samitolvanen@google.com> <20200427160018.243569-1-samitolvanen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 27, 2020 at 10:50:34PM +0200, Ard Biesheuvel wrote: > > OK, so one thing that came up in an offline discussion about SCS is > > the way it interacts with the vmap'ed stack. > > > > The vmap'ed stack is great for robustness, but it only works if things > > don't explode for other reasons in the mean time. This means the > > ordinary-to-shadow-call-stack size ratio should be chosen such that it > > is *really* unlikely you could ever overflow the shadow call stack and > > corrupt another task's call stack before hitting the vmap stack's > > guard region. > > > > Alternatively, I wonder if there is a way we could let the SCS and > > ordinary stack share the [bottom of] the vmap'ed region. That would > > give rather nasty results if the ordinary stack overflows into the > > SCS, but for cases where we really recurse out of control, we could > > catch this occurrence on either stack, whichever one occurs first. And > > the nastiness -when it does occur- will not corrupt any state beyond > > the stack of the current task. > > Hmm, I guess that would make it quite hard to keep the SCS address > secret though :-( Yes, and the stack potentially overflowing into the SCS sort of defeats the purpose. I'm fine with increasing the SCS size to something safer, but using a vmapped shadow stack seems like the correct solution to this problem, at least on devices where allocating a full page isn't an issue. Sami