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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 395E6C433FE for ; Thu, 29 Sep 2022 15:50:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234421AbiI2PuC (ORCPT ); Thu, 29 Sep 2022 11:50:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235064AbiI2Pt4 (ORCPT ); Thu, 29 Sep 2022 11:49:56 -0400 Received: from mail.netfilter.org (mail.netfilter.org [217.70.188.207]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4B1DF13D56 for ; Thu, 29 Sep 2022 08:49:49 -0700 (PDT) Date: Thu, 29 Sep 2022 17:49:46 +0200 From: Pablo Neira Ayuso To: Jakub Kicinski Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, Johannes Berg , Nikolay Aleksandrov , Nicolas Dichtel , Guillaume Nault , Florent Fourcot , Florian Westphal , Jamal Hadi Salim , Jacob Keller , Hangbin Liu Subject: Re: [PATCH net-next RESEND] genetlink: reject use of nlmsg_flags for new commands Message-ID: References: <20220929142809.1167546-1-kuba@kernel.org> <20220929080650.370b5977@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220929080650.370b5977@kernel.org> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, Sep 29, 2022 at 08:06:50AM -0700, Jakub Kicinski wrote: > On Thu, 29 Sep 2022 16:53:34 +0200 Pablo Neira Ayuso wrote: > > > + flags = nlh->nlmsg_flags; > > > + if ((flags & NLM_F_DUMP) == NLM_F_DUMP) /* DUMP is 2 bits */ > > > + flags &= ~NLM_F_DUMP; > > > > no bail out for incorrectly set NLM_F_DUMP flag? > > Incorrectly? Special handling is because we want to make sure both bits > are set for DUMP, if they are not we'll not clear them here and the > condition below will fire. Or do you mean some other incorrectness? I have seen software in the past setting only one of the bits in the NLM_F_DUMP bitmask to request a dump. I agree that userspace software relying in broken semantics and that software should be fixed. What I am discussing if silently clearing the 2 bits is the best approach.