Nicolin Chen
7caf6c4bc2
iommufd: Fix struct iommu_hwpt_pgfault init and padding
commit e721f619e3 upstream.
The iommu_hwpt_pgfault is used to report IO page fault data to userspace,
but iommufd_fault_fops_read was never zeroing its padding. This leaks the
content of the kernel stack memory to userspace.
Also, the iommufd uAPI requires explicit padding and use of __aligned_u64
to ensure ABI compatibility's with 32 bit.
pahole result, before:
struct iommu_hwpt_pgfault {
__u32 flags; /* 0 4 */
__u32 dev_id; /* 4 4 */
__u32 pasid; /* 8 4 */
__u32 grpid; /* 12 4 */
__u32 perm; /* 16 4 */
/* XXX 4 bytes hole, try to pack */
__u64 addr; /* 24 8 */
__u32 length; /* 32 4 */
__u32 cookie; /* 36 4 */
/* size: 40, cachelines: 1, members: 8 */
/* sum members: 36, holes: 1, sum holes: 4 */
/* last cacheline: 40 bytes */
};
pahole result, after:
struct iommu_hwpt_pgfault {
__u32 flags; /* 0 4 */
__u32 dev_id; /* 4 4 */
__u32 pasid; /* 8 4 */
__u32 grpid; /* 12 4 */
__u32 perm; /* 16 4 */
__u32 __reserved; /* 20 4 */
__u64 addr __attribute__((__aligned__(8))); /* 24 8 */
__u32 length; /* 32 4 */
__u32 cookie; /* 36 4 */
/* size: 40, cachelines: 1, members: 9 */
/* forced alignments: 1 */
/* last cacheline: 40 bytes */
} __attribute__((__aligned__(8)));
Fixes: c714f15860 ("iommufd: Add fault and response message definitions")
Link: https://patch.msgid.link/r/20250120195051.2450-1-nicolinc@nvidia.com
Cc: stable@vger.kernel.org
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-02-17 10:05:31 +01:00
..
2024-07-31 13:56:00 +02:00
2024-06-20 11:52:56 +02:00
2024-04-15 13:42:38 +02:00
2024-06-30 11:29:17 +01:00
2024-07-12 10:11:43 +02:00
2024-09-26 17:14:35 +02:00
2025-02-17 10:05:04 +01:00
2024-09-11 11:23:56 +02:00
2024-07-29 01:19:51 +01:00
2024-02-19 10:58:24 +00:00
2024-08-22 17:25:59 +08:00
2024-08-20 14:02:22 -04:00
2024-08-30 08:22:36 +02:00
2024-02-16 12:42:59 +11:00
2024-08-28 06:53:58 -07:00
2024-09-11 10:45:28 -06:00
2024-10-24 10:17:12 -07:00
2024-07-11 15:33:28 +02:00
2024-03-05 17:13:24 +01:00
2024-02-13 11:47:13 +01:00
2024-08-08 15:23:21 +02:00
2024-05-24 10:36:55 +01:00
2024-08-28 06:53:58 -07:00
2024-04-02 10:49:38 +08:00
2024-04-30 08:48:10 -07:00
2024-04-08 14:10:45 +01:00
2024-06-11 12:57:49 -05:00
2024-06-05 14:52:15 +05:30
2024-08-26 19:21:14 -07:00
2024-09-17 14:46:17 +02:00
2024-08-26 09:33:58 -07:00
2024-08-23 13:04:34 +01:00
2024-02-14 11:01:01 +00:00
2024-09-18 07:40:56 +09:00
2024-08-28 16:53:57 +02:00
2024-12-14 20:03:48 +01:00
2024-01-27 18:08:54 -08:00
2024-09-05 11:39:17 +02:00
2024-09-13 21:15:44 -07:00
2024-07-21 17:15:46 -07:00
2024-09-04 16:51:11 +02:00
2024-02-15 08:44:57 +01:00
2024-05-07 01:35:57 +02:00
2024-08-29 10:39:37 +02:00
2024-05-06 11:13:56 +02:00
2024-12-09 10:40:56 +01:00
2024-08-26 09:37:22 -07:00
2024-04-02 18:24:33 -07:00
2024-04-01 10:49:28 +01:00
2024-07-25 11:57:27 +02:00
2024-02-27 18:22:49 -08:00
2024-09-04 16:40:33 -07:00
2024-08-26 09:37:23 -07:00
2024-08-26 09:37:23 -07:00
2024-03-06 13:13:00 +01:00
2025-02-17 10:04:55 +01:00
2024-09-14 08:51:15 -06:00
2024-02-28 11:19:41 +00:00
2024-08-22 10:45:12 +02:00
2025-02-17 10:05:31 +01:00
2024-06-01 07:28:21 +02:00
2024-09-01 20:26:05 -07:00
2024-04-23 14:59:01 +10:00
2024-09-06 17:55:05 -04:00
2024-05-02 16:18:13 -04:00
2024-07-16 09:53:05 -04:00
2024-09-16 23:50:52 +02:00
2024-09-12 20:28:46 -07:00
2024-08-19 22:36:26 -04:00
2024-05-08 17:29:24 -04:00
2024-02-22 13:32:55 +01:00
2024-09-11 20:53:43 -07:00
2024-04-29 14:56:36 +02:00
2024-02-22 10:24:46 -08:00
2024-07-19 20:22:12 +02:00
2024-06-28 14:36:43 +02:00
2024-04-11 08:19:54 -07:00
2024-09-06 08:31:40 -06:00
2024-09-10 16:55:23 -07:00
2024-09-11 20:44:32 -07:00
2024-08-12 17:50:34 -07:00
2024-07-08 13:47:25 -04:00
2024-05-06 12:47:24 -04:00
2024-07-08 14:10:05 -04:00
2024-07-09 11:29:59 +02:00
2024-09-16 11:15:26 +02:00
2024-04-11 15:34:40 +02:00
2024-07-05 17:45:47 -07:00
2024-04-25 12:37:12 -07:00
2024-09-19 14:25:26 -05:00
2024-07-04 16:00:38 +02:00
2024-06-28 10:37:29 +02:00
2024-08-14 20:37:47 -07:00
2024-05-22 09:56:00 -07:00
2024-07-05 17:45:47 -07:00
2024-08-14 13:05:42 -04:00
2024-09-08 18:40:33 +01:00
2024-07-19 20:22:48 +02:00
2024-08-14 16:42:58 +03:00
2024-12-05 14:01:53 +01:00
2024-06-18 10:09:17 -10:00
2024-01-27 18:15:24 -08:00
2024-09-05 20:11:43 +02:00
2024-07-16 11:44:00 -04:00
2024-08-20 11:38:23 +02:00
2024-05-01 10:06:27 +02:00
2024-06-20 15:19:17 -06:00
2025-01-02 10:34:16 +01:00
2024-07-01 09:44:27 +01:00
2024-05-13 14:48:04 -07:00
2024-04-03 14:03:09 +02:00
2024-07-03 16:40:45 -04:00
2024-10-16 08:08:18 -06:00
2024-04-18 11:38:23 +02:00
2024-09-11 20:44:32 -07:00
2024-07-03 12:24:54 +02:00
2024-03-18 10:13:03 -04:00
2024-06-10 10:24:30 +02:00
2024-04-29 14:56:36 +02:00
2024-04-29 14:56:37 +02:00
2024-08-22 16:56:24 -07:00
2024-09-10 02:51:48 -04:00
2024-01-27 18:08:54 -08:00
2024-04-08 04:11:04 -04:00
2024-09-05 20:10:34 +02:00
2024-09-10 02:51:48 -04:00
2024-05-14 10:54:49 -04:00
2024-07-24 20:49:42 +03:00
2024-05-22 08:31:15 -04:00
2024-04-30 10:51:32 +02:00
2024-03-19 02:45:49 -04:00
2024-02-09 14:01:15 +01:00
2025-02-08 09:58:00 +01:00
2024-06-04 08:59:58 +02:00