Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3618546pxb; Tue, 19 Apr 2022 06:43:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuFLjeKaO2eo5ovPcfG9ryjO/7BInSxx1qJ+zRmUUX/WougbwuzafnCO3TGqKbhT3zI6tG X-Received: by 2002:a05:6402:3509:b0:423:f906:8e2d with SMTP id b9-20020a056402350900b00423f9068e2dmr5363636edd.333.1650375788776; Tue, 19 Apr 2022 06:43:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650375788; cv=none; d=google.com; s=arc-20160816; b=R3DNKcmrDe77M16e/CIh/phmC/s/I5Aco6Q+AoA5wsr4BgnNmVbL/+qwS5/4aiNEee 9fCWMZ4HePZZRE9+Nvc38tgrxAU+5C1+biTh0nveF3kX+CMBaN/q0tKGL+zFfpt8t1mR EzFv1ilSPBkqlX81RduxNH2p7KOFP0wzmRKeXNrd+aPx1TjSjfXBTVkNibFw/N8Hdhbt 3Te/fZ27vrBVaoSUxn32EQKowb0jDiOxIdEp6Gi6FD/gGaXeHyphK4+1NCR1ggzgOkOB 9OVrzzQy3kFlzfAHB0yiXwOCFD3RM6n11zGyxsrgElpJdsgHm4xTU/HpnBcSoojgm+7B zlnQ== 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=N627MPVhvsFFluDNSR1Oo7tlxgNnTkLIqmF+ttjFbBA=; b=eby4F581/WNir2V5GgX1/Ebxk2066oMAw/HNECnPKOk9BL6PNvubUu93OFu38y6ySW S64FrLSjkFyq4GuqmrKU6rUsmx9iGHRDpexzgvuZxvEnA/b2IDUU9MA8KhDS6Nbd/J72 554XsmhpF2aNXg6A+PvxOQyiD6Ac8wPUKsNxvkczkc5LBjk8QMmt0DiDnjvLBY7T7LM0 K15kGlEzCE5DRgZADYaXJTnJtOVjAEK/FB17nwS7Pl5LpTGm0b7LQUVfbYdSAOsVrd0E vZObWSNvYKMDogcr3JtTYl03yYWhdfFZUcdUYX+guWQdWa9kRhfvPBT37glJx9FrIhgh livQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eVVCWb0u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id re9-20020a170906d8c900b006df76385d22si7972072ejb.450.2022.04.19.06.42.43; Tue, 19 Apr 2022 06:43:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eVVCWb0u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244130AbiDRN5D (ORCPT + 99 others); Mon, 18 Apr 2022 09:57:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244894AbiDRNbA (ORCPT ); Mon, 18 Apr 2022 09:31:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA19FBAB; Mon, 18 Apr 2022 05:57:12 -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 ams.source.kernel.org (Postfix) with ESMTPS id 98439B80E44; Mon, 18 Apr 2022 12:57:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7641C385A8; Mon, 18 Apr 2022 12:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286630; bh=h5D9dmTuXR5USw/iDEBW2gw/P3OCRNs4k9/IFHHvGtM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eVVCWb0u7IIdpMIYyrnUtACFz18pjpSRJgzxAAoBe+ZsF1TM7sps1OM3UdxM9H+bC u7DIL3aqXXJ8Z8QZ6RQKgghiQFlVymkbwCWvOiS8Y/N34jNeYINBU/Ne5rD4g8Mios naaTCay8/DZ+KfrfcrhklgO18j8ZceFSDWrzEURM= 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 4.14 195/284] mm/mmap: return 1 from stack_guard_gap __setup() handler Date: Mon, 18 Apr 2022 14:12:56 +0200 Message-Id: <20220418121217.275014933@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@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=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 @@ -2426,7 +2426,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);