[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210414194454.GV2531743@casper.infradead.org>
Date: Wed, 14 Apr 2021 20:44:54 +0100
From: Matthew Wilcox <willy@...radead.org>
To: ojeda@...nel.org
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
rust-for-linux@...r.kernel.org, linux-kbuild@...r.kernel.org,
linux-doc@...r.kernel.org, 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/13] kallsyms: Support "big" kernel symbols (2-byte
lengths)
On Wed, Apr 14, 2021 at 08:45:52PM +0200, ojeda@...nel.org wrote:
> Increasing to 255 is not enough in some cases, and therefore
> we need to introduce 2-byte lengths to the symbol table. We call
> these "big" symbols.
>
> In order to avoid increasing all lengths to 2 bytes (since most
> of them only require 1 byte, including many Rust ones), we use
> length zero to mark "big" symbols in the table.
How about doing something a bit more utf-8-like?
len = data[0];
if (len == 0)
error
else if (len < 128)
return len;
else if (len < 192)
return 128 + (len - 128) * 256 + data[1];
... that takes you all the way out to 16511 bytes. You probably don't
even need the third byte option. But if you do ...
else if (len < 223)
return 16512 + (len - 192) * 256 * 256 +
data[1] * 256 + data[2];
which takes you all the way out to 2,113,663 bytes and leaves 224-255 unused.
Alternatively, if the symbols are really this long, perhaps we should not
do string matches. A sha-1 (... or whatever ...) hash of the function
name is 160 bits. Expressed as hex digits, that's 40 characters.
Expressed in base-64, it's 27 characters. We'd also want a "pretty"
name to go along with the hash, but that seems preferable to printing
out a mangled-with-types-and-who-knows-what name.
> Co-developed-by: Alex Gaynor <alex.gaynor@...il.com>
> Signed-off-by: Alex Gaynor <alex.gaynor@...il.com>
If you have C-d-b, you don't also need S-o-b.
Powered by blists - more mailing lists