From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1DC4C433EF for ; Tue, 22 Feb 2022 00:58:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 117328D0003; Mon, 21 Feb 2022 19:58:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C6EE8D0001; Mon, 21 Feb 2022 19:58:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF7AB8D0003; Mon, 21 Feb 2022 19:58:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0159.hostedemail.com [216.40.44.159]) by kanga.kvack.org (Postfix) with ESMTP id E23468D0001 for ; Mon, 21 Feb 2022 19:58:20 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7B68F181AC9CC for ; Tue, 22 Feb 2022 00:58:20 +0000 (UTC) X-FDA: 79168604760.16.0C59198 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf17.hostedemail.com (Postfix) with ESMTP id DD64440005 for ; Tue, 22 Feb 2022 00:58:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=oEyJbJhYQXkYNwqXWITqKDBHxJuIQyScQoAay2C9B64=; b=VX7RTF+lDwVNc2hJcTdhp4SAqs x/qkEMil97v3LLNgjuLGs2eDt2sip7GlaAWnj+S3LwY68wX2JBF15/2uwoMVpDGfZrEKfSLXrsbwi TDsiCGlYxi9vmC2H6EUahVvHDJxFQRXSft94x+5KLhaKuAAqAry6tlict3PWIWTzMv0SYcOJH7lUH D+mWPlKz84LINGbUtdFNrPqSPo0CJqoavX9nqsFufnsvy7Hi0cRc/WsacJ9+UOoyn3mctwxEaX/9o B7QEBfEMvVuhuPCopCen3qJVLmRAG5KnyKcLuAqfZGvG4VDF1XrLgR/NldFbZ8LoxZ86Vw/BnMM0U 3rgPL5ig==; Received: from [2601:1c0:6280:3f0::aa0b] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMJVS-007YcT-Nf; Tue, 22 Feb 2022 00:58:18 +0000 From: Randy Dunlap To: linux-mm@kvack.org 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 Message-Id: <20220222005817.11087-1-rdunlap@infradead.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: DD64440005 X-Stat-Signature: w7xmuwhgsuisq5wnhopr7wpjanjag3ty Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=VX7RTF+l; spf=none (imf17.hostedemail.com: domain of rdunlap@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=rdunlap@infradead.org; dmarc=none X-Rspam-User: X-HE-Tag: 1645491499-691515 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: __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=3D/boot/bzImage-517rc5 stack_guard_gap=3D100", will be \ passed to user space. Run /sbin/init as init process with arguments: /sbin/init with environment: HOME=3D/ TERM=3Dlinux BOOT_IMAGE=3D/boot/bzImage-517rc5 stack_guard_gap=3D100 Return 1 to indicate that the boot option has been handled. Note that there is no warning message if someone enters: stack_guard_gap=3Danything_invalid 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 =3D=3D 0 is valid (if unexpected) since using "stack_guard_gap=3D0" 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 Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru 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 =3D val << PAGE_SHIFT; =20 - return 0; + return 1; } __setup("stack_guard_gap=3D", cmdline_parse_stack_guard_gap); =20