All of
 help / color / mirror / Atom feed
From: Randy Dunlap <>
Cc: Randy Dunlap <>,
	Igor Zhbanov <>,
	Andrew Morton <>,
	Hugh Dickins <>
Subject: [PATCH 2/2] mm/mmap: return 1 from stack_guard_gap __setup() handler
Date: Mon, 21 Feb 2022 16:58:17 -0800	[thread overview]
Message-ID: <> (raw)

__setup() handlers should return 1 if the command line option is handled
and 0 if not (or maybe never return 0; it just pollutes init's
environment). This prevents:

  Unknown kernel command line parameters \
  "BOOT_IMAGE=/boot/bzImage-517rc5 stack_guard_gap=100", will be \
  passed to user space.

  Run /sbin/init as init process
   with arguments:
   with environment:

Return 1 to indicate that the boot option has been handled.

Note that there is no warning message if someone enters:
and 'val' and stack_guard_gap are both set to 0 due to the use of
simple_strtoul(). This could be improved by using kstrtoxxx() and
checking for an error.

It appears that having stack_guard_gap == 0 is valid (if unexpected)
since using "stack_guard_gap=0" on the kernel command line does that.

Fixes: 1be7107fbe18e ("mm: larger stack guard gap, between vmas")
Signed-off-by: Randy Dunlap <>
Reported-by: Igor Zhbanov <>
Cc: Andrew Morton <>
Cc: Hugh Dickins <>
 mm/mmap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20220217.orig/mm/mmap.c
+++ linux-next-20220217/mm/mmap.c
@@ -2557,7 +2557,7 @@ static int __init cmdline_parse_stack_gu
 	if (!*endptr)
 		stack_guard_gap = val << PAGE_SHIFT;
-	return 0;
+	return 1;
 __setup("stack_guard_gap=", cmdline_parse_stack_guard_gap);

                 reply	other threads:[~2022-02-22  0:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

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

  git send-email \ \ \ \ \ \ \

* 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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.