Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9862b47
arm64: signal: Make parse_user_sigframe() independent of rt_sigframe …
May 16, 2018
4f5074e
ptrace: Add compat PTRACE_{G,S}ETSIGMASK handlers
May 16, 2018
b36de00
thread: move thread bits accessors to separated file
norov May 16, 2018
8f9e256
arm64: ilp32: add documentation on the ILP32 ABI for ARM64
norov May 16, 2018
61dbb68
arm64: rename COMPAT to AARCH32_EL0
apinski-cavium May 16, 2018
f56309c
arm64: rename functions that reference compat term
norov May 16, 2018
42a2714
arm64: uapi: set __BITS_PER_LONG correctly for ILP32 and LP64
apinski-cavium May 16, 2018
fc856ed
arm64: introduce is_a32_compat_{task,thread} for AArch32 compat
norov May 16, 2018
a943e7c
arm64: ilp32: add is_ilp32_compat_{task,thread} and TIF_32BIT_AARCH64
norov May 16, 2018
2312ac1
arm64: introduce AUDIT_ARCH_AARCH64ILP32 for ilp32
Jan 7, 2019
4f4fb85
arm64: introduce binfmt_elf32.c
norov May 16, 2018
5331393
arm64: change compat_elf_hwcap and compat_elf_hwcap2 prefix to a32
norov May 16, 2018
8fde72a
arm64: ilp32: introduce binfmt_ilp32.c
norov May 16, 2018
a4a5422
arm64: ilp32: share aarch32 syscall handlers
norov Oct 19, 2018
c7ecdd8
arm64: ilp32: introduce syscall table for ILP32
norov Oct 19, 2018
6bba78d
arm64: signal: share lp64 signal structures and routines to ilp32
norov May 16, 2018
59391d9
arm64: signal32: move ilp32 and aarch32 common code to separated file
norov May 16, 2018
ffb1353
arm64: ilp32: introduce ilp32-specific sigframe and ucontext
May 16, 2018
0f8e9bb
arm64: ptrace: handle ptrace_request differently for aarch32 and ilp32
norov May 16, 2018
e613acc
arm64:ilp32: add vdso-ilp32 and use for signal return
May 16, 2018
6d1ff42
arm64:ilp32: add ARM64_ILP32 to Kconfig
apinski-cavium May 16, 2018
5270931
arm64: ilp32: Make the Kconfig option default y
ctmarinas May 16, 2018
fe1ef0a
arm64: seccomp: customize compat syscall whitelist
YuryNorov Nov 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
arm64: ilp32: introduce ilp32-specific sigframe and ucontext
ILP32 uses AARCH32 compat structures and syscall handlers for signals. But
ILP32 rt_sigframe and ucontext structures differ from both LP64 and AARCH32.
>From software point of view ILP32 is typical 32-bit compat ABI, and from
hardware point of view, it's just like LP64.

struct rt_sigframe defined in this patch in
arch/arm64/kernel/signal_ilp32.c redefines one in
arch/arm64/kernel/signal.c. And functions located in
arch/arm64/include/signal_common.h pick up new structure to generate the
code suitable for ILP32.

Signed-off-by: Yury Norov <[email protected]>
Signed-off-by: Yury Norov <[email protected]>
  • Loading branch information
Yury Norov authored and YuryNorov committed Jul 9, 2019
commit ffb13532bb20f63d79d91db63d822a22606a4416
23 changes: 23 additions & 0 deletions arch/arm64/include/asm/signal_ilp32.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* SPDX-License-Identifier: GPL-2.0 */

#ifndef __ASM_SIGNAL_ILP32_H
#define __ASM_SIGNAL_ILP32_H

#ifdef CONFIG_ARM64_ILP32

#include <linux/compat.h>

int ilp32_setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set,
struct pt_regs *regs);

#else

static inline int ilp32_setup_rt_frame(int usig, struct ksignal *ksig,
sigset_t *set, struct pt_regs *regs)
{
return -ENOSYS;
}

#endif /* CONFIG_ARM64_ILP32 */

#endif /* __ASM_SIGNAL_ILP32_H */
3 changes: 2 additions & 1 deletion arch/arm64/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ $(obj)/%.stub.o: $(obj)/%.o FORCE
obj-$(CONFIG_AARCH32_EL0) += binfmt_elf32.o sys32.o signal32.o \
sigreturn32.o sys_compat.o
obj-$(CONFIG_KUSER_HELPERS) += kuser32.o
obj-$(CONFIG_ARM64_ILP32) += binfmt_ilp32.o sys_ilp32.o
obj-$(CONFIG_ARM64_ILP32) += binfmt_ilp32.o sys_ilp32.o \
signal_ilp32.o
obj-$(CONFIG_COMPAT) += sys32_common.o signal32_common.o
obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o
obj-$(CONFIG_MODULES) += module.o
Expand Down
3 changes: 3 additions & 0 deletions arch/arm64/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <asm/signal32.h>
#include <asm/traps.h>
#include <asm/vdso.h>
#include <asm/signal_ilp32.h>

#define get_sigset(s, m) __copy_from_user(s, m, sizeof(*s))
#define put_sigset(s, m) __copy_to_user(m, s, sizeof(*s))
Expand Down Expand Up @@ -570,6 +571,8 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
ret = a32_setup_rt_frame(usig, ksig, oldset, regs);
else
ret = a32_setup_frame(usig, ksig, oldset, regs);
} else if (is_ilp32_compat_task()) {
ret = ilp32_setup_rt_frame(usig, ksig, oldset, regs);
} else {
ret = setup_rt_frame(usig, ksig, oldset, regs);
}
Expand Down
67 changes: 67 additions & 0 deletions arch/arm64/kernel/signal_ilp32.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// SPDX-License-Identifier: GPL-2.0

/*
* Copyright (C) 1995-2009 Russell King
* Copyright (C) 2012 ARM Ltd.
* Copyright (C) 2018 Cavium Networks.
* Yury Norov <[email protected]>
*/

#include <linux/compat.h>
#include <linux/signal.h>
#include <linux/syscalls.h>

#include <asm/fpsimd.h>
#include <asm/unistd.h>
#include <asm/ucontext.h>
#include <asm/vdso.h>

#include <asm/signal_ilp32.h>
#include <asm/signal32_common.h>

#define get_sigset(s, m) get_sigset_t(s, m)
#define put_sigset(s, m) put_sigset_t(m, s)

#define restore_altstack(stack) compat_restore_altstack(stack)
#define __save_altstack(stack, sp) __compat_save_altstack(stack, sp)
#define copy_siginfo_to_user(frame_info, ksig_info) \
copy_siginfo_to_user32(frame_info, ksig_info)

#define setup_return(regs, ka, user_layout, usig) \
{ \
__setup_return(regs, ka, user_layout, usig); \
regs->regs[30] = \
(unsigned long)VDSO_SYMBOL(current->mm->context.vdso, \
sigtramp_ilp32); \
}

struct ilp32_ucontext {
u32 uc_flags;
u32 uc_link;
compat_stack_t uc_stack;
compat_sigset_t uc_sigmask;
/* glibc uses a 1024-bit sigset_t */
__u8 __unused[1024 / 8 - sizeof(compat_sigset_t)];
/* last for future expansion */
struct sigcontext uc_mcontext;
};

struct rt_sigframe {
struct compat_siginfo info;
struct ilp32_ucontext uc;
};

#include <asm/signal_common.h>

COMPAT_SYSCALL_DEFINE0(ilp32_rt_sigreturn)
{
struct pt_regs *regs = current_pt_regs();

return __sys_rt_sigreturn(regs);
}

int ilp32_setup_rt_frame(int usig, struct ksignal *ksig,
sigset_t *set, struct pt_regs *regs)
{
return __setup_rt_frame(usig, ksig, set, regs);
}
6 changes: 6 additions & 0 deletions arch/arm64/kernel/sys_ilp32.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
#define __arm64_compat_sys_msgctl __arm64_compat_sys_old_msgctl
#define __arm64_compat_sys_shmctl __arm64_compat_sys_old_shmctl

/*
* Using custom wrapper for rt_sigreturn() to handle custom
* struct rt_sigframe.
*/
#define __arm64_compat_sys_rt_sigreturn __arm64_compat_sys_ilp32_rt_sigreturn

/*
* Wrappers to pass the pt_regs argument.
*/
Expand Down