drm/tegra: Remove gratuitous pad field
PATCH 1/1 drm/tegra: Remove gratuitous pad field
From: Thierry Reding <[email protected]>
The version of the drm_tegra_submit structure that was merged all the way back in 3.10 contains a pad field that was originally intended to properly pad the following __u64 field. Unfortunately it seems like a different field was dropped during review that caused this padding to become unnecessary, but the pad field wasn't removed at that time.
One possible side-effect of this is that since the __u64 following the pad is now no longer properly aligned, the compiler may (or may not) introduce padding itself, which results in no predictable ABI.
Rectify this by removing the pad field so that all fields are again naturally aligned. Technically this is breaking existing userspace ABI, but given that there aren't any (released) userspace drivers that make use of this yet, the fallout should be minimal.
--- include/uapi/drm/tegra_drm.h | 1 - 1 file changed, 1 deletion(-)
include/uapi/drm/tegra_drm.h +0 -1
@@ -120,7 +120,6 @@ struct drm_tegra_submit {__u32 num_waitchks;__u32 waitchk_mask;__u32 timeout; -__u32 pad;__u64 syncpts;__u64 cmdbufs;__u64 relocs;
Signature · 1 line
1.9.1
cc: stable to make sure that even once you release userspace you won't get angry bug reports?
-Daniel
Quoted 41 lines · Thierry Reding
From: Thierry Reding <[email protected]>
The version of the
drm_tegra_submitstructure that was merged all the way back in 3.10 contains a pad field that was originally intended to properly pad the following__u64field. Unfortunately it seems like a different field was dropped during review that caused this padding to become unnecessary, but the pad field wasn't removed at that time.One possible side-effect of this is that since the
__u64following the pad is now no longer properly aligned, the compiler may (or may not) introduce padding itself, which results in no predictable ABI.Rectify this by removing the pad field so that all fields are again naturally aligned. Technically this is breaking existing userspace ABI, but given that there aren't any (released) userspace drivers that make use of this yet, the fallout should be minimal.
Signed-off-by Thierry Reding <[email protected]>--- include/uapi/drm/tegra_drm.h | 1 - 1 file changed, 1 deletion(-)include/uapi/drm/tegra_drm.h +0
-2@@ -120,7 +120,6 @@ struct drm_tegra_submit {__u32 num_waitchks;__u32 waitchk_mask;__u32 timeout; -__u32 pad;__u64 syncpts;__u64 cmdbufs;__u64 relocs; --1.9.1
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 2 lines · Daniel Vetter
cc: stable to make sure that even once you release userspace you won't get angry bug reports?
Yes, good point. I was just pondering whether doing that would be smart or not. But I came to the same conclusion.
Thierry
Quoted 40 lines
-Daniel
Quoted 37 lines · Thierry Reding
From: Thierry Reding <[email protected]>
The version of the
drm_tegra_submitstructure that was merged all the way back in 3.10 contains a pad field that was originally intended to properly pad the following__u64field. Unfortunately it seems like a different field was dropped during review that caused this padding to become unnecessary, but the pad field wasn't removed at that time.One possible side-effect of this is that since the
__u64following the pad is now no longer properly aligned, the compiler may (or may not) introduce padding itself, which results in no predictable ABI.Rectify this by removing the pad field so that all fields are again naturally aligned. Technically this is breaking existing userspace ABI, but given that there aren't any (released) userspace drivers that make use of this yet, the fallout should be minimal.
Signed-off-by Thierry Reding <[email protected]>--- include/uapi/drm/tegra_drm.h | 1 - 1 file changed, 1 deletion(-)include/uapi/drm/tegra_drm.h +0
-2@@ -120,7 +120,6 @@ struct drm_tegra_submit {__u32 num_waitchks;__u32 waitchk_mask;__u32 timeout; -__u32 pad;__u64 syncpts;__u64 cmdbufs;__u64 relocs; --1.9.1
Quoted 11 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-develSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 28 lines · Thierry Reding
From: Thierry Reding <[email protected]>
The version of the
drm_tegra_submitstructure that was merged all the way back in 3.10 contains a pad field that was originally intended to properly pad the following__u64field. Unfortunately it seems like a different field was dropped during review that caused this padding to become unnecessary, but the pad field wasn't removed at that time.One possible side-effect of this is that since the
__u64following the pad is now no longer properly aligned, the compiler may (or may not) introduce padding itself, which results in no predictable ABI.Rectify this by removing the pad field so that all fields are again naturally aligned. Technically this is breaking existing userspace ABI, but given that there aren't any (released) userspace drivers that make use of this yet, the fallout should be minimal.
Signed-off-by Thierry Reding <[email protected]>--- include/uapi/drm/tegra_drm.h | 1 - 1 file changed, 1 deletion(-)include/uapi/drm/tegra_drm.h +0
-0
include/uapi/drm/tegra_drm.h struct drm_tegra_submit { · line 125
Quoted 7 lines
include/uapi/drm/tegra_drm.h +0
-1@@ -120,7 +120,6 @@ struct drm_tegra_submit {__u32 num_waitchks;__u32 waitchk_mask;__u32 timeout; -__u32 pad;__u64 syncpts;__u64 cmdbufs;__u64 relocs;
The padding is hilarious. I added it to remove the possibility for compiler to add implicit padding, but it does completely the opposite.
If we'd care about binary compatibility, we could have also just added __packed to the definition. But as this is in staging, I don't think that's necessary.
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------