Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2079616ybz; Thu, 23 Apr 2020 11:12:23 -0700 (PDT) X-Google-Smtp-Source: APiQypIDZlP+H3guz22PibKsjj823bo8Xo5XFWnh6heBO87XJc2t5e32My6IPOx8Jy/yq4iIh1nJ X-Received: by 2002:a05:6402:1d38:: with SMTP id dh24mr4050848edb.9.1587665543149; Thu, 23 Apr 2020 11:12:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587665543; cv=none; d=google.com; s=arc-20160816; b=qEKv3KALbUteRioSQ9t3VLmjzhrYUnZbnOfKB8OwGDOIgnKwQ82w6PJeP656Ca3Q/G WSuCPb2cmaXblg/gv9NT5ZaLhxdv1tTSf72BBQ6bDrjZm6/JtYSDb3H2VUcQxx9ORykf Q4rL3vaTGiHjg9IYauJ6cmzn+gcH7KYOrfdbuIpyTCqfReVNUXPqOisLb46XlkfaJMYv vYLS85k3uEEJpLLOztwrgAcdFj9nhC7/lQjDURJ4Lj2WCHABbYgLcNJ5L1UB4T10jo7I yrq/ex3Q+omaxyrS2fHRLpxTQuk5vD2XOIWsMU1lPuyMJ1AkieljQwZIWrSPns/sKW/X FKzA== 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=KWVTVR9QPt8YpEnS6+rG3cx9IAZdQ2Peqca4Ud6UmSY=; b=IeRpZPzGhhKQQSGQJ6L44YOUFSK5FAf1O7XLFEO3h72xU4WwgIGg7BCwcFL5002sQC XU7oR1KI2akbXAvSvsnV0++Y7rkPs2LQdnQefllqlnM+6ZyrHCiubKu8dWEq1Kkj2wiF A70cs5lCPQ4zMORvs73LF/nX0mxMfrzkLXI92vsCUQIiykLOQq3KlEw92DoCo5hCt9qS 3ZNYMqP+HkXXQTYNX9Sp6oeixNV+AnBObx7qqbQkM9xnIiHXRDMFlsw6SsJSQNbkq/MW CEicQeGoczHgww2L+m3SaGxjz+fYQ9+gP2KgVR82OznpW53rQcax6pBWBHurkAetq0qk Ti+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CdFotNnq; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u18si1403546ejx.502.2020.04.23.11.11.56; Thu, 23 Apr 2020 11:12:23 -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=@chromium.org header.s=google header.b=CdFotNnq; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730074AbgDWSJ2 (ORCPT + 99 others); Thu, 23 Apr 2020 14:09:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729995AbgDWSJ1 (ORCPT ); Thu, 23 Apr 2020 14:09:27 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D972FC09B042 for ; Thu, 23 Apr 2020 11:09:27 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id d17so3292731pgo.0 for ; Thu, 23 Apr 2020 11:09:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=KWVTVR9QPt8YpEnS6+rG3cx9IAZdQ2Peqca4Ud6UmSY=; b=CdFotNnqSpurMKkIu6CgBx6OkkmuS4dmePbH5JYO6Yb24rHfaG6bv/j6W3gwVuvGlR 64PbSSNPaH8ceQMVqvMs5BZdL4WabMg/+3TPoVNadaUwZ1CIY5Ft1srs/S6AInLWxtLR iKNcf7yWw+tp7Mv+in+N3g014ylhLnJOJ++nc= 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=KWVTVR9QPt8YpEnS6+rG3cx9IAZdQ2Peqca4Ud6UmSY=; b=mPdczvYm+5zJAcLxfcXc6PFPyFSyKigl7PL3wdFA6b88VnoIFt3Rgnbi0eaW59AOrS IsjkxVxypbaujGs1m0hKXKCTAD6l1re0WcteuhtLG9QhzOeR6scr9bVEsKduLKPxbKsf ggDtqXobPJQth4IQ+2gQt1B8QRzZYU4ETX4ynLQemK0Oudc6YmJAo5X42kGcF9C3uc5y ccsiZ8/dOcYUcWQJUGk+Vf1gcj/z6OH88r/i+WYi/7kDWROcMW9qp4fD/e7GAmmOhdE+ A5SvWvWmU5jSK0H2OzkUNvU0JMWXOcNVVy1mrdqaBg9zNDswlOFvUSQgbMBCS7XY1gY/ HLPw== X-Gm-Message-State: AGi0PuYPJykMOwqsKVmY8ALoAx+wbJV50so+/9oaJvRS/RquLzv6/Qxn OUHbMJ0+8vGWQjUKr464RcACJw== X-Received: by 2002:a63:5c01:: with SMTP id q1mr4899728pgb.177.1587665367464; Thu, 23 Apr 2020 11:09:27 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d184sm3152431pfc.130.2020.04.23.11.09.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 11:09:25 -0700 (PDT) Date: Thu, 23 Apr 2020 11:09:24 -0700 From: Kees Cook To: Will Deacon Cc: Sami Tolvanen , Catalin Marinas , James Morse , Steven Rostedt , Ard Biesheuvel , Mark Rutland , Masahiro Yamada , Michal Marek , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dave Martin , Laura Abbott , Marc Zyngier , Masami Hiramatsu , Nick Desaulniers , Jann Horn , Miguel Ojeda , clang-built-linux@googlegroups.com, kernel-hardening@lists.openwall.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v12 01/12] add support for Clang's Shadow Call Stack (SCS) Message-ID: <202004231108.1AC704F609@keescook> References: <20191018161033.261971-1-samitolvanen@google.com> <20200421021453.198187-1-samitolvanen@google.com> <20200421021453.198187-2-samitolvanen@google.com> <202004221052.489CCFEBC@keescook> <20200422180040.GC3121@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200422180040.GC3121@willie-the-truck> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 22, 2020 at 07:00:40PM +0100, Will Deacon wrote: > On Wed, Apr 22, 2020 at 10:54:45AM -0700, Kees Cook wrote: > > On Mon, Apr 20, 2020 at 07:14:42PM -0700, Sami Tolvanen wrote: > > > +void scs_release(struct task_struct *tsk) > > > +{ > > > + void *s; > > > + > > > + s = __scs_base(tsk); > > > + if (!s) > > > + return; > > > + > > > + WARN_ON(scs_corrupted(tsk)); > > > + > > > > I'd like to have task_set_scs(tsk, NULL) retained here, to avoid need to > > depend on the released task memory getting scrubbed at a later time. > > Hmm, doesn't it get zeroed almost immediately by kmem_cache_free() if > INIT_ON_FREE_DEFAULT_ON is set? That seems much better than special-casing > SCS, as there's a tonne of other useful stuff kicking around in the > task_struct and treating this specially feels odd to me. That's going to be an uncommon config except for the most paranoid of system builders. :) Having this get wiped particular thing wiped is just a decent best practice for what is otherwise treated as a "secret", just like crypto routines wipe their secrets before free(). -- Kees Cook