linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] execve: argument list space enlargement
@ 2024-01-03 13:07 alexs
  2024-01-05 12:02 ` David Laight
  2024-01-11  0:13 ` Kees Cook
  0 siblings, 2 replies; 3+ messages in thread
From: alexs @ 2024-01-03 13:07 UTC (permalink / raw)
  To: Eric Biederman, Kees Cook, linux-mm, linux-kernel; +Cc: Alex Shi, curlinhuang

From: Alex Shi <alexsshi@tencent.com>

Wechat using too long gcc parameters, then get a strace complain:
  execve(...) = -1 E2BIG (Argument list too long)
Have to increase the parameter space for this, stack has enough
space for this enlargement.

Signed-off-by: Alex Shi <alexsshi@tencent.com>
Cc: Alex Shi <alexsshi@tencent.com>
To: linux-kernel@vger.kernel.org
To: linux-mm@kvack.org
To: Kees Cook <keescook@chromium.org>
To: Eric Biederman <ebiederm@xmission.com>
---
 include/uapi/linux/binfmts.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/binfmts.h b/include/uapi/linux/binfmts.h
index c6f9450efc12..717f6cafe8dd 100644
--- a/include/uapi/linux/binfmts.h
+++ b/include/uapi/linux/binfmts.h
@@ -12,7 +12,7 @@ struct pt_regs;
  * prevent the kernel from being unduly impacted by misaddressed pointers.
  * MAX_ARG_STRINGS is chosen to fit in a signed 32-bit integer.
  */
-#define MAX_ARG_STRLEN (PAGE_SIZE * 32)
+#define MAX_ARG_STRLEN (PAGE_SIZE * 128)
 #define MAX_ARG_STRINGS 0x7FFFFFFF
 
 /* sizeof(linux_binprm->buf) */
-- 
2.43.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] execve: argument list space enlargement
  2024-01-03 13:07 [PATCH] execve: argument list space enlargement alexs
@ 2024-01-05 12:02 ` David Laight
  2024-01-11  0:13 ` Kees Cook
  1 sibling, 0 replies; 3+ messages in thread
From: David Laight @ 2024-01-05 12:02 UTC (permalink / raw)
  To: 'alexs@kernel.org',
	Eric Biederman, Kees Cook, linux-mm, linux-kernel
  Cc: Alex Shi, curlinhuang

From: alexs@kernel.org
> Sent: 03 January 2024 13:07
> 
> From: Alex Shi <alexsshi@tencent.com>
> 
> Wechat using too long gcc parameters, then get a strace complain:
>   execve(...) = -1 E2BIG (Argument list too long)
> Have to increase the parameter space for this, stack has enough
> space for this enlargement.

They should fix their build so that it doesn't explode.
It'll probably speed up the compiles as well since the
very long argv[] almost certainly comes from a lot of -I dir
options and they slow down the compile.

if they are -Dvar[=val] then '-include file' can be used instead.

	David

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] execve: argument list space enlargement
  2024-01-03 13:07 [PATCH] execve: argument list space enlargement alexs
  2024-01-05 12:02 ` David Laight
@ 2024-01-11  0:13 ` Kees Cook
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2024-01-11  0:13 UTC (permalink / raw)
  To: alexs
  Cc: Eric Biederman, linux-mm, linux-kernel, Alex Shi,
	Sergei Trofimovich, curlinhuang

On Wed, Jan 03, 2024 at 09:07:22PM +0800, alexs@kernel.org wrote:
> From: Alex Shi <alexsshi@tencent.com>
> 
> Wechat using too long gcc parameters, then get a strace complain:
>   execve(...) = -1 E2BIG (Argument list too long)
> Have to increase the parameter space for this, stack has enough
> space for this enlargement.

This is the second request recently[1] to expand the argument list size,
but I remain somewhat unconvinced this needs fixing on the kernel side.

[1] https://lore.kernel.org/lkml/202310170957.DF7F7FE9FA@keescook/

If we do change it, though, as I mention in the thread above, I'd prefer
to leave the UAPI alone and just detach the kernel internals from that
hard-coded limit.

-Kees

> 
> Signed-off-by: Alex Shi <alexsshi@tencent.com>
> Cc: Alex Shi <alexsshi@tencent.com>
> To: linux-kernel@vger.kernel.org
> To: linux-mm@kvack.org
> To: Kees Cook <keescook@chromium.org>
> To: Eric Biederman <ebiederm@xmission.com>
> ---
>  include/uapi/linux/binfmts.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/binfmts.h b/include/uapi/linux/binfmts.h
> index c6f9450efc12..717f6cafe8dd 100644
> --- a/include/uapi/linux/binfmts.h
> +++ b/include/uapi/linux/binfmts.h
> @@ -12,7 +12,7 @@ struct pt_regs;
>   * prevent the kernel from being unduly impacted by misaddressed pointers.
>   * MAX_ARG_STRINGS is chosen to fit in a signed 32-bit integer.
>   */
> -#define MAX_ARG_STRLEN (PAGE_SIZE * 32)
> +#define MAX_ARG_STRLEN (PAGE_SIZE * 128)
>  #define MAX_ARG_STRINGS 0x7FFFFFFF
>  
>  /* sizeof(linux_binprm->buf) */
> -- 
> 2.43.0
> 

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-11  0:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-03 13:07 [PATCH] execve: argument list space enlargement alexs
2024-01-05 12:02 ` David Laight
2024-01-11  0:13 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox