diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2015-02-23 10:13:40 -0500 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2015-02-27 13:05:56 -0500 |
commit | 9d42d48a342aee208c1154696196497fdc556bbf (patch) | |
tree | 6984daeb050a874f4e4e96eb1093c2ed2e3de69f | |
parent | a1e50a82256ed2f1312e70c52a84323e2e378f49 (diff) |
arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian
The native (64-bit) sigval_t union contains sival_int (32-bit) and
sival_ptr (64-bit). When a compat application invokes a syscall that
takes a sigval_t value (as part of a larger structure, e.g.
compat_sys_mq_notify, compat_sys_timer_create), the compat_sigval_t
union is converted to the native sigval_t with sival_int overlapping
with either the least or the most significant half of sival_ptr,
depending on endianness. When the corresponding signal is delivered to a
compat application, on big endian the current (compat_uptr_t)sival_ptr
cast always returns 0 since sival_int corresponds to the top part of
sival_ptr. This patch fixes copy_siginfo_to_user32() so that sival_int
is copied to the compat_siginfo_t structure.
Cc: <stable@vger.kernel.org>
Reported-by: Bamvor Jian Zhang <bamvor.zhangjian@huawei.com>
Tested-by: Bamvor Jian Zhang <bamvor.zhangjian@huawei.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r-- | arch/arm64/kernel/signal32.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c index c20a300e2213..d26fcd4cd6e6 100644 --- a/arch/arm64/kernel/signal32.c +++ b/arch/arm64/kernel/signal32.c | |||
@@ -154,8 +154,7 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) | |||
154 | case __SI_TIMER: | 154 | case __SI_TIMER: |
155 | err |= __put_user(from->si_tid, &to->si_tid); | 155 | err |= __put_user(from->si_tid, &to->si_tid); |
156 | err |= __put_user(from->si_overrun, &to->si_overrun); | 156 | err |= __put_user(from->si_overrun, &to->si_overrun); |
157 | err |= __put_user((compat_uptr_t)(unsigned long)from->si_ptr, | 157 | err |= __put_user(from->si_int, &to->si_int); |
158 | &to->si_ptr); | ||
159 | break; | 158 | break; |
160 | case __SI_POLL: | 159 | case __SI_POLL: |
161 | err |= __put_user(from->si_band, &to->si_band); | 160 | err |= __put_user(from->si_band, &to->si_band); |
@@ -184,7 +183,7 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) | |||
184 | case __SI_MESGQ: /* But this is */ | 183 | case __SI_MESGQ: /* But this is */ |
185 | err |= __put_user(from->si_pid, &to->si_pid); | 184 | err |= __put_user(from->si_pid, &to->si_pid); |
186 | err |= __put_user(from->si_uid, &to->si_uid); | 185 | err |= __put_user(from->si_uid, &to->si_uid); |
187 | err |= __put_user((compat_uptr_t)(unsigned long)from->si_ptr, &to->si_ptr); | 186 | err |= __put_user(from->si_int, &to->si_int); |
188 | break; | 187 | break; |
189 | case __SI_SYS: | 188 | case __SI_SYS: |
190 | err |= __put_user((compat_uptr_t)(unsigned long) | 189 | err |= __put_user((compat_uptr_t)(unsigned long) |