linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Stappers <stappers@stappers.nl>
To: Miguel Ojeda <ojeda@kernel.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Jiri Kosina <jikos@kernel.org>, Miroslav Benes <mbenes@suse.cz>,
	Petr Mladek <pmladek@suse.com>,
	Joe Lawrence <joe.lawrence@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Kefeng Wang <wangkefeng.wang@huawei.com>,
	Helge Deller <deller@gmx.de>, Stephen Boyd <swboyd@chromium.org>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Changbin Du <changbin.du@intel.com>,
	Nathan Chancellor <nathan@kernel.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Andi Kleen <ak@linux.intel.com>,
	Kees Cook <keescook@chromium.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-kernel@vger.kernel.org, live-patching@vger.kernel.org,
	linux-perf-users@vger.kernel.org, rust-for-linux@vger.kernel.org,
	Alex Gaynor <alex.gaynor@gmail.com>,
	Wedson Almeida Filho <wedsonaf@google.com>,
	Gary Guo <gary@garyguo.net>, Boqun Feng <boqun.feng@gmail.com>
Subject: Re: [PATCH v1 3/3] kallsyms: increase maximum kernel symbol length to 512
Date: Fri, 6 May 2022 11:45:36 +0200	[thread overview]
Message-ID: <20220506094536.GL1551@rosa.stappers.it> (raw)
In-Reply-To: <20220505191704.22812-4-ojeda@kernel.org>

On Thu, May 05, 2022 at 09:16:45PM +0200, Miguel Ojeda wrote:
> 
> generates a symbol of length 96 when using the upcoming v0 mangling scheme:
> 
>     _RNvXNtCshGpAVYOtgW1_7example9my_moduleINtB2_13MyGenericTypeNtB2_6MyTypeENtB2_7MyTrait9my_method
> 
> At the moment, Rust symbols may reach up to 300 in length.
> Setting 512 as the maximum seems like a reasonable choice to
> keep some headroom.
> 
> diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
> index ce1bd2fbf23e..e5ad6e31697d 100644
> --- a/include/linux/kallsyms.h
> +++ b/include/linux/kallsyms.h
> @@ -15,7 +15,7 @@
>  
>  #include <asm/sections.h>
>  
> -#define KSYM_NAME_LEN 128
> +#define KSYM_NAME_LEN 512

multiplication factor is four


> --- a/kernel/livepatch/core.c
> +++ b/kernel/livepatch/core.c
> @@ -213,7 +213,7 @@ static int klp_resolve_symbols(Elf_Shdr *sechdrs, const char *strtab,
>  	 * we use the smallest/strictest upper bound possible (56, based on
>  	 * the current definition of MODULE_NAME_LEN) to prevent overflows.
>  	 */
> -	BUILD_BUG_ON(MODULE_NAME_LEN < 56 || KSYM_NAME_LEN != 128);
> +	BUILD_BUG_ON(MODULE_NAME_LEN < 56 || KSYM_NAME_LEN != 512);

factor four


> @@ -227,7 +227,7 @@ static int klp_resolve_symbols(Elf_Shdr *sechdrs, const char *strtab,
>  
>  		/* Format: .klp.sym.sym_objname.sym_name,sympos */
>  		cnt = sscanf(strtab + sym->st_name,
> -			     ".klp.sym.%55[^.].%127[^,],%lu",
> +			     ".klp.sym.%55[^.].%511[^,],%lu",

4 * ( 127 + 1 )  =  511 + 1


> --- a/scripts/kallsyms.c
> +++ b/scripts/kallsyms.c
> @@ -30,10 +30,10 @@
>  #define _stringify_1(x)	#x
>  #define _stringify(x)	_stringify_1(x)
>  
> -#define KSYM_NAME_LEN		128
> +#define KSYM_NAME_LEN		512

factor four


> --- a/tools/include/linux/kallsyms.h
> +++ b/tools/include/linux/kallsyms.h
> @@ -6,7 +6,7 @@
>  #include <stdio.h>
>  #include <unistd.h>
>  
> -#define KSYM_NAME_LEN 128
> +#define KSYM_NAME_LEN 512

factor four


> --- a/tools/lib/perf/include/perf/event.h
> +++ b/tools/lib/perf/include/perf/event.h
> @@ -95,7 +95,7 @@ struct perf_record_throttle {
>  };
>  
>  #ifndef KSYM_NAME_LEN
> -#define KSYM_NAME_LEN 256
> +#define KSYM_NAME_LEN 512

Here is the multiplication factor  two.


> --- a/tools/lib/symbol/kallsyms.h
> +++ b/tools/lib/symbol/kallsyms.h
> @@ -7,7 +7,7 @@
>  #include <linux/types.h>
>  
>  #ifndef KSYM_NAME_LEN
> -#define KSYM_NAME_LEN 256
> +#define KSYM_NAME_LEN 512

Another  "factor two"



It feels good to unify all the KSYM_NAME_LEN to 512.

Thing that feels less good is doubling 256 versus quadrupling 128.

I felt the need to report that.


Feel free to ignore this remark.



Groeten
Geert Stappers
-- 
Silence is hard to parse

      parent reply	other threads:[~2022-05-06  9:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05 19:16 [PATCH v1 0/3] kallsyms: Rust requirements Miguel Ojeda
2022-05-05 19:16 ` [PATCH v1 1/3] kallsyms: avoid hardcoding the buffer size Miguel Ojeda
2022-05-05 23:46   ` Kees Cook
2022-05-06  5:26     ` Miguel Ojeda
2022-05-06 11:19   ` James Bottomley
2022-05-06 12:58     ` Miguel Ojeda
2022-05-06 14:48       ` James Bottomley
2022-05-05 19:16 ` [PATCH v1 2/3] kallsyms: support "big" kernel symbols Miguel Ojeda
2022-05-05 23:47   ` Kees Cook
2022-05-05 19:16 ` [PATCH v1 3/3] kallsyms: increase maximum kernel symbol length to 512 Miguel Ojeda
2022-05-05 23:48   ` Kees Cook
2022-05-06  8:34   ` Petr Mladek
2022-05-06  9:45   ` Geert Stappers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220506094536.GL1551@rosa.stappers.it \
    --to=stappers@stappers.nl \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.gaynor@gmail.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=boqun.feng@gmail.com \
    --cc=changbin.du@intel.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=deller@gmx.de \
    --cc=gary@garyguo.net \
    --cc=gustavoars@kernel.org \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=jolsa@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=masahiroy@kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=swboyd@chromium.org \
    --cc=wangkefeng.wang@huawei.com \
    --cc=wedsonaf@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).