Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1095350pxb; Sat, 16 Jan 2021 19:02:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0jD5WrwBRBdPp/e9H5KWzM72Tl3l2HM0WG40UKpk2llrpRKorapIY77EFNOU9eKJVd3oF X-Received: by 2002:a17:906:76c9:: with SMTP id q9mr13874230ejn.484.1610852575220; Sat, 16 Jan 2021 19:02:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610852575; cv=none; d=google.com; s=arc-20160816; b=S8ZiJflurmjcPJtWwXRpYcJvgwMWu5+/9F642NrqCuSAhNY7yIuLA4yM0EHFoaP4XT 8mXZxr9A/YI6IYay9uIBa+8VZlc6lSkkTcE2aFl6Edb/lgi45IQ3Gt9gVA76qiYE08aS 7De/fFWM4pRE71RRHaHe9KjNIqwAAFiQG3vL73edsR5nRYv2iqqAaMgcaRFqiY046Hhv NhEJevZZ2f01sXi/SI1Bb5hRBH65Ki3bcRk9wypjEPOV90UYJ1A2kCzHmZeJ81DGEirq kYNGuct5KcEsylWuJVSchrUPCrG8JAq6NKVizd+/G7Njb75QaGtLeRG8Pw+WVc8NbErI lAJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=t3eFiQxZ3yG1MO6/QKRgTnB6IM4KiRPUXOPIRSbL6eQ=; b=zuqeb1yrMz6c9M36LMXLGJvu0d/cmKZP7cYvOFyuqSvRjOE8qCfJmrOUOdDG0fdZeo 2CWmxHQBY5+Fq7Y0K/TlIvLA8zsPmgOmwnugPXjH8DvqlkxqbzdkZNpFEeuuY49ShNoU MJ2OXVzkMNgjH+D+mrlAy/BaB1HZqMxviIQUYWSIhhR4uRnsGCkg64jYvW4GP+afQK58 qCiNudCHmkD/AnVAcEr4bnpRxGuuenIRryOFavXcwJ98PqRDxkw++tYBjQv61jXXeNc4 H6I/EZ+8EKYdf/ipVw/U5o0CmTOZLAv8StyQb0BXTHpSGCx9WWgKIugOVS1yj6/cFjO+ CuuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n12si4221687edo.512.2021.01.16.19.02.32; Sat, 16 Jan 2021 19:02:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728089AbhAQDAf (ORCPT + 99 others); Sat, 16 Jan 2021 22:00:35 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:11030 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727868AbhAQDAc (ORCPT ); Sat, 16 Jan 2021 22:00:32 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4DJKPK4T4hzj77H; Sun, 17 Jan 2021 10:58:45 +0800 (CST) Received: from [10.67.102.197] (10.67.102.197) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.498.0; Sun, 17 Jan 2021 10:59:43 +0800 Subject: Re: [PATCH v3] proc_sysctl: fix oops caused by incorrect command parameters. To: Vlastimil Babka , Michal Hocko , "Andrew Morton" , , CC: , , , , , , , References: <20210112033155.91502-1-nixiaoming@huawei.com> <20210111203340.98dd3c8fa675b709bcf6d49e@linux-foundation.org> <89d1369e-f0a8-66f2-c0ea-3aac3a55e2c1@huawei.com> <20210111222845.67ceb4e3c7f64f267756e4e8@linux-foundation.org> <20210112072406.GF22493@dhcp22.suse.cz> From: Xiaoming Ni Message-ID: Date: Sun, 17 Jan 2021 10:59:37 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.0.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.102.197] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/1/12 19:42, Vlastimil Babka wrote: > On 1/12/21 8:24 AM, Michal Hocko wrote: >>>>> >>>>> If we're going to do a separate "patch: make process_sysctl_arg() >>>>> return an errno instead of 0" then fine, we can discuss that. But it's >>>>> conceptually a different work from fixing this situation. >>>>> . >>>>> >>>> However, are the logs generated by process_sysctl_arg() clearer and more >>>> accurate than parse_args()? Should the logs generated by >>>> process_sysctl_arg() be deleted? >>> >>> I think the individual logs are very useful and should be retained. >> >> Yes, other sysfs specific error messages are likely useful. I just fail >> to see why a missing value should be handled here when there is an >> existing handling in the caller. Not sure whether a complete shadow >> reporting in process_sysctl_arg is a deliberate decision or not. >> Vlastimil? > > Yes, it's a way to have more useful sysctl-specific reports than the generic > ones. And I think I was inspired by some other existing code, but don't remember > exactly. The options are: > > 1) the current sysctl-specific reports, return 0 as the values are only consumed > 2) be silent and return error, invent new error codes to have generic report be > more useful for sysctl, but inevitably lose some nuances anyway > 3) a mix where 2) is used for situations where generic report is sufficient > enough, 1) where not > > Patch v2 went with option 1), v3 with option 3). I think it's down to > preferences. I would personally go with v2 and message similar to the existing > ones, i.e.: > > "Failed to set sysctl parameter '%s': no value given\n" > > Also we seem to be silently doing nothing when strlen(val) == 0, i.e. > "hung_task_panic=" was passed. Worth reporting the same error. > > But v3 is fine with me as well. The generic error message works. We could just > add "if (!len) return -EINVAL" below the strlen() call. > > Also please Cc: stable. > >> Anyway one way or the other, all I care about is to have a reporting in >> place because this shouldn't be a silent failure. >> The current v2 is already in the linux-next branch and throws a new error: https://lore.kernel.org/lkml/cb54e349-7147-0a1f-a349-1e16ba603fce@infradead.org/ This bug has been mentioned in the previous discussion and has been fixed in the current v3 patch. https://lore.kernel.org/linux-fsdevel/202101111149.20A58E1@keescook/ What am I supposed to do now? - Resend V3? - Rewrite a new fix patch based on the current code of linux-next. - Develop a new V4 patch: Use V2 to discuss how to use the Patch4 solution. https://lore.kernel.org/linux-fsdevel/bc098af4-c0cd-212e-d09d-46d617d0acab@huawei.com/#t Thanks Xiaoming Ni