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] [day] [month] [year] [list]
Message-ID: <ZsYvAJbGB8qUcjXA@boqun-archlinux>
Date: Wed, 21 Aug 2024 11:16:32 -0700
From: Boqun Feng <boqun.feng@...il.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Alice Ryhl <aliceryhl@...gle.com>, Steven Rostedt <rostedt@...dmis.org>,
	Masami Hiramatsu <mhiramat@...nel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Josh Poimboeuf <jpoimboe@...nel.org>,	Jason Baron <jbaron@...mai.com>,
 Ard Biesheuvel <ardb@...nel.org>,	Miguel Ojeda <ojeda@...nel.org>,
	Alex Gaynor <alex.gaynor@...il.com>,
	Wedson Almeida Filho <wedsonaf@...il.com>,	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>,
	linux-trace-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
	linux-kernel@...r.kernel.org, Arnd Bergmann <arnd@...db.de>,
	linux-arch@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
	Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
	"H. Peter Anvin" <hpa@...or.com>,
	Sean Christopherson <seanjc@...gle.com>,	Uros Bizjak <ubizjak@...il.com>,
	Catalin Marinas <catalin.marinas@....com>,	Will Deacon <will@...nel.org>,
 Marc Zyngier <maz@...nel.org>,	Oliver Upton <oliver.upton@...ux.dev>,
	Mark Rutland <mark.rutland@....com>,	Ryan Roberts <ryan.roberts@....com>,
 Fuad Tabba <tabba@...gle.com>,	linux-arm-kernel@...ts.infradead.org,
	Paul Walmsley <paul.walmsley@...ive.com>,
	Palmer Dabbelt <palmer@...belt.com>,	Albert Ou <aou@...s.berkeley.edu>,
	Anup Patel <apatel@...tanamicro.com>,
	Andrew Jones <ajones@...tanamicro.com>,
	Alexandre Ghiti <alexghiti@...osinc.com>,
	Conor Dooley <conor.dooley@...rochip.com>,
	Samuel Holland <samuel.holland@...ive.com>,
	linux-riscv@...ts.infradead.org,	Huacai Chen <chenhuacai@...nel.org>,
	WANG Xuerui <kernel@...0n.name>, Bibo Mao <maobibo@...ngson.cn>,
	Tiezhu Yang <yangtiezhu@...ngson.cn>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Tianrui Zhao <zhaotianrui@...ngson.cn>, loongarch@...ts.linux.dev
Subject: Re: [PATCH v7 5/5] rust: add arch_static_branch

On Wed, Aug 21, 2024 at 07:54:51PM +0200, Miguel Ojeda wrote:
> On Wed, Aug 21, 2024 at 7:08 PM Boqun Feng <boqun.feng@...il.com> wrote:
> >
> > Have you try this with "make O=<dir>"? I hit the following issue, but I
> > am rebasing on rust-dev, so I might miss something:
> >
> >         error: couldn't read ../rust/kernel/arch_static_branch_asm.rs: No such file or directory (os error 2)
> >           --> ../rust/kernel/jump_label.rs:39:17
> >            |
> >         39 | const _: &str = include!("arch_static_branch_asm.rs");
> >            |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >            |
> >            = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)
> >
> >         error: aborting due to 1 previous error
> 
> Yeah, we should use a `*TREE` everywhere. In addition, we should not
> use `SRCTREE` but `OBJTREE`. It is my fault, this comes from my
> prototype I gave Alice.
> 
> Please see the attached diff.
> 

Yes, this fix works, thanks!

Regards,
Boqun

> Cheers,
> Miguel

> diff --git a/rust/kernel/jump_label.rs b/rust/kernel/jump_label.rs
> index 7757e4f8e85e..ccfd20589c21 100644
> --- a/rust/kernel/jump_label.rs
> +++ b/rust/kernel/jump_label.rs
> @@ -36,7 +36,7 @@ macro_rules! static_key_false {
> 
>  /// Assert that the assembly block evaluates to a string literal.
>  #[cfg(CONFIG_JUMP_LABEL)]
> -const _: &str = include!("arch_static_branch_asm.rs");
> +const _: &str = include!(concat!(env!("OBJTREE"), "/rust/kernel/arch_static_branch_asm.rs"));
> 
>  #[macro_export]
>  #[doc(hidden)]
> @@ -45,7 +45,7 @@ macro_rules! static_key_false {
>  macro_rules! arch_static_branch {
>      ($key:path, $keytyp:ty, $field:ident, $branch:expr) => {'my_label: {
>          $crate::asm!(
> -            include!(concat!(env!("SRCTREE"), "/rust/kernel/arch_static_branch_asm.rs"));
> +            include!(concat!(env!("OBJTREE"), "/rust/kernel/arch_static_branch_asm.rs"));
>              l_yes = label {
>                  break 'my_label true;
>              },
> @@ -65,7 +65,7 @@ macro_rules! arch_static_branch {
>  macro_rules! arch_static_branch {
>      ($key:path, $keytyp:ty, $field:ident, $branch:expr) => {'my_label: {
>          $crate::asm!(
> -            include!(concat!(env!("SRCTREE"), "/rust/kernel/arch_static_branch_asm.rs"));
> +            include!(concat!(env!("OBJTREE"), "/rust/kernel/arch_static_branch_asm.rs"));
>              l_yes = label {
>                  break 'my_label true;
>              },
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 4f0f6b13ebd7..746cce80545f 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -269,7 +269,7 @@ rust_allowed_features := asm_const,asm_goto,new_uninit
>  # current working directory, which may be not accessible in the out-of-tree
>  # modules case.
>  rust_common_cmd = \
> -	SRCTREE=$(abspath $(srctree)) \
> +	OBJTREE=$(abspath $(objtree)) \
>  	RUST_MODFILE=$(modfile) $(RUSTC_OR_CLIPPY) $(rust_flags) \
>  	-Zallow-features=$(rust_allowed_features) \
>  	-Zcrate-attr=no_std \


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ