From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15ED8C433E0 for ; Tue, 16 Feb 2021 08:48:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C9CED64DF0 for ; Tue, 16 Feb 2021 08:48:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229977AbhBPIsO (ORCPT ); Tue, 16 Feb 2021 03:48:14 -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-fsdevel@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?