Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp496777rdg; Thu, 12 Oct 2023 11:31:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHbGWQjMxY4fxVwa8DFCc/LCs3EXqEZpMqdl53Eem+fdoCe9V9005UKtbs4z0BKoxloUDEA X-Received: by 2002:aa7:88ce:0:b0:68f:d864:596 with SMTP id k14-20020aa788ce000000b0068fd8640596mr28195052pff.3.1697135501147; Thu, 12 Oct 2023 11:31:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697135501; cv=none; d=google.com; s=arc-20160816; b=WeuLtaJmf9/Nqjd+eEYi1ku1MG79ejqpZH4IqAy+BPhOrbCw6+fkAQ596E4OQDbP3g O4kiVszfhFzsLuH9fko52xjbNgwuBRWqZyjUwi2JN+5gj5Y+bN5lt/un44+pCr71J2FN rHcsBiRYoR52+F+7qF1ZLoB1be7jLPtd3zYk3+u7BHaa9ZieVwA0rFS3CYmmb4s+34NM ebseRRiQwsw655H/3vmDx9RjLr1/Uzd7cg5PQjarcQ1RUPQJeXGbg/yJODgryZi++Rut TlGsNo0EM0sX6rt9dkQT6c1kXF5S3RUof2aaYZsXy/PMx0KucZBcE/JYwzJPsEJZWFmw ox7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=kmUopNj4SKl1oz8w54FsmEGmf+2bTIjcRS6uvAC4XKo=; fh=fRE+1E3MQxrG/RldgP4dzEKwmcoZT9lFO/wv3A3LPzU=; b=JYzeBvR0DlY504hUVnOeELHgvSoa7r8NWMYgh9lF3C6lOp22L9tztea8GeDoiXunMj +ITH88OY6dzFDC7GvLyoIaMybR/g7/E0COS5tZ/U+FCrH8jOuE6+YdZNgapdIt39EHuE +DuMaxZaWMq+6OPPRbHAdpoLvvv1bTNQKQ8qH2JqjQP+aNWZHCnaE2ItUOgdpAhNpvV8 3l+eR0401rWaCcmEE1BpY04GjsKd/gO+g2qg3O8LjjdgstJSnmSwoE+Soo9Dm9KZdTWb v/0uLWysaWXd5/iEtp21etnhIv3W4cyiNSveSc1aoa6YU5sbwRvEpr8F/+ZONcY7IFV8 P/0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nMRJwDb7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id q15-20020a056a00084f00b00690ca3d66bbsi9191726pfk.262.2023.10.12.11.31.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 11:31:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nMRJwDb7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id ABB3880254C1; Thu, 12 Oct 2023 11:31:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379624AbjJLSba (ORCPT + 99 others); Thu, 12 Oct 2023 14:31:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379577AbjJLSb3 (ORCPT ); Thu, 12 Oct 2023 14:31:29 -0400 Received: from mail-oo1-xc2d.google.com (mail-oo1-xc2d.google.com [IPv6:2607:f8b0:4864:20::c2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CC2DC0 for ; Thu, 12 Oct 2023 11:31:26 -0700 (PDT) Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-57b74782be6so690681eaf.2 for ; Thu, 12 Oct 2023 11:31:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1697135485; x=1697740285; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=kmUopNj4SKl1oz8w54FsmEGmf+2bTIjcRS6uvAC4XKo=; b=nMRJwDb7lLq45Vq56/8oKuRCxXSym2fA17TvfEEtl/Np1rAVXrvr5bzD7D+wvTe1di YfigpvNCXV18e2daBOAOTx+fJ2SiKYJKRg5xNJD/NZTwgAOlQeuGIM6Vs/d8DnVeNvjU 66LpLgCt+Y7EwbE+V43RmcPQUUuf3MqLj/hwQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697135485; x=1697740285; h=in-reply-to:content-transfer-encoding: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=kmUopNj4SKl1oz8w54FsmEGmf+2bTIjcRS6uvAC4XKo=; b=eYMy5lTgkk9gfyhxyPlxacJ91zUV77bYv7cOToWD1w5KhioznI3Zha7HLfpyaSyW0g dX20VYo6n+JzIVbKau7xjwOTSrIMdGhOmE/sYWgafC9EDZwcU6Sif+Sq7y6dj/WhCsPT gMX0KWp0y3buCMbAQqg5LkA6d/QlKLv3wqE374hRxxqTaa4Dv8FKxC9/kRwnO9t7MLQp yKLA3dGKfrTV5ulQKFxbvDz0nIGhzHGbInxW7nOW3zui7Y8FUtHSO/YG8ygU42kEPEKq KED/rZI/mVd9GB2rKQ+GTZay2wcvrVzKOG/tLsOcswUTB/SL+sCU1R33fyyRflXrWAml eXOg== X-Gm-Message-State: AOJu0Yyy+XSvQDnftWpfbUf6zj1WLVKnguhCZXM1UpBh307A6Ry7m0By m0jLt894d+ZPd0YcMt+rhBrd7Q== X-Received: by 2002:a05:6358:52c5:b0:14c:4411:2f4b with SMTP id z5-20020a05635852c500b0014c44112f4bmr32545120rwz.22.1697135485618; Thu, 12 Oct 2023 11:31:25 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id x3-20020aa793a3000000b0068a54866ca8sm12088064pff.134.2023.10.12.11.31.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 11:31:25 -0700 (PDT) Date: Thu, 12 Oct 2023 11:31:16 -0700 From: Kees Cook To: Sami Tolvanen Cc: Peter Zijlstra , Miguel Ojeda , Miguel Ojeda , Linus Torvalds , Greg Kroah-Hartman , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, patches@lists.linux.dev, Jarkko Sakkinen , Alex Gaynor , Wedson Almeida Filho , David Gow , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-doc@vger.kernel.org Subject: Re: [PATCH v10 25/27] x86: enable initial Rust support Message-ID: <202310121130.256F581823@keescook> References: <20220927131518.30000-1-ojeda@kernel.org> <20220927131518.30000-26-ojeda@kernel.org> <20231012104741.GN6307@noisy.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 12 Oct 2023 11:31:38 -0700 (PDT) On Thu, Oct 12, 2023 at 10:50:36AM -0700, Sami Tolvanen wrote: > On Thu, Oct 12, 2023 at 3:47 AM Peter Zijlstra wrote: > > > > On Fri, Oct 14, 2022 at 11:34:30AM -0700, Sami Tolvanen wrote: > > > On Fri, Oct 14, 2022 at 11:05 AM Miguel Ojeda > > > wrote: > > > > > > > > On Tue, Oct 11, 2022 at 1:16 AM Sami Tolvanen wrote: > > > > > > > > > > Rust supports IBT with -Z cf-protection=branch, but I don't see this > > > > > option being enabled in the kernel yet. Cross-language CFI is going to > > > > > require a lot more work though because the type systems are not quite > > > > > compatible: > > > > > > > > > > https://github.com/rust-lang/rfcs/pull/3296 > > > > > > > > I have pinged Ramon de C Valle as he is the author of the RFC above > > > > and implementation work too; since a month or so ago he also leads the > > > > Exploit Mitigations Project Group in Rust. > > > > > > Thanks, Miguel. I also talked to Ramon about KCFI earlier this week > > > and he expressed interest in helping with rustc support for it. In the > > > meanwhile, I think we can just add a depends on !CFI_CLANG to avoid > > > issues here. > > > > Having just read up on the thing it looks like the KCFI thing is > > resolved. > > > > I'm not sure I understand most of the objections in that thread through > > -- enabling CFI *will* break stuff, so what. > > > > Squashing the integer types seems a workable compromise I suppose. One > > thing that's been floated in the past is adding a 'seed' attribute to > > some functions in order to distinguish functions of otherwise identical > > signature. > > > > The Rust thing would then also need to support this attribute. > > > > Are there any concrete plans for this? It would allow, for example, > > to differentiate address_space_operations::swap_deactivate() from any > > other random function that takes only a file argument, say: > > locks_remove_file(). > > I haven't really had time to look into it, so no concrete plans yet. > Adding an attribute shouldn't be terribly difficult, but Kees > expressed interest in automatic salting as well, which might be a more > involved project: > > https://github.com/ClangBuiltLinux/linux/issues/1736 Automatic would be nice, but having an attribute would let us at least start the process manually (or apply salting from static analysis output, etc). -Kees -- Kees Cook