Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp5412490rwb; Wed, 17 Aug 2022 17:35:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR42n1XTOmKLVW+qcvrpyb5bDOA6xx/ChFLU8X1MH4Q3rbGS36IfcDbAgdAdk+EnsO+rLtYJ X-Received: by 2002:a17:907:a218:b0:731:5e2c:c28a with SMTP id qp24-20020a170907a21800b007315e2cc28amr323480ejc.472.1660782936299; Wed, 17 Aug 2022 17:35:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660782936; cv=none; d=google.com; s=arc-20160816; b=RCAfMoeOh9NLb/bE455YxoeD6v2/Xh0bzWvixNmbYYLtFPr6K++cv8wUWGQLFmNX84 d8ushblQEsf36K0GvTGaDoy77SmiTDl6Bzc+UPBeeAZevZ2uW6c060A78z3XEtsfNHWQ 4ulzZpIvl/Nyfr1DkQbsvtHZF3hvjA013uV57I4Siz/5PH0Gbjf3uK6w21+iwnRE7aQ+ /C2FVPneLkJM7Mc6iOZAfyv9RlLOESzswc7FVLa0afkiJE55Ngvrf+Ljh1cmIA+GBJ8p tdnKyLDKtsHgzJCJsYoZRbOodFrDbodllIwspRr/lbQretSEvju2Axg8ctu6GaZXckfj lRmQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4OrW2+v/meyruGyW+F7E0QxnRsOWY9DMbrVML0RCO4M=; b=QWMoK+SUcdPkZT93UlUic03yoVhrz5mDDHWOFj8iGqRM6XaDgT8XepLKppZ2/zv5FZ jyo/ZwpItf7IswPiX9Y61wjhSd7IZu1HIcWe3p93v0awWN52ImifJREM/t+srdOTsZg5 nHpJHSbmTXk1SDbJdhOElrv9wbXflS0BuIr6aP1UmCOMsleVRKH/yOlHB8VcI/XU977A GTcfWAwrO8j2CiarLExcB5mCs+K1Y++UbWnuRcXh57ym7NZ07uhmf3e46cUXxNIcwOZ7 vPFAD2kHzG1lryJKEkGzSPL9HK7cVZJaGDQl315rn4TxGU3CTQgucD/RNig0jP7xR5gU Rwpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SW70luAx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020aa7c907000000b0043e8b2ed68esi101573edt.605.2022.08.17.17.35.10; Wed, 17 Aug 2022 17:35:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SW70luAx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S241909AbiHQX4I (ORCPT + 99 others); Wed, 17 Aug 2022 19:56:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233620AbiHQX4F (ORCPT ); Wed, 17 Aug 2022 19:56:05 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADB9E792D4 for ; Wed, 17 Aug 2022 16:56:04 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id s31-20020a17090a2f2200b001faaf9d92easo3202881pjd.3 for ; Wed, 17 Aug 2022 16:56:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=4OrW2+v/meyruGyW+F7E0QxnRsOWY9DMbrVML0RCO4M=; b=SW70luAxBAxmWF0xbo0vvoN6D+BfN/5VNbgtgMfh2yWVHK27yb+gRXhrCitMsILst6 gd/i/FD7DU/GC9P22lC3CrE9jHgYvTSOlzKpjrsH/HNz8kK2s0HOT1TWY2m3B/AFQ5mQ ZkPwYxipcmkEq6CmCLwOLx4fAHP1DCRj2y/aQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=4OrW2+v/meyruGyW+F7E0QxnRsOWY9DMbrVML0RCO4M=; b=JuWfEUhII1deAMHV4RVvZXfXbXVo1n3Q29OLomcY9SwRH2oga/wswYxRtA3oFYM+sa /IoiYH6xcYs0s8VYLygKExTJzXNdxOkGrw0RsC0vA0b01bsOwvLr1ySVS8wgJgm0dOrl dJjFOZgz2g0p8O1cvso1lzOhz2g+biMS1+26br/001ZbPGjhIEhOioxIjfGBQRIyazTZ D5/sO3XP2u4GSbSTz9NSw3LFDoVf52ZUPEE0a2XUNCP4m4u8DvWz+sGMKvUY1EesCGgC iG0MJ2GK44Wieu9fK/6i7rE9Oz0DyYg5KBIjlI7gNgayoSfyyqQJxzlFrIogTRtY5Umu j9HQ== X-Gm-Message-State: ACgBeo381ZIY3HgS8HIBeMLt2ty9X21dFYreVZ84Y/8QH2nS9565EyNC ZDge5NDT0pOfG5Ln+Jva4A0X2g== X-Received: by 2002:a17:90a:1b6e:b0:1f5:1902:af92 with SMTP id q101-20020a17090a1b6e00b001f51902af92mr6148774pjq.238.1660780564166; Wed, 17 Aug 2022 16:56:04 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id n1-20020a1709026a8100b0016d33b8a231sm459784plk.270.2022.08.17.16.56.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 16:56:03 -0700 (PDT) Date: Wed, 17 Aug 2022 16:56:02 -0700 From: Kees Cook To: Miguel Ojeda Cc: 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 , Geoffrey Thomas , Wedson Almeida Filho , Sven Van Asbroeck , Gary Guo , Boqun Feng , Maciej Falkowski , Wei Liu , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron Subject: Re: [PATCH v9 06/27] rust: add C helpers Message-ID: <202208171653.6BAB91F35@keescook> References: <20220805154231.31257-1-ojeda@kernel.org> <20220805154231.31257-7-ojeda@kernel.org> <202208171240.8B10053B9D@keescook> <202208171331.FAACB5AD8@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 17, 2022 at 11:44:53PM +0200, Miguel Ojeda wrote: > On Wed, Aug 17, 2022 at 10:34 PM Kees Cook wrote: > > > > Gotcha -- it's for the implicit situations (e.g. -C overflow-checks=on), > > Yeah, exactly. > > > nothing is expected to explicitly call the Rust panic handler? > > If by explicitly you mean calling `panic!()`, then in the `kernel` > crate in the v9 patches there is none. Perfect. It may be worth stating this explicitly with the helper. i.e. "This is for handling any panic!() calls in core Rust, but should not ever be used in the 'kernel' create; failures should be handled." > Though we may want to call it in the future (we have 4 instances in > the full code not submitted here, e.g. for mismatching an independent > lock guard with its owner). They can be avoided depending on how we > want the design to be and, I guess, what the "Rust panic" policy will > finally be (i.e. `BUG()` or something softer). > > Outside the `kernel` crate, there are also instances in proc macros > and Rust hostprogs/scripts (compilation-time in the host), in the > `alloc` crate (compiled-out) and in the `compiler_builtins` crate (for > e.g. `u128` support that eventually we would like to not see > compiled-in). Sounds good! -Kees -- Kees Cook