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: <YzMOt2wSugmHzQD1@kroah.com>
Date:   Tue, 27 Sep 2022 16:54:47 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Miguel Ojeda <ojeda@...nel.org>
Cc:     Linus Torvalds <torvalds@...ux-foundation.org>,
        rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-fsdevel@...r.kernel.org, patches@...ts.linux.dev,
        Jarkko Sakkinen <jarkko@...nel.org>,
        Boqun Feng <boqun.feng@...il.com>
Subject: Re: [PATCH v10 03/27] kallsyms: add static relationship between
 `KSYM_NAME_LEN{,_BUFFER}`

On Tue, Sep 27, 2022 at 03:14:34PM +0200, Miguel Ojeda wrote:
> This adds a static assert to ensure `KSYM_NAME_LEN_BUFFER`
> gets updated when `KSYM_NAME_LEN` changes.
> 
> The relationship used is one that keeps the new size (512+1)
> close to the original buffer size (500).
> 
> Co-developed-by: Boqun Feng <boqun.feng@...il.com>
> Signed-off-by: Boqun Feng <boqun.feng@...il.com>
> Signed-off-by: Miguel Ojeda <ojeda@...nel.org>
> ---
>  scripts/kallsyms.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
> index 25e2fe5fbcd4..411ff5058b51 100644
> --- a/scripts/kallsyms.c
> +++ b/scripts/kallsyms.c
> @@ -32,8 +32,18 @@
>  
>  #define KSYM_NAME_LEN		128
>  
> -/* A substantially bigger size than the current maximum. */
> -#define KSYM_NAME_LEN_BUFFER	499
> +/*
> + * A substantially bigger size than the current maximum.
> + *
> + * It cannot be defined as an expression because it gets stringified
> + * for the fscanf() format string. Therefore, a _Static_assert() is
> + * used instead to maintain the relationship with KSYM_NAME_LEN.
> + */
> +#define KSYM_NAME_LEN_BUFFER	512
> +_Static_assert(
> +	KSYM_NAME_LEN_BUFFER == KSYM_NAME_LEN * 4,
> +	"Please keep KSYM_NAME_LEN_BUFFER in sync with KSYM_NAME_LEN"
> +);

Messy, but I can't think of any other way right now either :(

Reviewed-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ