History

pps: fix padding issue with PPS_FETCH for ioctl_compat

Issue is that x86 32-bit aligns to 4-bytes instead of 8-bytes so this patchset works around the issue and corrects the data returned in pps_fdata_compat.

Matt Ranostay committed 9 years ago

Commit c2a49fe1 parent 2ac66652 files · +98 −31Browse files

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

Unified · Split

include/uapi/linux/pps.h+19−0
@@ -55,6 +55,12 @@ struct pps_ktime { · 54 unmodified lines
5555 __s32 nsec;
5656 __u32 flags;
5757 };
58+
59+struct pps_ktime_compat {
60+ __s64 sec;
61+ __s32 nsec;
62+ __u32 flags;
63+} __attribute__((packed, aligned(4)));
5864 #define PPS_TIME_INVALID (1<<0) /* used to specify timeout==NULL */
5965
6066 struct pps_kinfo {
@@ -65,6 +71,14 @@ struct pps_kinfo { · 4 unmodified lines
6571 int current_mode; /* current mode bits */
6672 };
6773
74+struct pps_kinfo_compat {
75+ __u32 assert_sequence; /* seq. num. of assert event */
76+ __u32 clear_sequence; /* seq. num. of clear event */
77+ struct pps_ktime_compat assert_tu; /* time of assert event */
78+ struct pps_ktime_compat clear_tu; /* time of clear event */
79+ int current_mode; /* current mode bits */
80+};
81+
6882 struct pps_kparams {
6983 int api_version; /* API version # */
7084 int mode; /* mode bits */
@@ -114,6 +128,11 @@ struct pps_fdata { · 43 unmodified lines
114128 struct pps_ktime timeout;
115129 };
116130
131+struct pps_fdata_compat {
132+ struct pps_kinfo_compat info;
133+ struct pps_ktime_compat timeout;
134+};
135+
117136 struct pps_bind_args {
118137 int tsformat; /* format of time stamps */
119138 int edge; /* selected event type */