Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5542436pxb; Tue, 16 Feb 2021 00:49:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzoTDKbat9qmw7eEc6zaMJjibO0+oaikxPKcMs3oPWt0Zky763IxPU4rW0yMm6BKx7XZbYo X-Received: by 2002:a17:907:7784:: with SMTP id ky4mr19038197ejc.89.1613465365661; Tue, 16 Feb 2021 00:49:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613465365; cv=none; d=google.com; s=arc-20160816; b=B4R4WnKxhoBzcm3uV4iMgzRkjvP/lnsiEQfPhhZd8lp2YSy7/xxDZV8yc6iA8SKmer 2GX89JBpaWA9gUP6oTVZ796pKD44yeoN38Vik9xhZS52QCG5elVXpPA76blOa9RtYGFc VuMIvenT7xOXxPZCDncKNtkiUm36oitRB805wTezv3ahNTF9WyH1RlLGeJ4lHif0wD2Z B3n9r769THeVZQcqXP7xmT7l9sPXCPVpOAzQeyCICYcCKP/TQ+uK6YciVMqe11VRFp7P qFkvt60cQJQfcMHeLh0hlLr3Dlx8y4XYpcm6KbrW+KwXSiavbclm/Cr2856L8pnlvKc3 Q4Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=gG8QnG5W700qhN14Fxy2O0MxZuv7nC8Rbh70nTsQYnA=; b=a13LKCSZa2JS81XYpFGcOxCWZSfucEuHxYp6UqmfCEIn1GYDqy5/XPo6uS8mJD1bHC 5mpWY6pNTPohOsvCdEWpYYodxPEFY/nk5I1ktNpemFwtI1ImtS+XcE4J0+TFbT2zsuBM 7DPrWkTBrMUEMaJ8eiyT+CTjS4Ni9OgvNrNLUyi00wBEU2SOR/dF29pl1vOxiIupA/L7 hL4soO/EjvF86GrgyDsrvCZOgUe2z91w9VtTuDGorOCCmIhWnsKXsqVMB9Q/jHs33m55 xmzOLmACeQvwZ9WW/BNAZI0PM0BqAyxraqjsbTGtrrsfZswdGbv3mJg7NOuGqRjBsiGn 2zNw== 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 w16si14023632edi.602.2021.02.16.00.49.02; Tue, 16 Feb 2021 00:49:25 -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 S230005AbhBPIsP (ORCPT + 99 others); Tue, 16 Feb 2021 03:48:15 -0500 Received: from verein.lst.de ([213.95.11.211]:40376 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229828AbhBPIsL (ORCPT ); Tue, 16 Feb 2021 03:48:11 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id 59A2B6736F; Tue, 16 Feb 2021 09:47:28 +0100 (CET) Date: Tue, 16 Feb 2021 09:47:28 +0100 From: Christoph Hellwig To: "Alex Xu (Hello71)" Cc: linux-kernel@vger.kernel.org, Luis Chamberlain , Kees Cook , Christoph Hellwig , Andrey Ignatov , Al Viro , Iurii Zaikin , Alexey Dobriyan , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] proc_sysctl: clamp sizes using table->maxlen Message-ID: <20210216084728.GA23731@lst.de> References: <20210215145305.283064-1-alex_y_xu.ref@yahoo.ca> <20210215145305.283064-1-alex_y_xu@yahoo.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210215145305.283064-1-alex_y_xu@yahoo.ca> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 15, 2021 at 09:53:05AM -0500, Alex Xu (Hello71) wrote: > Since maxlen is already exposed, we can allocate approximately the right > amount directly, fixing up those drivers which set a bogus maxlen. These > drivers were located based on those which had copy_x_user replaced in > 32927393dc1c, on the basis that other drivers either use builtin proc_* > handlers, or do not access the data pointer. The latter is OK because > maxlen only needs to be an upper limit. Please split this into one patch each each subsystem that sets maxlen to 0 and the actual change to proc_sysctl.c. How do these maxlen = 0 entries even survive the sysctl_check_table check?