Commit 89067c2daf3d9e0ce51c768589e79e845e6fda42
1 parent
c517d838eb
tile: use si_int instead of si_ptr for compat_siginfo
To be compatible with the generic get_compat_sigevent(), the copy_siginfo_to_user32() and thus copy_siginfo_from_user32() have to use si_int instead of si_ptr. Using si_ptr means that for the case of ILP32 compat code running in big-endian mode, we would end up copying the high 32 bits of the pointer value into si_int instead of the desired low 32 bits. Signed-off-by: Chris Metcalf <cmetcalf@ezchip.com> Cc: Catalin Marinas <catalin.marinas@arm.com>
Showing 1 changed file with 5 additions and 6 deletions Side-by-side Diff
arch/tile/kernel/compat_signal.c
... | ... | @@ -68,7 +68,7 @@ |
68 | 68 | if (from->si_code < 0) { |
69 | 69 | err |= __put_user(from->si_pid, &to->si_pid); |
70 | 70 | err |= __put_user(from->si_uid, &to->si_uid); |
71 | - err |= __put_user(ptr_to_compat(from->si_ptr), &to->si_ptr); | |
71 | + err |= __put_user(from->si_int, &to->si_int); | |
72 | 72 | } else { |
73 | 73 | /* |
74 | 74 | * First 32bits of unions are always present: |
... | ... | @@ -93,8 +93,7 @@ |
93 | 93 | break; |
94 | 94 | case __SI_TIMER >> 16: |
95 | 95 | err |= __put_user(from->si_overrun, &to->si_overrun); |
96 | - err |= __put_user(ptr_to_compat(from->si_ptr), | |
97 | - &to->si_ptr); | |
96 | + err |= __put_user(from->si_int, &to->si_int); | |
98 | 97 | break; |
99 | 98 | /* This is not generated by the kernel as of now. */ |
100 | 99 | case __SI_RT >> 16: |
101 | 100 | |
102 | 101 | |
... | ... | @@ -110,19 +109,19 @@ |
110 | 109 | int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from) |
111 | 110 | { |
112 | 111 | int err; |
113 | - u32 ptr32; | |
114 | 112 | |
115 | 113 | if (!access_ok(VERIFY_READ, from, sizeof(struct compat_siginfo))) |
116 | 114 | return -EFAULT; |
117 | 115 | |
116 | + memset(to, 0, sizeof(*to)); | |
117 | + | |
118 | 118 | err = __get_user(to->si_signo, &from->si_signo); |
119 | 119 | err |= __get_user(to->si_errno, &from->si_errno); |
120 | 120 | err |= __get_user(to->si_code, &from->si_code); |
121 | 121 | |
122 | 122 | err |= __get_user(to->si_pid, &from->si_pid); |
123 | 123 | err |= __get_user(to->si_uid, &from->si_uid); |
124 | - err |= __get_user(ptr32, &from->si_ptr); | |
125 | - to->si_ptr = compat_ptr(ptr32); | |
124 | + err |= __get_user(to->si_int, &from->si_int); | |
126 | 125 | |
127 | 126 | return err; |
128 | 127 | } |