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: <ZJ8cNUW3oR2p+gL1@boqun-archlinux>
Date:   Fri, 30 Jun 2023 11:17:25 -0700
From:   Boqun Feng <boqun.feng@...il.com>
To:     Miguel Ojeda <ojeda@...nel.org>
Cc:     David Gow <davidgow@...gle.com>,
        Brendan Higgins <brendan.higgins@...ux.dev>,
        Wedson Almeida Filho <wedsonaf@...il.com>,
        Alex Gaynor <alex.gaynor@...il.com>,
        Gary Guo <gary@...yguo.net>,
        Björn Roy Baron <bjorn3_gh@...tonmail.com>,
        Benno Lossin <benno.lossin@...ton.me>,
        Alice Ryhl <aliceryhl@...gle.com>,
        Andreas Hindborg <nmi@...aspace.dk>,
        Philip Li <philip.li@...el.com>, kunit-dev@...glegroups.com,
        linux-kselftest@...r.kernel.org, rust-for-linux@...r.kernel.org,
        linux-kernel@...r.kernel.org, patches@...ts.linux.dev
Subject: Re: [PATCH 5/6] rust: support running Rust documentation tests as
 KUnit ones

On Wed, Jun 14, 2023 at 08:08:29PM +0200, Miguel Ojeda wrote:
> diff --git a/rust/helpers.c b/rust/helpers.c
> index bb594da56137..49a5e1a4f0ae 100644
> --- a/rust/helpers.c
> +++ b/rust/helpers.c
> @@ -18,6 +18,7 @@
>   * accidentally exposed.
>   */
>  
> +#include <kunit/test-bug.h>

When CONFIG_KUNIT=n, the above file is mostly just a function that
returns "NULL", however, since "NULL" is not defined: kunit/test-bug.h
includes nothing if CONFIG_KUNIT=n, bindgen is not happy about it:

  ./include/kunit/test-bug.h:63:67: error: use of undeclared identifier 'NULL'

, we can fix this in Rust side by adding linux/stddef.h before
kunit/test-bug.h as below, but maybe it's better fixed inside
kunit/test-bug.h?

Regards,
Boqun

-------------------------------->8
diff --git a/rust/helpers.c b/rust/helpers.c
index 49a5e1a4f0ae..048d11c7d796 100644
--- a/rust/helpers.c
+++ b/rust/helpers.c
@@ -18,6 +18,7 @@
  * accidentally exposed.
  */
 
+#include <linux/stddef.h>
 #include <kunit/test-bug.h>
 #include <linux/bug.h>
 #include <linux/build_bug.h>

>  #include <linux/bug.h>
>  #include <linux/build_bug.h>
>  #include <linux/err.h>
> @@ -135,6 +136,12 @@ void rust_helper_put_task_struct(struct task_struct *t)
>  }
>  EXPORT_SYMBOL_GPL(rust_helper_put_task_struct);
>  
> +struct kunit *rust_helper_kunit_get_current_test(void)
> +{
> +	return kunit_get_current_test();
> +}
> +EXPORT_SYMBOL_GPL(rust_helper_kunit_get_current_test);
> +
>  /*
>   * We use `bindgen`'s `--size_t-is-usize` option to bind the C `size_t` type
>   * as the Rust `usize` type, so we can use it in contexts where Rust

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ