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: <20210704232007.0000357e@garyguo.net>
Date:   Sun, 4 Jul 2021 23:20:07 +0100
From:   Gary Guo <gary@...yguo.net>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
        Miguel Ojeda <ojeda@...nel.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        rust-for-linux <rust-for-linux@...r.kernel.org>,
        Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
        Linux Doc Mailing List <linux-doc@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Alex Gaynor <alex.gaynor@...il.com>,
        Geoffrey Thomas <geofft@...reload.com>,
        Finn Behrens <me@...enk.de>,
        Adam Bratschi-Kaye <ark.email@...il.com>,
        Wedson Almeida Filho <wedsonaf@...gle.com>
Subject: Re: [PATCH 01/17] kallsyms: support big kernel symbols (2-byte
 lengths)

On Sun, 4 Jul 2021 22:33:39 +0100
Matthew Wilcox <willy@...radead.org> wrote:

> On Sun, Jul 04, 2021 at 11:17:50PM +0200, Miguel Ojeda wrote:
> > On Sun, Jul 4, 2021 at 11:05 PM Matthew Wilcox
> > <willy@...radead.org> wrote:  
> > >
> > > What happened to my suggestion from last time of encoding symbols
> > > < 128 as 0-127 and symbols larger than that as (data[0] - 128) *
> > > 256 + data[1]) ?  
> > 
> > Nothing, sorry, we focused on other parts (e.g. the allocation
> > panics) during this iteration. I can take a look for v2.  
> 
> Here's what I have.  Build testing now.
> 
> 
> diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
> index c851ca0ed357..0d45a6e5fdc3 100644
> --- a/kernel/kallsyms.c
> +++ b/kernel/kallsyms.c
> @@ -67,6 +67,14 @@ static unsigned int
> kallsyms_expand_symbol(unsigned int off, len = *data;
>  	data++;
>  
> +	/* lengths larger than 128 are encoded as two bytes */
> +	if (len >= 128) {
> +		len -= 128;
> +		len *= 256;
> +		len += *data;
> +		data++;
> +	}
> +
>  	/*
>  	 * Update the offset to return the offset for the next
> symbol on
>  	 * the compressed stream.
> diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
> index 54ad86d13784..701566e01a1d 100644
> --- a/scripts/kallsyms.c
> +++ b/scripts/kallsyms.c
> @@ -467,10 +467,16 @@ static void write_src(void)
>  	output_label("kallsyms_names");
>  	off = 0;
>  	for (i = 0; i < table_cnt; i++) {
> +		int len = table[i]->len;
>  		if ((i & 0xFF) == 0)
>  			markers[i >> 8] = off;
>  
> -		printf("\t.byte 0x%02x", table[i]->len);
> +		if (len >= 128) {
> +			printf("\t.byte 0x%02x\n", len / 256 + 128);
> +			len %= 256;
> +			off++;
> +		}
> +		printf("\t.byte 0x%02x", len);
>  		for (k = 0; k < table[i]->len; k++)
>  			printf(", 0x%02x", table[i]->sym[k]);
>  		printf("\n");

This is big endian.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ