All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] netlink: export policy on validation failures
@ 2020-10-06 18:15 Johannes Berg
  2020-10-06 18:15 ` [PATCH v2 1/2] netlink: policy: refactor per-attr policy writing Johannes Berg
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Johannes Berg @ 2020-10-06 18:15 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, Jakub Kicinski

Export the policy used for attribute validation when it fails,
so e.g. for an out-of-range attribute userspace immediately gets
the valid ranges back.

v2 incorporates the suggestion from Jakub to have a function to
estimate the size (netlink_policy_dump_attr_size_estimate()) and
check that it does the right thing on the *normal* policy dumps,
not (just) when calling it from the error scenario.


Tested using nl80211/iw in a few scenarios, seems to work fine
and return the policy back, e.g.

kernel reports: integer out of range
policy: 04 00 0b 00 0c 00 04 00 01 00 00 00 00 00 00 00 
        ^ padding
                    ^ minimum allowed value
policy: 04 00 0b 00 0c 00 05 00 ff ff ff ff 00 00 00 00 
        ^ padding
                    ^ maximum allowed value
policy: 08 00 01 00 04 00 00 00 
        ^ type 4 == U32

for an out-of-range case.

johannes



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-10-07 17:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-06 18:15 [PATCH v2 0/2] netlink: export policy on validation failures Johannes Berg
2020-10-06 18:15 ` [PATCH v2 1/2] netlink: policy: refactor per-attr policy writing Johannes Berg
2020-10-07 17:06   ` Jakub Kicinski
2020-10-06 18:15 ` [PATCH v2 2/2] netlink: export policy in extended ACK Johannes Berg
2020-10-07 17:06   ` Jakub Kicinski
2020-10-07 17:06 ` [PATCH v2 0/2] netlink: export policy on validation failures Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.