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:06:50 -0700 [thread overview]
Message-ID: <20220929080650.370b5977@kernel.org> (raw)
In-Reply-To: <YzWxbrXkvsjnl50R@salvia>
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?
> > + 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;
>
> While adding new netlink flags is a very rare event, this is going to
> make it harder to add new flags to be added in the future, else
> userspace has to probe for supported flags first.
The only difference in terms of probing is whether the unsupported
case silently ignores the flag or reports a clear error. So I think
I'm only making things better there.
> Regarding error reporting - even if error reporting in netlink is also
> not consistent accross subsystems - I think EINVAL should be used for
> malformed netlink messages, eg. a message that is missing a mandatory
> attribute.
>
> EOPNOTSUPP might be a better pick?
All current "reserved bits" checking I know of return -EINVAL
(the strict checks in the ip stack and policy based checks).
next prev parent reply other threads:[~2022-09-29 15:06 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 [this message]
2022-09-29 15:49 ` Pablo Neira Ayuso
2022-09-29 15:55 ` Jakub Kicinski
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=20220929080650.370b5977@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).