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: <87frjzu6zo.fsf@kernel.org>
Date: Thu, 27 Feb 2025 09:28:11 +0100
From: Andreas Hindborg <a.hindborg@...nel.org>
To: "FUJITA Tomonori" <fujita.tomonori@...il.com>
Cc: <linux-kernel@...r.kernel.org>,  <rust-for-linux@...r.kernel.org>,
  <x86@...nel.org>,  <linux-riscv@...ts.infradead.org>,
  <linux-arm-kernel@...ts.infradead.org>,  <loongarch@...ts.linux.dev>,
  <tglx@...utronix.de>,  <mingo@...hat.com>,  <bp@...en8.de>,
  <dave.hansen@...ux.intel.com>,  <peterz@...radead.org>,  <hpa@...or.com>,
  <paul.walmsley@...ive.com>,  <palmer@...belt.com>,
  <aou@...s.berkeley.edu>,  <catalin.marinas@....com>,  <will@...nel.org>,
  <chenhuacai@...nel.org>,  <kernel@...0n.name>,
  <tangyouling@...ngson.cn>,  <hejinyang@...ngson.cn>,
  <yangtiezhu@...ngson.cn>,  <ojeda@...nel.org>,  <alex.gaynor@...il.com>,
  <boqun.feng@...il.com>,  <gary@...yguo.net>,  <bjorn3_gh@...tonmail.com>,
  <benno.lossin@...ton.me>,  <aliceryhl@...gle.com>,  <tmgross@...ch.edu>
Subject: Re: [PATCH v3 0/5] rust: Add bug/warn abstractions

"FUJITA Tomonori" <fujita.tomonori@...il.com> writes:

> On Wed, 26 Feb 2025 20:39:45 +0100
> Andreas Hindborg <a.hindborg@...nel.org> wrote:
>
>> How does this series compare/overlap with [1] ?
>>
>> [1] https://lore.kernel.org/all/20241126-pr_once_macros-v4-0-410b8ca9643e@tuta.io/
>
> No overlap. Each solves a different problem. Both are necessary.
>
> This patchset enables Rust code to call C's BUG/WARN properly.
>
> Currently, Rust's BUG() is a simple wrapper for C's BUG()
> (rust/helpers/bug.c). I added BUG() to rnull's init() and got the
> following:
>
> # insmod /root/rnull_mod.ko
> rnull_mod: Rust null_blk loaded
> ------------[ cut here ]------------
> kernel BUG at rust/helpers/bug.c:7!
> Oops: invalid opcode: 0000 [#1] SMP
> CPU: 0 UID: 0 PID: 31 Comm: insmod Not tainted 6.14.0-rc1+ #103
> RIP: 0010:rust_helper_BUG+0x8/0x10
> (snip)
>
> This is NOT debug information that we expect. The problem is that
> BUG/WARN feature (lib/bug.c) can only be used from assembly.
>
> This patchset includes only warn() but with bug() implementation on
> top of this patchset, I got:
>
> # insmod /root/rnull_mod.ko
> rnull_mod: Rust null_blk loaded
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 31 at /home/fujita/git/linux-rust/drivers/block/rnull.rs:46 _RNvXCsafUg3oOYix8_5rnullNtB2_13NullBlkModu]
> Modules linked in: rnull_mod(+)
> CPU: 0 UID: 0 PID: 31 Comm: insmod Not tainted 6.14.0-rc1+ #104
> RIP: 0010:_RNvXCsafUg3oOYix8_5rnullNtB2_13NullBlkModuleNtCsaYBeKL739Xz_6kernel13InPlaceModule4init+0x71/0x4f0 [rnull_mod]
>
>
> The [1] patchset adds an abstraciton for include/linux/once_lite.h,
> 'call a function once' feature, with pr_*_once() implementation.
>
> pr_*_once() just calls printk() once. Unlike BUG/WARN, no debug
> information (call place, registers, stack trace, etc).
>
>
> The only connection between two patchset is that WARN_ONCE() can be
> built on top of both like the C side.

Awesome, thanks for explaining 👍


Best regards,
Andreas Hindborg



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ