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=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 81AD6C4363C for ; Wed, 7 Oct 2020 08:29:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C6B220B1F for ; Wed, 7 Oct 2020 08:29:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727519AbgJGI3M (ORCPT ); Wed, 7 Oct 2020 04:29:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725976AbgJGI3M (ORCPT ); Wed, 7 Oct 2020 04:29:12 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D79E5C061755 for ; Wed, 7 Oct 2020 01:29:11 -0700 (PDT) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1kQ4oo-000mUR-Ri; Wed, 07 Oct 2020 10:29:02 +0200 Message-ID: <7f26de5605d4d19eda19f35b2a239d7098fad7b3.camel@sipsolutions.net> Subject: Re: [PATCH net-next v2 0/7] ethtool: allow dumping policies to user space From: Johannes Berg To: Leon Romanovsky Cc: David Miller , kuba@kernel.org, netdev@vger.kernel.org, kernel-team@fb.com, jiri@resnulli.us, andrew@lunn.ch, mkubecek@suse.cz, Saeed Mahameed Date: Wed, 07 Oct 2020 10:29:01 +0200 In-Reply-To: <20201007082437.GV1874917@unreal> References: <20201005220739.2581920-1-kuba@kernel.org> <7586c9e77f6aa43e598103ccc25b43415752507d.camel@sipsolutions.net> <20201006.062618.628708952352439429.davem@davemloft.net> <20201007062754.GU1874917@unreal> <20201007082437.GV1874917@unreal> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, 2020-10-07 at 11:24 +0300, Leon Romanovsky wrote: > On Wed, Oct 07, 2020 at 09:30:51AM +0200, Johannes Berg wrote: > > On Wed, 2020-10-07 at 09:27 +0300, Leon Romanovsky wrote: > > > This series and my guess that it comes from ff419afa4310 ("ethtool: trim policy tables") > > > generates the following KASAN out-of-bound error. > > > > Interesting. I guess that is > > > > req_info->counts_only = tb[ETHTOOL_A_STRSET_COUNTS_ONLY]; > > > > which basically means that before you never actually *use* the > > ETHTOOL_A_STRSET_COUNTS_ONLY flag, but of course it shouldn't be doing > > this ... > > > > Does this fix it? > > Yes, it fixed KASAN, but it we got new failure after that. Good. I'm not very familiar with ethtool netlink tbh :) > 11:07:51 player_id: 1 shell.py:62 [LinuxEthtoolAgent] DEBUG : running command(/opt/mellanox/ethtool/sbin/ethtool --set-channels eth2 combined 3) with pid: 13409 > 11:07:51 player_id: 1 protocol.py:605 [OpSetChannels] ERROR : RC:1, STDERR: > netlink error: Unknown attribute type (offset 36) > netlink error: Invalid argument That's even stranger, since strict validation should've meant this was always rejected? Hmm. Oh, copy/paste error I guess, try this: diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c index 8a85a4e6be9b..50d3c8896f91 100644 --- a/net/ethtool/netlink.c +++ b/net/ethtool/netlink.c @@ -830,8 +830,8 @@ static const struct genl_ops ethtool_genl_ops[] = { .cmd = ETHTOOL_MSG_CHANNELS_SET, .flags = GENL_UNS_ADMIN_PERM, .doit = ethnl_set_channels, - .policy = ethnl_channels_get_policy, - .maxattr = ARRAY_SIZE(ethnl_channels_get_policy) - 1, + .policy = ethnl_channels_set_policy, + .maxattr = ARRAY_SIZE(ethnl_channels_set_policy) - 1, }, { .cmd = ETHTOOL_MSG_COALESCE_GET, johannes