Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp974141ybk; Fri, 15 May 2020 19:49:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxEcv1Emirepyv5sCscfIHU7Ax2tCspmDy2ZDlKd1prPI9KjOlwOffxnA+SZoUG5X1my5T X-Received: by 2002:a17:906:7e15:: with SMTP id e21mr5842717ejr.106.1589597348595; Fri, 15 May 2020 19:49:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589597348; cv=none; d=google.com; s=arc-20160816; b=no3GvxERqJsITW8VcPjo1IePMx3uVCO2P6sSU4td/WzsNBbkz2a692IsE5uetp+YIE XWRFsKyQpcTvXocfhJg4oYzBK4wEUf1o4vHL2XrwVnn0hAv5dGHIKHnnmNQyPhXXkXR+ QIPxmtGN4pYCok9pobheBryIub0Zh1+Z4vbRxGbmTsQnh4gISyU+tZkIZuthdJm+LZb4 3utGc1MM71dWBxKWLaNLpYl4Jg37L19mE+OhQsqFuEP2Kr7LwjE5CIMiZxni5Lf0vsAU WwQqZTINV2m5/Wi7ILWPNUJHd6R/WdNkoV6cbwGy5vDmdn1M2k1gxLxCQcq6wSfTqmvz KKDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=mzee7s7lzKP00VYAVwMN3kmoIGL9oQCKmVseoYr6QOg=; b=TqbrUlOCDAC7Gyj882/8I8DBooAbUXtIMcrtedsSVLpYBx827/Ef+ZMmMyo4ecrMr2 zkkYFSvRNx+0zX+su8q0m38MsiJDwL5UQzZUMyNxRNhdmFWkt34YsVI82ppOsLW0WIYR A2ZWejn+leLZCkFKawtKJg3Xu1j07oFz3o1fex/co1LHDFKWiBaEM6mwb/LXFVqpW7mD 6ll5vSzLlDe+RjErqH8UYhFhF/EyOnAMmEVbZvA9/qjN9SuXm8C5hDdAns3HmQu3zNFe bLlLArE9injjh1+phQAw4a6qSahONgb67VbdvNbtI0RRzA+r/BpyIO+MJwcmey57Lneh bPZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Ajt4lgwm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i23si2421585edg.437.2020.05.15.19.48.45; Fri, 15 May 2020 19:49:08 -0700 (PDT) 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; dkim=pass header.i=@chromium.org header.s=google header.b=Ajt4lgwm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726946AbgEPCrG (ORCPT + 99 others); Fri, 15 May 2020 22:47:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726247AbgEPCrG (ORCPT ); Fri, 15 May 2020 22:47:06 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3120DC05BD09 for ; Fri, 15 May 2020 19:47:06 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id r10so1888213pgv.8 for ; Fri, 15 May 2020 19:47:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=mzee7s7lzKP00VYAVwMN3kmoIGL9oQCKmVseoYr6QOg=; b=Ajt4lgwmAaiaLF1LOfai+aUHBtRYpEEy0IcA3j4C72JhsD46IFDWXT3O8Gr3I7F4+w V7X9I8Z00bb4eV1Z0dETv1dm7pVCfdm9au7ReU7qaGMc1QVIYgD4tOGrhlm2OFAi9EV+ zfbCU7o/W0Mq2OppjXUjVbp+grE6cQJwQEtFQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mzee7s7lzKP00VYAVwMN3kmoIGL9oQCKmVseoYr6QOg=; b=nC/hLTXEmeKlGOXopfuuSCPgueRf9ExVcSUELsotn0CickFI+z7Z4zwDv7pSsMzjIq 9Je64056ZJWNN09vtz8ogkAtQgsLpCEBE2Cd6M6Afk21mG8Lc/Tpn7c+HvLELBAb050G NmkDlxfiNZtV8vL7nTo+FH2P9GMOiRcS6WP3IMXOqXcLyojUE+g+vjkdsCHQiX9Aqdc7 CBUHQpJA6iYIaM5SIh361p2Qkd3OMRgQQPPIwcYDw7GjNFkkx9nCg6o8zrkadjQHxeJr a8vbk9v8DfOiJweDbfs7C9WxnpLXl8vT8KscOK9rG7xYAA2UjJupcomqgTnhmiipybHx J0BA== X-Gm-Message-State: AOAM532qYBemijLV8dlLvlHxoiBP1aRCbt01Fpdq5D9zp6ISbqJkKbCP CDIcDkiVpwgvYdC5tXtsb4jKrQ== X-Received: by 2002:a62:29c3:: with SMTP id p186mr6830376pfp.237.1589597225614; Fri, 15 May 2020 19:47:05 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id i9sm3000708pfk.199.2020.05.15.19.47.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 19:47:04 -0700 (PDT) Date: Fri, 15 May 2020 19:47:03 -0700 From: Kees Cook To: Xiaoming Ni Cc: mcgrof@kernel.org, yzaikin@google.com, adobriyan@gmail.com, mingo@kernel.org, peterz@infradead.org, akpm@linux-foundation.org, yamada.masahiro@socionext.com, bauerman@linux.ibm.com, gregkh@linuxfoundation.org, skhan@linuxfoundation.org, dvyukov@google.com, svens@stackframe.org, joel@joelfernandes.org, tglx@linutronix.de, Jisheng.Zhang@synaptics.com, pmladek@suse.com, bigeasy@linutronix.de, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, wangle6@huawei.com Subject: Re: [PATCH 2/4] proc/sysctl: add shared variables -1 Message-ID: <202005151946.C6335E92@keescook> References: <1589517224-123928-1-git-send-email-nixiaoming@huawei.com> <1589517224-123928-3-git-send-email-nixiaoming@huawei.com> <202005150105.33CAEEA6C5@keescook> <88f3078b-9419-b9c6-e789-7d6e50ca2cef@huawei.com> <202005150904.743BB3E52@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 16, 2020 at 10:32:19AM +0800, Xiaoming Ni wrote: > On 2020/5/16 0:05, Kees Cook wrote: > > On Fri, May 15, 2020 at 05:06:28PM +0800, Xiaoming Ni wrote: > > > On 2020/5/15 16:06, Kees Cook wrote: > > > > On Fri, May 15, 2020 at 12:33:42PM +0800, Xiaoming Ni wrote: > > > > > Add the shared variable SYSCTL_NEG_ONE to replace the variable neg_one > > > > > used in both sysctl_writes_strict and hung_task_warnings. > > > > > > > > > > Signed-off-by: Xiaoming Ni > > > > > --- > > > > > fs/proc/proc_sysctl.c | 2 +- > > > > > include/linux/sysctl.h | 1 + > > > > > kernel/hung_task_sysctl.c | 3 +-- > > > > > kernel/sysctl.c | 3 +-- > > > > > > > > How about doing this refactoring in advance of the extraction patch? > > > Before advance of the extraction patch, neg_one is only used in one file, > > > does it seem to have no value for refactoring? > > > > I guess it doesn't matter much, but I think it's easier to review in the > > sense that neg_one is first extracted and then later everything else is > > moved. > > > Later, when more features sysctl interface is moved to the code file, there > will be more variables that need to be extracted. > So should I only extract the neg_one variable here, or should I extract all > the variables used by multiple features? Hmm -- if you're going to do a consolidation pass, then nevermind, I don't think order will matter then. Thank you for the cleanup! Sorry we're giving you back-and-forth advice! -Kees -- Kees Cook