netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	pabeni@redhat.com, Johannes Berg <johannes@sipsolutions.net>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	Nicolas Dichtel <nicolas.dichtel@6wind.com>,
	Guillaume Nault <gnault@redhat.com>,
	Florent Fourcot <florent.fourcot@wifirst.fr>,
	Florian Westphal <fw@strlen.de>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Jacob Keller <jacob.e.keller@intel.com>,
	Hangbin Liu <liuhangbin@gmail.com>
Subject: Re: [PATCH net-next RESEND] genetlink: reject use of nlmsg_flags for new commands
Date: Thu, 29 Sep 2022 08:55:12 -0700	[thread overview]
Message-ID: <20220929085512.17be934f@kernel.org> (raw)
In-Reply-To: <YzW+ml81tM9Rlt1i@salvia>

On Thu, 29 Sep 2022 17:49:46 +0200 Pablo Neira Ayuso wrote:
> On Thu, Sep 29, 2022 at 08:06:50AM -0700, Jakub Kicinski wrote:
> > > 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.

I don't think it is and I don't think I silently clear both.
Here's the code again:

+	flags = nlh->nlmsg_flags;
+	if ((flags & NLM_F_DUMP) == NLM_F_DUMP) /* DUMP is 2 bits */
+		flags &= ~NLM_F_DUMP;
+	if (flags & ~(NLM_F_REQUEST | NLM_F_ACK | NLM_F_ECHO)) {
+		NL_SET_ERR_MSG(extack,
+			       "ambiguous or reserved bits set in nlmsg_flags");
+		return -EINVAL;
+	}

  reply	other threads:[~2022-09-29 15:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29 14:28 [PATCH net-next RESEND] genetlink: reject use of nlmsg_flags for new commands Jakub Kicinski
2022-09-29 14:53 ` Pablo Neira Ayuso
2022-09-29 15:06   ` Jakub Kicinski
2022-09-29 15:49     ` Pablo Neira Ayuso
2022-09-29 15:55       ` Jakub Kicinski [this message]
2022-09-29 17:27         ` Keller, Jacob E
2022-10-01  1:10 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220929085512.17be934f@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=florent.fourcot@wifirst.fr \
    --cc=fw@strlen.de \
    --cc=gnault@redhat.com \
    --cc=jacob.e.keller@intel.com \
    --cc=jhs@mojatatu.com \
    --cc=johannes@sipsolutions.net \
    --cc=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=razor@blackwall.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).