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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6BD1C4167B for ; Fri, 8 Dec 2023 20:57:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235894AbjLHU5h (ORCPT ); Fri, 8 Dec 2023 15:57:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235979AbjLHU5d (ORCPT ); Fri, 8 Dec 2023 15:57:33 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 841771738 for ; Fri, 8 Dec 2023 12:57:39 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1d0a7b72203so22390275ad.2 for ; Fri, 08 Dec 2023 12:57:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1702069059; x=1702673859; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Tys/vW6TJrvqB1xe5pT6Lgn/PsDKvZ4BwsQlECLsYBs=; b=PRTW3BZCfbXCMbIbbjF0R2L8LA7Rn1g9VuJIVK5dZwH/WiNsRPjf/4jsvdnNXVJdlw eNquk2M244ZrHbTzsS4ZDV/0qCadMIZXIQb9drDLfvjfeJ9jDxh2MrcbC9awGCXYKjqY RpjbVGc0c8Ssr9nw3Nf55/N4DPq1EuKooGaf4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702069059; x=1702673859; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Tys/vW6TJrvqB1xe5pT6Lgn/PsDKvZ4BwsQlECLsYBs=; b=kfzQfsqk9Kc8lraohtJvetRUa/X7/L0ZdxqJtPEjbOGjrkswcnnE9DsHsg3Hp3mGqI VWFnNwroJC6uiYx+20fZjAnX0Fub6hgQXEPPg4Gqrf8FcEIP4nOTiTGJFiVhqOrWBEgJ SzQOlDM7pOdv+1ozqL3g3YvISnAefMTl8bVQhDFvlNKtvjd3xiKkW4ZOuxBxqrcxrMw6 Fl8kM7XY8fpDPDfEb6rpnhtTf8MSdHJ+U6/dnQZL8v8IhYmebp6N0PJboyX0DDQsKBz0 TYCWUOeVNzHX9BNd+8MT2jHDa+o0QK6rkUwBUkDLGXrxUVqpzHiVIVLsklEF83GCJZRe 2E9Q== X-Gm-Message-State: AOJu0YxnZF5T18DnE2o0MwdTB1O5N9gBNICAjkNyg+EkRSdI1wiBucMJ 9y9JhV5Ef5YzQFtryssCNz9tuA== X-Google-Smtp-Source: AGHT+IGBI3DTSz3M2P/N3EoKLc20ALho3WNNQ9FkBDmD8W5/Jq1bLWYaPm1D7IkQUUnQMxuOVi4Hng== X-Received: by 2002:a17:903:2585:b0:1d0:6ffe:9f1 with SMTP id jb5-20020a170903258500b001d06ffe09f1mr611230plb.79.1702069059024; Fri, 08 Dec 2023 12:57:39 -0800 (PST) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id 21-20020a170902ee5500b001d0511c990csm2131874plo.237.2023.12.08.12.57.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 12:57:38 -0800 (PST) Date: Fri, 8 Dec 2023 12:57:38 -0800 From: Kees Cook To: Peter Zijlstra Cc: Miguel Ojeda , Alice Ryhl , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Alexander Viro , Christian Brauner , Greg Kroah-Hartman , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Carlos Llamas , Suren Baghdasaryan , Dan Williams , Matthew Wilcox , Thomas Gleixner , Daniel Xu , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v2 5/7] rust: file: add `Kuid` wrapper Message-ID: <202312081251.A5D363C0@keescook> References: <20231206-alice-file-v2-0-af617c0d9d94@google.com> <20231206-alice-file-v2-5-af617c0d9d94@google.com> <20231206123402.GE30174@noisy.programming.kicks-ass.net> <20231206134041.GG30174@noisy.programming.kicks-ass.net> <20231208165702.GI28727@noisy.programming.kicks-ass.net> <202312080947.674CD2DC7@keescook> <20231208204501.GJ28727@noisy.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231208204501.GJ28727@noisy.programming.kicks-ass.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 08, 2023 at 09:45:01PM +0100, Peter Zijlstra wrote: > On Fri, Dec 08, 2023 at 10:18:47AM -0800, Kees Cook wrote: > > > Even if we look at the prerequisites for mounting an attack here, we've > > already got things in place to help mitigate arbitrary code execution > > (KCFI, BTI, etc). Nothing is perfect, but speculation gadgets are > > pretty far down on the list of concerns, IMO. We have no real x86 ROP > > defense right now in the kernel, so that's a much lower hanging fruit > > for attackers. > > Supervisor shadow stacks, as they exist today, just can't work on Linux. Yeah, totally agreed. I still wonder if we can extend KCFI to cover return paths (i.e. emitting cookies for return destinations and doing pre-return cookie checking for return destinations). > Should get fixed with FRED, but yeah, this is all somewhat unfortunate. Agreed. > > As another comparison, on x86 there are so many direct execution gadgets > > present in middle-of-instruction code patterns that worrying about a > > speculation gadget seems silly to me. > > FineIBT (or even IBT) limits the middle of function gadgets > significantly. Right -- for indirect calls we are at least able to restrict to same-prototype (KCFI) or "actual function" (IBT). Regardless, for the case at hand, it seems like the Rust wrappers are still not "reachable" since we do BTB stuffing to defang these kinds of speculation gadgets. -Kees -- Kees Cook