Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp556789lqp; Thu, 21 Mar 2024 08:48:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVg5HU1n2Si8VadfZ7L9AK7MkNri533j0/mBoGnDFoa3+8iPrqd8Z2hXzrJX6qEjILrW5ZEfXnVikMXcrscnY4f0WiG+H/IOs92Y2oIlw== X-Google-Smtp-Source: AGHT+IFklHCJa6wH8/yGYCaJwW9MxCfHUxKc7nBS4UxXlAAnK2qmLdspuzNHzkuC9akLnTI15saF X-Received: by 2002:a05:6a00:1746:b0:6e6:fcd4:5a23 with SMTP id j6-20020a056a00174600b006e6fcd45a23mr2480709pfc.32.1711036126774; Thu, 21 Mar 2024 08:48:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711036126; cv=pass; d=google.com; s=arc-20160816; b=HI8Kq57Qtw8ih+1ZgzCKpJDrim4lxPmnNPPYx9suFas5EFOCsgWXs+aGC2azxA6kxg mz2BTzCgQAC0i/2HfhGRcGWiTRNnuBkIkSFwqTCKcZorB88T+BykN6EIBQB3V2Hek59y FiePS4XI+YEBrqYOPQVYAaBZ0SOeD8oET6cP71C4mcrUKiqTSC+GqKRwzcWcz5wn52XU /RIvQzoW6rwr4nGVh1ciqAZYM9+Vi7XU3/1gnr7BHboeMOO5X8blnZIt4pGWKGYfnZz9 sk+QH/PMYHNf8x0ROeqdAN88pvE8+c4sx/RQkmWDFzK2y1rPAvTPc9BZOkj8enaUjsPO 4voA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=eFb5mGkBNhSImhI4kWEKhUE6z0crGzcN6/hptGkBZi0=; fh=GuKOjKhFs/N2SLzmlfA7lJQrBPDtYgKpIavPVxH+TlY=; b=fBAA3g7TesQAmGibzJYucpAn5oi42mSLjc/uVvTZmtE/YTeK4GvkudES7Qc6g1Cc5a fg83Xlp/05eYuPbo9ODrJjqPbyPrErXa+3HXxWSwZ3Fr8o81y6N26KABICTWJ0DiXnry DBI/q8Iww6oRt0whzDABFuzked8+QjVbq93dvsUm3O6wC6be0wDB6dBe7BP2JV8spwjf JIDoSA+FmWdTiLUHnw9ZeQo/mlIXS/PT280mTBz5DJQkHhRcNBDLXoyonyG4uojSeEA7 3Qd5aJzdUSD9ApoO9V64a1eLNUCO1PQHdlQbneFRsD2c+ll3uoY22IfzCR/OsyEoVYe2 NAiA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=HhUFPzpk; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-110279-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110279-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id z21-20020a631915000000b005dbde399b23si5946pgl.901.2024.03.21.08.48.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 08:48:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110279-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=HhUFPzpk; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-110279-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110279-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E899C282AED for ; Thu, 21 Mar 2024 15:48:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A9F5486257; Thu, 21 Mar 2024 15:47:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b="HhUFPzpk" Received: from out203-205-251-72.mail.qq.com (out203-205-251-72.mail.qq.com [203.205.251.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C058A1E879 for ; Thu, 21 Mar 2024 15:47:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.205.251.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711036076; cv=none; b=PIPWgG/AEKwkUrYx6ZiJUyrwUsNFDp619Ipojqw5r2cJsWem2sLeBYXy33xIiKHoki9lViSBbVSRyjSdWluUGIOhBGLBGnBZGqsZS9aeOHEEe7rKR7+Oi9LEcmENgVOt95T8wUz8QZkBwqYBhJ3X3neX2FjOEHNNj0o9aNF8rug= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711036076; c=relaxed/simple; bh=jeeFGFpFQcMeiPnqG1XhNR17H2LPGzyB/MVHRtQ7nxA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jY10qaRPTMcivkGCBt9+8q4QsRO1a3Myk8PnYyNdIycei+Eq7M2AgQZCpFkWL7eh+wG2fZwCoB5Io4ip+KlSXE3UZrDoQSW3kMWLTkVcPiG/BW1Mb7eRm/GXcGLKD+tYc/83jdX/AIOXEUf5gw8Ddh4KTL8cn00Yp7QW5jUV5a4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com; spf=pass smtp.mailfrom=foxmail.com; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b=HhUFPzpk; arc=none smtp.client-ip=203.205.251.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foxmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1711036064; bh=eFb5mGkBNhSImhI4kWEKhUE6z0crGzcN6/hptGkBZi0=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=HhUFPzpknp/Nrd9zQtSJBBPC9/4ryBOd+sXJEUVmFTs5iKC2r9XvANoNn/zXpSFza yFNdePCAlbDjjLWNNpSsi3Y59dv1N+cslmejn2l3BDWrmSl9wb3glyj5xMwdyH6uaf m/7+XyEaQj5wxS30vkJ59AI39dW69CImwNMtGAmY= Received: from [IPV6:2409:8961:2b17:549c:98ce:49d:c167:4134] ([2409:8961:2b17:549c:98ce:49d:c167:4134]) by newxmesmtplogicsvrszb9-1.qq.com (NewEsmtp) with SMTP id 9CAAC4C3; Thu, 21 Mar 2024 23:39:10 +0800 X-QQ-mid: xmsmtpt1711035550tfx2v8zko Message-ID: X-QQ-XMAILINFO: OFXVMg8LeyWMW6CuZuhrlYUls5evNkZeZR7IwrVp+YzTm/M0xFaWG9TSeMujhq ZYZacY2WgZPrUfRq9J48NYt9QMpF0t3jHP3nbRBfVyODkrj5TRPTsFxvQxRGa2U/2ZMAfxbEUved n4cCty2V7pz/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 21 Mar 2024 23:39:10 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v2 0/9] encode the values directly in the table entry Content-Language: en-US To: Joel Granados Cc: "Eric W . Biederman" , Luis Chamberlain , Kees Cook , Christian Brauner , linux-kernel@vger.kernel.org References: <20240321152143.yxoonjy3m6bdddkf@joelS2.panther.com> From: Wen Yang In-Reply-To: <20240321152143.yxoonjy3m6bdddkf@joelS2.panther.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024/3/21 23:21, Joel Granados wrote: > On Sat, Mar 09, 2024 at 06:31:17PM +0800, wenyang.linux@foxmail.com wrote: >> From: Wen Yang >> >> The boundary check of multiple modules uses these static variables (such as >> two_five_five, n_65535, ue_int_max, etc), and they are also not changed. > This message is a bit cryptic. I had to do a fair amount of research to > get what you meant here. Having the context in front is OK with me, but > I would add a bit more information so the reader does not have to go to > the code and grep for the variables that you mean. Something like this: > "When using a sysctl proc_handler that requires a boundary check (like > proce_dointvec_minmax) it is common to use a const variable like n_65535 > in net/rxrpc/sysctl.c or OTHER EXAMPLES...). This is suboptimal because > YOUR REASONS HERE" > > Thanks a lot for your very considerate input – this is highly appreciated. We will revise the change message and send v3 later. -- Best wishes, Wen >> >> Eric points out: "by turning .extra1 and .extra2 into longs instead of >> keeping them as pointers and needing constants to be pointed at somewhere >> ... The only people I can see who find a significant benefit by >> consolidating all of the constants into one place are people who know how >> to stomp kernel memory." > I think it would be better to just link to the lore discussion. > >> >> This patch series achieves direct encoding values in table entries and still >> maintains compatibility with existing extra1/extra2 pointers. >> Afterwards, we can remove these unnecessary static variables progressively and >> also gradually kill the shared const array. > Two things: > 1. Please name the const array: sysctl_vals > 2. What is missing from this patchset to completely kill sysctl_vals? > >> >> Wen Yang (9): >> sysctl: support encoding values directly in the table entry >> kernel/sysctl-test: add some kunit test cases for min/max detection >> rxrpc: delete these unnecessary static variables n_65535, four, >> max_500, etc >> net: ipv6: delete these unnecessary static variables two_five_five and >> minus_one >> svcrdma: delete these unnecessary static variables min_ord, max_ord, >> etc >> sysctl: delete these unnecessary static variables i_zero and >> i_one_hundred >> epoll: delete these unnecessary static variables long_zero and >> long_max >> fs: inotify: delete these unnecessary static variables it_zero and >> it_int_max >> ucounts: delete these unnecessary static variables ue_zero and >> ue_int_max >> >> fs/eventpoll.c | 19 +- >> fs/notify/inotify/inotify_user.c | 49 +++-- >> include/linux/sysctl.h | 108 ++++++++++- >> kernel/sysctl-test.c | 300 +++++++++++++++++++++++++++++++ >> kernel/sysctl.c | 61 +++++-- >> kernel/ucount.c | 8 +- >> lib/test_sysctl.c | 12 +- >> net/ipv6/addrconf.c | 15 +- >> net/rxrpc/sysctl.c | 169 ++++++++--------- >> net/sunrpc/xprtrdma/svc_rdma.c | 21 +-- >> 10 files changed, 571 insertions(+), 191 deletions(-) >> >> Cc: Eric W. Biederman >> Cc: Luis Chamberlain >> Cc: Kees Cook >> Cc: Joel Granados >> Cc: Christian Brauner >> Cc: linux-kernel@vger.kernel.org >> >> -- >> 2.25.1 >> >