@@ -21,6 +21,28 @@
int ilp32_setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set,
struct pt_regs *regs);
+static inline int put_sigset_t(compat_sigset_t __user *uset, sigset_t *set)
+{
+ compat_sigset_t cset;
+
+ cset.sig[0] = set->sig[0] & 0xffffffffull;
+ cset.sig[1] = set->sig[0] >> 32;
+
+ return copy_to_user(uset, &cset, sizeof(*uset));
+}
+
+static inline int get_sigset_t(sigset_t *set,
+ const compat_sigset_t __user *uset)
+{
+ compat_sigset_t s32;
+
+ if (copy_from_user(&s32, uset, sizeof(*uset)))
+ return -EFAULT;
+
+ set->sig[0] = s32.sig[0] | (((long)s32.sig[1]) << 32);
+ return 0;
+}
+
#else
static inline int ilp32_setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set,
@@ -44,6 +44,7 @@
#include <asm/syscall.h>
#include <asm/traps.h>
#include <asm/system_misc.h>
+#include <asm/signal_ilp32.h>
#define CREATE_TRACE_POINTS
#include <trace/events/syscalls.h>
@@ -1231,12 +1232,73 @@ COMPAT_SYSCALL_DEFINE4(aarch32_ptrace, compat_long_t, request, compat_long_t, pi
#endif /* CONFIG_AARCH32_EL0 */
+#ifdef CONFIG_ARM64_ILP32
+
+static int compat_ilp32_ptrace(struct task_struct *child, compat_long_t request,
+ compat_ulong_t addr, compat_ulong_t data)
+{
+ compat_ulong_t __user *datap = compat_ptr(data);
+ int ret;
+
+ switch (request) {
+ case PTRACE_GETSIGMASK:
+ if (addr != sizeof(compat_sigset_t)) {
+ ret = -EINVAL;
+ break;
+ }
+
+ if (put_sigset_t((compat_sigset_t __user *)datap, &child->blocked))
+ ret = -EFAULT;
+ else
+ ret = 0;
+ break;
+
+ case PTRACE_SETSIGMASK: {
+ sigset_t new_set;
+ if (addr != sizeof(compat_sigset_t)) {
+ ret = -EINVAL;
+ break;
+ }
+
+ if (get_sigset_t(&new_set, (compat_sigset_t __user *)datap)) {
+ ret = -EFAULT;
+ break;
+ }
+
+ sigdelsetmask(&new_set, sigmask(SIGKILL)|sigmask(SIGSTOP));
+
+ /*
+ * Every thread does recalc_sigpending() after resume, so
+ * retarget_shared_pending() and recalc_sigpending() are not
+ * called here.
+ */
+ spin_lock_irq(&child->sighand->siglock);
+ child->blocked = new_set;
+ spin_unlock_irq(&child->sighand->siglock);
+
+ ret = 0;
+ break;
+ }
+
+ default:
+ ret = compat_ptrace_request(child, request, addr, data);
+ }
+
+ return ret;
+}
+
+#endif /* CONFIG_ARM64_ILP32 */
+
#ifdef CONFIG_COMPAT
long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
compat_ulong_t caddr, compat_ulong_t cdata)
{
+#ifdef CONFIG_ARM64_ILP32
+ return compat_ilp32_ptrace(child, request, caddr, cdata);
+#else
return compat_ptrace_request(child, request, caddr, cdata);
+#endif
}
#endif /* CONFIG_COMPAT */
@@ -28,6 +28,7 @@
#include <asm/fpsimd.h>
#include <asm/signal32_common.h>
#include <asm/signal_common.h>
+#include <asm/signal_ilp32.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
#include <asm/ucontext.h>
@@ -58,28 +59,6 @@ struct ilp32_rt_sigframe {
struct ilp32_sigframe sig;
};
-static inline int put_sigset_t(compat_sigset_t __user *uset, sigset_t *set)
-{
- compat_sigset_t cset;
-
- cset.sig[0] = set->sig[0] & 0xffffffffull;
- cset.sig[1] = set->sig[0] >> 32;
-
- return copy_to_user(uset, &cset, sizeof(*uset));
-}
-
-static inline int get_sigset_t(sigset_t *set,
- const compat_sigset_t __user *uset)
-{
- compat_sigset_t s32;
-
- if (copy_from_user(&s32, uset, sizeof(*uset)))
- return -EFAULT;
-
- set->sig[0] = s32.sig[0] | (((long)s32.sig[1]) << 32);
- return 0;
-}
-
static int restore_ilp32_sigframe(struct pt_regs *regs,
struct ilp32_sigframe __user *sf)
{