History

iommu/uapi: Use named union for user data

IOMMU UAPI data size is filled by the user space which must be validated by the kernel. To ensure backward compatibility, user data can only be extended by either re-purpose padding bytes or extend the variable sized union at the end. No size change is allowed before the union. Therefore, the minimum size is the offset of the union. To use offsetof() on the union, we must make it named.

Jacob Pan committed 6 years ago

Commit 8d3bb3b1 parent 1e6aaae3 files · +14 −14Browse files

Showing the changes to include/uapi/linux (1 of 3 files). Show all

Unified · Split

include/uapi/linux/iommu.h+2−2
@@ -267,7 +267,7 @@ struct iommu_cache_invalidate_info { · 266 unmodified lines
267267 union {
268268 struct iommu_inv_pasid_info pasid_info;
269269 struct iommu_inv_addr_info addr_info;
270− };
270+ } granu;
271271 };
272272
273273 /**
@@ -333,7 +333,7 @@ struct iommu_gpasid_bind_data { · 59 unmodified lines
333333 /* Vendor specific data */
334334 union {
335335 struct iommu_gpasid_bind_data_vtd vtd;
336− };
336+ } vendor;
337337 };
338338
339339 #endif /* _UAPI_IOMMU_H */