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: <439575eda6b24261aef4c8c7e4c078cb@AcuMS.aculab.com>
Date:   Tue, 30 May 2023 13:42:13 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Maninder Singh' <maninder1.s@...sung.com>,
        "bcain@...cinc.com" <bcain@...cinc.com>,
        "mpe@...erman.id.au" <mpe@...erman.id.au>,
        "npiggin@...il.com" <npiggin@...il.com>,
        "christophe.leroy@...roup.eu" <christophe.leroy@...roup.eu>,
        "keescook@...omium.org" <keescook@...omium.org>,
        "nathanl@...ux.ibm.com" <nathanl@...ux.ibm.com>,
        "ustavoars@...nel.org" <ustavoars@...nel.org>,
        "alex.gaynor@...il.com" <alex.gaynor@...il.com>,
        "gary@...yguo.net" <gary@...yguo.net>,
        "ojeda@...nel.org" <ojeda@...nel.org>,
        "pmladek@...e.com" <pmladek@...e.com>,
        "wedsonaf@...gle.com" <wedsonaf@...gle.com>
CC:     "linux-hexagon@...r.kernel.org" <linux-hexagon@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
        Onkarnath <onkarnath.1@...sung.com>
Subject: RE: [PATCH 1/2] hexagon/traps.c: use KSYM_NAME_LEN in array size

From: Maninder Singh
> Sent: 29 May 2023 12:14
> 
> kallsyms_lookup which in turn calls for kallsyms_lookup_buildid()
> writes on index "KSYM_NAME_LEN - 1".
> 
> Thus array size should be KSYM_NAME_LEN.
> 
> for hexagon it was defined as "128" directly.
> and commit '61968dbc2d5d' changed define value to 512,
> So both were missed to update with new size.

The only safe way to pass a fixed size string is to embed the char[] in
a structure and pass the structure address.

Pretty much anything else is doomed to be buggy.

Whether is it actually sane to require the caller allocate
such a large buffer (hi rust) is another matter entirely.

	David

> 
> Fixes: 61968dbc2d5d ("kallsyms: increase maximum kernel symbol length to 512")
> 
> Co-developed-by: Onkarnath <onkarnath.1@...sung.com>
> Signed-off-by: Onkarnath <onkarnath.1@...sung.com>
> Signed-off-by: Maninder Singh <maninder1.s@...sung.com>
> ---
>  arch/hexagon/kernel/traps.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/hexagon/kernel/traps.c b/arch/hexagon/kernel/traps.c
> index 6447763ce5a9..65b30b6ea226 100644
> --- a/arch/hexagon/kernel/traps.c
> +++ b/arch/hexagon/kernel/traps.c
> @@ -82,7 +82,7 @@ static void do_show_stack(struct task_struct *task, unsigned long *fp,
>  	const char *name = NULL;
>  	unsigned long *newfp;
>  	unsigned long low, high;
> -	char tmpstr[128];
> +	char tmpstr[KSYM_NAME_LEN];
>  	char *modname;
>  	int i;
> 
> --
> 2.17.1

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ