Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp426175rwd; Thu, 8 Jun 2023 02:44:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4jpsWe8MTDGavv6EOWj9TfcWLYBBbwlx1p8x+mwXAEVAZFyT1QrZ3Jja/xEeD8vIxNzNml X-Received: by 2002:a05:6359:2a0:b0:129:cc43:2ebd with SMTP id ek32-20020a05635902a000b00129cc432ebdmr7039457rwb.23.1686217485441; Thu, 08 Jun 2023 02:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686217485; cv=none; d=google.com; s=arc-20160816; b=FF43rmTPo+XwBT1kjNoZMf9m3124fRwYB0XM9DA6nKESplzU6oSY/VGE8ZsZtUUlVp pH/mYMxIpyL3PPjW9/c1sm+rkvoZ939IZv5VqtSWCkZ7cUI/okhTxoA1bSJjopV680zp fwRoGQamkID2EZRhnpJ1cx+hejLwyKi7rPLvGvYSK6z9Y8a1ZNiVPTdv5QRdPBchCUCF rQ3YRvgP9VELp+GGiwkQ+1r2QuAcrd8O1D4nZR/pTN3YBfJ0TOnt6g8aIKDMcwAjGXW0 yORpNBnDEyLs0ZXUxpMge46YW3jlVG9F2KKeHMQBOdw14MSDmKQjCaZI7XpnAj12/By0 l8gg== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=OIrkpJgJcTmSUZwGomf3JIB1HqfYmxKGKsUJ1BGx8L8=; b=WvREpmuhW8c/apQ2DP9Oy7Dg4OpJ3Bz1E7Sui3ushNXkAyzvGOLPSiCB6OUdSqbFF/ Jhsh5JEgsCPTxCwLQsbYEDok8Gg/cCebpJMmNFDfIaCxBAsFqdNcnLR4/uRc1Ss3Zq5U 47LlY3IcxMnb95xClG2kjbDmTYM3pwr+IzVeFzGjUnGzMA46wBLwGil95r6ZiwiHQXIO xlgtqP+TSPf7/l4Ey4t0vabPqrckTZZYmqwTEu9AI8nB/b38Yg820zqVRV8jNf4UIZzo r1PMN0LuRDBNJAbDX23BAaFqiHHx3BVYiJ2/xP9wstO2FzW22RhSVvnLWT4+JbdVVoM/ Vrxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sangfor.com.cn Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w2-20020a637b02000000b00543b170259fsi722301pgc.539.2023.06.08.02.44.32; Thu, 08 Jun 2023 02:44:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sangfor.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233921AbjFHJGz (ORCPT + 99 others); Thu, 8 Jun 2023 05:06:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233071AbjFHJGv (ORCPT ); Thu, 8 Jun 2023 05:06:51 -0400 Received: from mail-m11875.qiye.163.com (mail-m11875.qiye.163.com [115.236.118.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ACA3E50; Thu, 8 Jun 2023 02:06:44 -0700 (PDT) Received: from [0.0.0.0] (unknown [172.96.223.238]) by mail-m11875.qiye.163.com (Hmail) with ESMTPA id ADB3928086B; Thu, 8 Jun 2023 17:06:34 +0800 (CST) Message-ID: <034f5393-e519-1e8d-af76-ae29677a1bf5@sangfor.com.cn> Date: Thu, 8 Jun 2023 17:06:31 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [PATCH net-next] net: ethtool: Fix out-of-bounds copy to user Content-Language: en-US To: Jakub Kicinski Cc: Alexander Duyck , Andrew Lunn , davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, pengdonglin@sangfor.com.cn, huangcun@sangfor.com.cn References: <20230601112839.13799-1-dinghui@sangfor.com.cn> <135a45b2c388fbaf9db4620cb01b95230709b9ac.camel@gmail.com> <6110cf9f-c10e-4b9b-934d-8d202b7f5794@lunn.ch> <6e28cea9-d615-449d-9c68-aa155efc8444@lunn.ch> <44905acd-3ac4-cfe5-5e91-d182c1959407@sangfor.com.cn> <20230602225519.66c2c987@kernel.org> <5f0f2bab-ae36-8b13-2c6d-c69c6ff4a43f@sangfor.com.cn> <20230604104718.4bf45faf@kernel.org> <20230605113915.4258af7f@kernel.org> From: Ding Hui In-Reply-To: <20230605113915.4258af7f@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVlCTEgYVk9IHUJOGhhNShpIGlUTARMWGhIXJBQOD1 lXWRgSC1lBWUpMSVVCTVVJSUhVSUhDWVdZFhoPEhUdFFlBWU9LSFVKSktISkxVSktLVUtZBg++ X-HM-Tid: 0a889a420a612eb1kusnadb3928086b X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6OAg6Nyo*TT1MDC8qST8tLUkD Sw4KCzNVSlVKTUNNSUpOSUtLSUxMVTMWGhIXVR8SFRwTDhI7CBoVHB0UCVUYFBZVGBVFWVdZEgtZ QVlKTElVQk1VSUlIVUlIQ1lXWQgBWUFIQkxNNwY+ X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/6/6 2:39, Jakub Kicinski wrote: > On Mon, 5 Jun 2023 11:39:59 +0800 Ding Hui wrote: >> Case 1: >> If the user len/n_stats is not zero, we will treat it as correct usage >> (although we cannot distinguish between the real correct usage and >> uninitialized usage). Return -EINVAL if current length exceed the one >> user specified. > > This assumes user will zero-initialize the value rather than do > something like: > > buf = malloc(1 << 16); // 64k should always be enough > ioctl(s, ETHTOOL_GSTATS, buf) > > for (i = 0; i < buf.n_stats; i++) > /* use stats */ > > :( > Sorry for late. Now I'm not sure what can I do next besides reporting the issue. >> Case 2: >> If it is zero, we will treat it as incorrect usage, we can add a >> pr_err_once() for it and keep to be compatible with it for a period of time. >> At a suitable time in the future, this part can be removed by maintainers. > -- Thanks, - Ding Hui