We don't have good validation policy for existing unsigned int attrs which serve as flags (for new ones we could use NLA_BITFIELD32). With increased use of policy dumping having the validation be expressed as part of the policy is important. Add validation policy in form of a mask of supported/valid bits. Support u64 in the uAPI to be future-proof, but really for now the embedded mask member can only hold 32 bits, so anything with bit 32+ set will always fail validation.
Showing the changes to include/uapi (1 of 4 files). Show all
Unified · Split
| @@ -331,6 +331,7 @@ enum netlink_attribute_type { · 330 unmodified lines | ||
| 331 | 331 | * the index, if limited inside the nesting (U32) |
| 332 | 332 | * @NL_POLICY_TYPE_ATTR_BITFIELD32_MASK: valid mask for the |
| 333 | 333 | * bitfield32 type (U32) |
| 334 | + * @NL_POLICY_TYPE_ATTR_MASK: mask of valid bits for unsigned integers (U64) | |
| 334 | 335 | * @NL_POLICY_TYPE_ATTR_PAD: pad attribute for 64-bit alignment |
| 335 | 336 | */ |
| 336 | 337 | enum netlink_policy_type_attr { |
| @@ -346,6 +347,7 @@ enum netlink_policy_type_attr { · 9 unmodified lines | ||
| 346 | 347 | NL_POLICY_TYPE_ATTR_POLICY_MAXTYPE, |
| 347 | 348 | NL_POLICY_TYPE_ATTR_BITFIELD32_MASK, |
| 348 | 349 | NL_POLICY_TYPE_ATTR_PAD, |
| 350 | + NL_POLICY_TYPE_ATTR_MASK, | |
| 349 | 351 | |
| 350 | 352 | /* keep last */ |
| 351 | 353 | __NL_POLICY_TYPE_ATTR_MAX, |