The padding field in the structure was previously reserved to
maintain a stable interface for potential new fields, ensuring
compatibility with user-space shared data structures.
However,it was accidentally removed by tiantao in a prior commit,
which may lead to incompatibility between user space and the kernel.
This patch reinstates the padding to restore the original structure
layout and preserve compatibility.
Fixes: 8ddde07a3d28 ("dma-mapping: benchmark: extract a common header file for map_benchmark definition")
Cc: stable@vger.kernel.org
Acked-by: Barry Song <baohua@kernel.org>
Signed-off-by: Qinxin Xia <xiaqinxin@huawei.com>
---
include/linux/map_benchmark.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/map_benchmark.h b/include/linux/map_benchmark.h
index 62674c83bde4..2ac2fe52f248 100644
--- a/include/linux/map_benchmark.h
+++ b/include/linux/map_benchmark.h
@@ -27,5 +27,6 @@ struct map_benchmark {
__u32 dma_dir; /* DMA data direction */
__u32 dma_trans_ns; /* time for DMA transmission in ns */
__u32 granule; /* how many PAGE_SIZE will do map/unmap once a time */
+ __u8 expansion[76]; /* For future use */
};
#endif /* _KERNEL_DMA_BENCHMARK_H */
--
2.33.0
On Sat, 14 Jun 2025 22:34:51 +0800 Qinxin Xia <xiaqinxin@huawei.com> wrote: > The padding field in the structure was previously reserved to > maintain a stable interface for potential new fields, ensuring > compatibility with user-space shared data structures. > However,it was accidentally removed by tiantao in a prior commit, > which may lead to incompatibility between user space and the kernel. > > This patch reinstates the padding to restore the original structure > layout and preserve compatibility. > > Fixes: 8ddde07a3d28 ("dma-mapping: benchmark: extract a common header file for map_benchmark definition") > Cc: stable@vger.kernel.org > Acked-by: Barry Song <baohua@kernel.org> > Signed-off-by: Qinxin Xia <xiaqinxin@huawei.com> FWIW I checked the patch above indeed accidentally dropped the padding and the structure is copied to userspace so this fix is correct. Given it's not in a uapi header this only really affects the selftest I think this is mostly a case of there possibly being out of tree tools with a local copy of this structure definition. Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
On Mon, Jun 16, 2025 at 9:53 PM Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote: > > On Sat, 14 Jun 2025 22:34:51 +0800 > Qinxin Xia <xiaqinxin@huawei.com> wrote: > > > The padding field in the structure was previously reserved to > > maintain a stable interface for potential new fields, ensuring > > compatibility with user-space shared data structures. > > However,it was accidentally removed by tiantao in a prior commit, > > which may lead to incompatibility between user space and the kernel. > > > > This patch reinstates the padding to restore the original structure > > layout and preserve compatibility. > > > > Fixes: 8ddde07a3d28 ("dma-mapping: benchmark: extract a common header file for map_benchmark definition") > > Cc: stable@vger.kernel.org > > Acked-by: Barry Song <baohua@kernel.org> > > Signed-off-by: Qinxin Xia <xiaqinxin@huawei.com> > > FWIW I checked the patch above indeed accidentally dropped the padding and the structure > is copied to userspace so this fix is correct. Given it's not in a uapi header this > only really affects the selftest I think this is mostly a case of there possibly being > out of tree tools with a local copy of this structure definition. Somehow, I feel we have placed tools/testing/selftests/dma/dma_map_benchmark.c in the wrong location. As a selftest, it should have a mechanism to check kernel dependencies, start properly and automatically, and report pass or fail. dma_map_benchmark.c seems more like a tool that belongs in tools/dma, rather than a test. > > Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Thanks Barry
On 16.06.2025 12:40, Barry Song wrote: > On Mon, Jun 16, 2025 at 9:53 PM Jonathan Cameron > <Jonathan.Cameron@huawei.com> wrote: >> On Sat, 14 Jun 2025 22:34:51 +0800 >> Qinxin Xia <xiaqinxin@huawei.com> wrote: >>> The padding field in the structure was previously reserved to >>> maintain a stable interface for potential new fields, ensuring >>> compatibility with user-space shared data structures. >>> However,it was accidentally removed by tiantao in a prior commit, >>> which may lead to incompatibility between user space and the kernel. >>> >>> This patch reinstates the padding to restore the original structure >>> layout and preserve compatibility. >>> >>> Fixes: 8ddde07a3d28 ("dma-mapping: benchmark: extract a common header file for map_benchmark definition") >>> Cc: stable@vger.kernel.org >>> Acked-by: Barry Song <baohua@kernel.org> >>> Signed-off-by: Qinxin Xia <xiaqinxin@huawei.com> >> FWIW I checked the patch above indeed accidentally dropped the padding and the structure >> is copied to userspace so this fix is correct. Given it's not in a uapi header this >> only really affects the selftest I think this is mostly a case of there possibly being >> out of tree tools with a local copy of this structure definition. > Somehow, I feel we have placed > tools/testing/selftests/dma/dma_map_benchmark.c in the wrong location. > As a selftest, it should have a mechanism to check kernel dependencies, > start properly and automatically, and report pass or fail. > > dma_map_benchmark.c seems more like a tool that belongs in tools/dma, > rather than a test. Indeed imho it would be better to move it out of selftests directory. Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland
© 2016 - 2025 Red Hat, Inc.