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]
Date:   Thu, 29 Apr 2021 12:05:08 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Fabio Aiuto <fabioaiuto83@...il.com>
Cc:     rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: module parameters permission

On Thu, Apr 29, 2021 at 11:58:20AM +0200, Fabio Aiuto wrote:
> Hi all,
> 
> I'm trying to declare module parameters this way:
> 
> 
>    params: {
>         scull_major: i32 {
>             default: 0,
>             permissions: bindings::S_IRUGO as i32,
>             description: b"Major number",
>         },
>         scull_minor: i32 {
>             default: 0,
>             permissions: bindings::S_IRUGO as i32,
>             description: b"Minor number",
>         },
> 
> i.e. using S_IRUGO macro exposed by bindgen. But I have the
> following compiler error:
> 
> error: proc macro panicked
>   --> samples/rust/rust_scull.rs:12:1
>    |
> 12 | / module! {
> 13 | |     type: RustScull,
> 14 | |     name: b"rust_scull",
> 15 | |     author: b"Alessandro Rubini, Jonathan Corbet",
> ...  |
> 44 | |     },
> 45 | | }
>    | |_^
>    |
>    = help: message: Expected Literal
> 
> the same if I remove as i32 casts.
> 
> if I write permissions as in samples/rust/rust_module_parameters.rs
> 
>     params: {
>         my_bool: bool {
>             default: true,
>             permissions: 0,
>             description: b"Example of bool",
>         },
>         my_i32: i32 {
>             default: 42,
>             permissions: 0o644, <-------
>             description: b"Example of i32",
>         },
> 
> I get no error.
> 
> What's the right way to use S_I*UGO macros?

Not at all, use the octal values instead please.

That's the way that we have declared a while ago, and I think
checkpatch.pl will even catch if you try to do this in any new code.
Please don't force us to deal with S_* defines in rust code as well.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ