Re: [PATCH 2/7] scripts: modpost: increase buf_printf's buffer size

From: Gary Guo

Date: Fri May 01 2026 - 09:03:02 EST


On Thu Apr 30, 2026 at 3:55 PM BST, Alexandre Courbot wrote:
> Rust tends to produce long symbol names; when trying to export symbols
> from nova-core for nova-drm to link to, the 500 bytes of the internal
> buffer used for symbol name formatting are not enough, making modpost
> fail.
>
> Fix this by increasing the size of the buffer used to format the symbols
> to 1024 bytes. It is a stack buffer, but modpost is a user-space program
> so that shouldn't be a problem.

I think we should make sure all constants related to symbol names match.
KSYM_NAME_LEN is 512 so this should just be that.

The only case that I've been hit with very long symbol names so far is doc tests.
Can you provide an example of the case where you're hit with very long symbol
names in Nova? In many cases they're just functions that are supposed to be
inlined but isn't.

Best,
Gary

>
> Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
> ---
> scripts/mod/modpost.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index 16f6bc20b058..2ab7aa6edcb4 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -1674,7 +1674,7 @@ static void read_symbols_from_files(const char *filename)
> fclose(in);
> }
>
> -#define SZ 500
> +#define SZ 1024
>
> /* We first write the generated file into memory using the
> * following helper, then compare to the file on disk and