Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1116406rwb; Tue, 27 Sep 2022 08:36:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7O+l8z56CQs7W7BMa8cLoMHVt7F3M1M4M4x4+NCOCp/+S8IEuDyMMqxaArAsGtHqGwMLNd X-Received: by 2002:a05:6402:1449:b0:457:cf1e:9fe2 with SMTP id d9-20020a056402144900b00457cf1e9fe2mr1502307edx.205.1664292998216; Tue, 27 Sep 2022 08:36:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664292998; cv=none; d=google.com; s=arc-20160816; b=v0xyH2UtW68LEMhbEER+paw5APSvkz9Ws8hn8GlOkLR3hvrTyx+jTE2ZWPLAi++YvA /OqSLI4KR3MaYLUfFRBzx+O7N/k/AEVCJQOTukWIsMo88hHr+vxgKQVBeGRd1Ui6hOZe G395cPktg0bYSyHbYXG0iDF1alohSME8A+UBNlvwTx9gCuJrQnkWUt4Txfu3MfeO4IIV 9lLNw6YXwwRoAN6MBDe7hNKQ1W5CpBnx4i1HdOJFy9Zfl7V16hkh+tugc4mxYV2kkYir 3L+YvQLD2PllJ0/Q1g80pfgx18KXDybaD66a3NkYhN5t8mPCFCMvgOltOh4k5ImOsuLM V/Ig== 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=wmTJjSwT71fVeZmrZr+4tJvSMd0/iT/sFHusM2CqDlk=; b=h5WQYOsLEU9SszInotdnSsoj25nM/IAdYsqASG0bG6RslkzqAEBHcoWGKJbxzfQEJm OaF6wOu/4rQsSnx4+n/oNpwumJspssz3Sh5i9sZE7LWCt7mkwy/utTjnz9eV+WVIr5QW SPQAqV6Qi4cOnLzCZWcjfW74i8o8rrLbfXeCkm2/Q2WODgc1acKzfm/IpqjXyS+ZfTNW uSTla99aeL2ln+KwioCmDTcx1aFzC5ikluP35oLJix1q3619ZJLFsUxiXmfg9SlTfuon dNwsL0CXRXDG+YmPcD03SzvmOkZbvqawLB67C38GfjnMUdKLT+kXaj8KN8iAUguZzSdP MNZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HRp6BasL; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i12-20020a50c3cc000000b00454488ae8cesi2109111edf.126.2022.09.27.08.36.10; Tue, 27 Sep 2022 08:36:38 -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=@linuxfoundation.org header.s=korg header.b=HRp6BasL; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231778AbiI0PcZ (ORCPT + 99 others); Tue, 27 Sep 2022 11:32:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232171AbiI0PcX (ORCPT ); Tue, 27 Sep 2022 11:32:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B63D31C00F6; Tue, 27 Sep 2022 08:32:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3B57B61A2A; Tue, 27 Sep 2022 15:32:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 284C9C433C1; Tue, 27 Sep 2022 15:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664292741; bh=HnO17c79QWZdKEnu0tf8BfIuBm6ZnXghdoli6EdxWYY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HRp6BasLHPp12GKH64z8vC/L8a6gie5hI/aV8EtoNvtzxunxuSKZUUgJgvos2Zhsi oKK8l0qp3abovT0zPXPyIvPYS0r7RDlYo481RUTphE+WmQq0PH3aOYWJomGRkN5wdS 4Ms/2skM942xIS5i4R9b9ulyyg5R9kzW2C7SuVN8= Date: Tue, 27 Sep 2022 17:32:19 +0200 From: Greg Kroah-Hartman To: Miguel Ojeda Cc: Linus Torvalds , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, patches@lists.linux.dev, Jarkko Sakkinen , Kees Cook , Alex Gaynor , Wedson Almeida Filho , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Boqun Feng , Gary Guo Subject: Re: [PATCH v10 13/27] rust: export generated symbols Message-ID: References: <20220927131518.30000-1-ojeda@kernel.org> <20220927131518.30000-14-ojeda@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220927131518.30000-14-ojeda@kernel.org> X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Tue, Sep 27, 2022 at 03:14:44PM +0200, Miguel Ojeda wrote: > All symbols are reexported reusing the `EXPORT_SYMBOL_GPL` macro > from C. The lists of symbols are generated on the fly. > > There are three main sets of symbols to distinguish: > > - The ones from the `core` and `alloc` crates (from the Rust > standard library). The code is licensed as Apache/MIT. > > - The ones from our abstractions in the `kernel` crate. > > - The helpers (already exported since they are not generated). > > We export everything as GPL. This ensures we do not mistakenly > expose GPL kernel symbols/features as non-GPL, even indirectly. > > Reviewed-by: Kees Cook > Co-developed-by: Alex Gaynor > Signed-off-by: Alex Gaynor > Co-developed-by: Wedson Almeida Filho > Signed-off-by: Wedson Almeida Filho > Co-developed-by: Bj?rn Roy Baron > Signed-off-by: Bj?rn Roy Baron > Signed-off-by: Miguel Ojeda > --- > rust/exports.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > create mode 100644 rust/exports.c > > diff --git a/rust/exports.c b/rust/exports.c > new file mode 100644 > index 000000000000..bb7cc64cecd0 > --- /dev/null > +++ b/rust/exports.c > @@ -0,0 +1,21 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * A hack to export Rust symbols for loadable modules without having to redo > + * the entire `include/linux/export.h` logic in Rust. > + * > + * This requires the Rust's new/future `v0` mangling scheme because the default > + * one ("legacy") uses invalid characters for C identifiers (thus we cannot use > + * the `EXPORT_SYMBOL_*` macros). > + * > + * All symbols are exported as GPL-only to guarantee no GPL-only feature is > + * accidentally exposed. > + */ > + > +#include > + > +#define EXPORT_SYMBOL_RUST_GPL(sym) extern int sym; EXPORT_SYMBOL_GPL(sym) > + > +#include "exports_core_generated.h" > +#include "exports_alloc_generated.h" > +#include "exports_bindings_generated.h" > +#include "exports_kernel_generated.h" > -- > 2.37.3 Reviewed-by: Greg Kroah-Hartman