lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZjqmfIhRz99BqXtD@boqun-archlinux>
Date: Tue, 7 May 2024 15:09:00 -0700
From: Boqun Feng <boqun.feng@...il.com>
To: Miguel Ojeda <ojeda@...nel.org>
Cc: Masahiro Yamada <masahiroy@...nel.org>,
	Wedson Almeida Filho <wedsonaf@...il.com>,
	Alex Gaynor <alex.gaynor@...il.com>,
	Nathan Chancellor <nathan@...nel.org>,
	Nicolas Schier <nicolas@...sle.eu>, Gary Guo <gary@...yguo.net>,
	Björn Roy Baron <bjorn3_gh@...tonmail.com>,
	Benno Lossin <benno.lossin@...ton.me>,
	Andreas Hindborg <a.hindborg@...sung.com>,
	Alice Ryhl <aliceryhl@...gle.com>, linux-kbuild@...r.kernel.org,
	rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
	patches@...ts.linux.dev,
	Sergio González Collado <sergio.collado@...il.com>
Subject: Re: [PATCH v2] kbuild: rust: split up helpers.c

On Tue, May 07, 2024 at 11:08:18PM +0200, Miguel Ojeda wrote:
> From: Andreas Hindborg <a.hindborg@...sung.com>
> 
> When rebasing patch sets on top of upstream Linux, merge conflicts in
> helpers.c are common and time consuming [1]. Thus, split the file so
> that each kernel component can live in a separate file.
> 
> Each helper file is listed explicitly and thus conflicts in the file
> list are still likely. However, they should be simpler to resolve than
> the conflicts usually seen in helpers.c.
> 
> Link: https://rust-for-linux.zulipchat.com/#narrow/stream/288089-General/topic/Splitting.20up.20helpers.2Ec/near/426694012 [1]
> Signed-off-by: Andreas Hindborg <a.hindborg@...sung.com>
> Reviewed-by: Sergio González Collado <sergio.collado@...il.com>
> Tested-by: Sergio González Collado <sergio.collado@...il.com>
> Link: https://lore.kernel.org/r/20240416074607.1395481-1-nmi@metaspace.dk
> [ Reworded message slightly and fixed nits in it. Applied commit
>   84373132b831 ("rust: helpers: Fix grammar in comment") here. Added
>   SPDX license identifier in new Makefile. Applied Markdown formatting.
>   Added `.gitignore`. Included `helpers_combined.c` in the `clean`
>   target. - Miguel ]
> Signed-off-by: Miguel Ojeda <ojeda@...nel.org>

This overall looks good to me, one thing below I think should be
changed..

> ---
> This is a patch from Andreas that I was going to apply to `rust-next`
> with the tweaks mentioned above, but I noticed Kbuild was not Cc'd, so
> we decided to send this as a "v2" and thus give a chance to Kbuild to
> take a look for next cycle.
> 
> If something in the diff to v1 is wrong, it is my fault, not Andreas' :)
> 

[...]

> diff --git a/rust/helpers/build_bug.c b/rust/helpers/build_bug.c
> new file mode 100644
> index 000000000000..f3106f248485
> --- /dev/null
> +++ b/rust/helpers/build_bug.c
> @@ -0,0 +1,10 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <linux/export.h>
> +#include <linux/errname.h>
> +
> +const char *rust_helper_errname(int err)
> +{
> +	return errname(err);
> +}
> +EXPORT_SYMBOL_GPL(rust_helper_errname);

. this build_bug.c should be avoided, but this function should go into
err.c.

Regards,
Boqun

> diff --git a/rust/helpers/err.c b/rust/helpers/err.c
> new file mode 100644
> index 000000000000..fba4e0be64f5
> --- /dev/null
> +++ b/rust/helpers/err.c
> @@ -0,0 +1,22 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <linux/err.h>
> +#include <linux/export.h>
> +
> +__force void *rust_helper_ERR_PTR(long err)
> +{
> +	return ERR_PTR(err);
> +}
> +EXPORT_SYMBOL_GPL(rust_helper_ERR_PTR);
> +
> +bool rust_helper_IS_ERR(__force const void *ptr)
> +{
> +	return IS_ERR(ptr);
> +}
> +EXPORT_SYMBOL_GPL(rust_helper_IS_ERR);
> +
> +long rust_helper_PTR_ERR(__force const void *ptr)
> +{
> +	return PTR_ERR(ptr);
> +}
> +EXPORT_SYMBOL_GPL(rust_helper_PTR_ERR);
[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ