Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp979427pxb; Wed, 6 Apr 2022 05:55:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJzKUQ29d5xgc8zb3d6ucRHrryMJpJoUb6v1e+xuunSaMCBS9F6TML4NV/cxIstsz4zJ9C X-Received: by 2002:a17:90a:4882:b0:1c5:f4e2:989a with SMTP id b2-20020a17090a488200b001c5f4e2989amr9961249pjh.160.1649249744761; Wed, 06 Apr 2022 05:55:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649249744; cv=none; d=google.com; s=arc-20160816; b=038MVCVqxsoB6NPVx+UnWIGUHDrTekHYIoSt/R67YfttikVmds1HR/Y5UOZai4JqyI tzVY3asm5j6DqznM8l8uSv23spuvJebWdSSDQ+yj0tezwnricnJS8/k/+rGXLccsZd98 lXNH1M6j/Ohvm6EufLWcldeKdYieUymMJ8FnChiilGYfKKHxLl5sY5K9uCGPAT1szQ5I 6RcwSriw208jVxzMZPAYkTI6seSSoh9hiX3XFsk0QHOs44485DkMfNF5buwqxF+O1Q9O J01X/bcdEj2R8YaUZikPgogOUkc0PqTqqZn2ewNzyN74neny1CRkWQd7dWvyzVSWQrQK uxfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FbeomFaa6+4pcqkI+KqeQ68MOm87xvtqaaFYiHM2EB8=; b=wAk0e+IEBgOykfs/hL3kyX4VPoLFN9iySRUINpLdAjjcHQOdMSHMln0f4tSGRNd/RX hGbBpVyTcoCypyZEE+kLLJIbHm4ziT7GL3dfgfR0ExnFgiqXy1gJxLwzPvDEbkDtMEd7 cfQTaFoW1XZkP57D0XXPFsZas4Kn40Zws4FNykJhGxQxoLBfQdVsWT7reMnSaLv8d88H dx7ZvM2HXcDh0l+Jru78z253t6+qBcGK1zQwgEML3JT6Nml+LVclkviZx9TLNCtD1Klp WxqhYmbuFVgV2tDjClkAQbIbBrNIFGlZJgIHY6m3W7xCB3DeS8gCRm+wjMdZwyJCcdE8 vU5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0b1mx3j8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j5-20020a170902da8500b00153b2d164fesi15951025plx.262.2022.04.06.05.55.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:55:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0b1mx3j8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 27CF96276F7; Wed, 6 Apr 2022 03:03:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452151AbiDEWba (ORCPT + 99 others); Tue, 5 Apr 2022 18:31:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354465AbiDEKOT (ORCPT ); Tue, 5 Apr 2022 06:14:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 680DD6A412; Tue, 5 Apr 2022 03:00:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 005AD61673; Tue, 5 Apr 2022 10:00:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FF8CC385A2; Tue, 5 Apr 2022 10:00:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152814; bh=zuWpzdPaWVlOnSzO7xa3prmeFzhLS8bq/wrxFIGlBkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0b1mx3j8hH/ydLkeaMlJmIUcysKQkZD6AzL6+7Qqh2ctYTxgO1pVw+tlwk3rBw4ED wO59KScxFrErWJDruRtuQjmGse5tW8nA4ZlrZ6KWIeWNhHBNhDgsg41D4AEo8v0Td2 c3fKIF+NgiwYwr2CdRZKxlfU6MIzDQR98r4PzbXY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Igor Zhbanov , Hugh Dickins , Andrew Morton , Linus Torvalds Subject: [PATCH 5.15 873/913] mm/mmap: return 1 from stack_guard_gap __setup() handler Date: Tue, 5 Apr 2022 09:32:15 +0200 Message-Id: <20220405070405.991759491@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Randy Dunlap commit e6d094936988910ce6e8197570f2753898830081 upstream. __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: /sbin/init with environment: HOME=/ TERM=linux BOOT_IMAGE=/boot/bzImage-517rc5 stack_guard_gap=100 Return 1 to indicate that the boot option has been handled. Note that there is no warning message if someone enters: stack_guard_gap=anything_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 == 0 is valid (if unexpected) since using "stack_guard_gap=0" on the kernel command line does that. Link: https://lkml.kernel.org/r/20220222005817.11087-1-rdunlap@infradead.org Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru Fixes: 1be7107fbe18e ("mm: larger stack guard gap, between vmas") Signed-off-by: Randy Dunlap Reported-by: Igor Zhbanov Cc: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2551,7 +2551,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);