Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Reber <areber@redhat.com>2021-07-19 10:28:38 +0300
committerAndrei Vagin <avagin@gmail.com>2021-09-03 20:31:00 +0300
commit93dd984ca0ee0e31a5650f64328222e748152bcb (patch)
tree024483c121704ec8d106c9bf596441b51e51a67c /compel/arch
parent1e26f170caa8b2c26f5d09a78ffe9fdea70d38d0 (diff)
Run 'make indent' on all C files
Acked-by: Mike Rapoport <rppt@linux.ibm.com> Signed-off-by: Adrian Reber <areber@redhat.com>
Diffstat (limited to 'compel/arch')
-rw-r--r--compel/arch/aarch64/src/lib/cpu.c25
-rw-r--r--compel/arch/aarch64/src/lib/handle-elf.c10
-rw-r--r--compel/arch/aarch64/src/lib/infect.c46
-rw-r--r--compel/arch/arm/src/lib/handle-elf.c5
-rw-r--r--compel/arch/arm/src/lib/infect.c46
-rw-r--r--compel/arch/mips/src/lib/cpu.c13
-rw-r--r--compel/arch/mips/src/lib/handle-elf.c5
-rw-r--r--compel/arch/mips/src/lib/infect.c68
-rw-r--r--compel/arch/ppc64/src/lib/cpu.c20
-rw-r--r--compel/arch/ppc64/src/lib/handle-elf.c10
-rw-r--r--compel/arch/ppc64/src/lib/infect.c130
-rw-r--r--compel/arch/s390/plugins/std/syscalls/syscalls-s390.c5
-rw-r--r--compel/arch/s390/src/lib/cpu.c20
-rw-r--r--compel/arch/s390/src/lib/handle-elf.c5
-rw-r--r--compel/arch/s390/src/lib/infect.c115
-rw-r--r--compel/arch/x86/plugins/std/syscalls/syscall32.c42
-rw-r--r--compel/arch/x86/src/lib/cpu.c107
-rw-r--r--compel/arch/x86/src/lib/handle-elf.c5
-rw-r--r--compel/arch/x86/src/lib/infect.c195
-rw-r--r--compel/arch/x86/src/lib/thread_area.c8
20 files changed, 379 insertions, 501 deletions
diff --git a/compel/arch/aarch64/src/lib/cpu.c b/compel/arch/aarch64/src/lib/cpu.c
index cfaab1e65..538a29887 100644
--- a/compel/arch/aarch64/src/lib/cpu.c
+++ b/compel/arch/aarch64/src/lib/cpu.c
@@ -7,7 +7,7 @@
#include "log.h"
-#undef LOG_PREFIX
+#undef LOG_PREFIX
#define LOG_PREFIX "cpu: "
static compel_cpuinfo_t rt_info;
@@ -22,11 +22,24 @@ static void fetch_rt_cpuinfo(void)
}
}
-void compel_set_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { }
-void compel_clear_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { }
-int compel_test_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { return 0; }
-int compel_test_fpu_cap(compel_cpuinfo_t *info, unsigned int feature) { return 0; }
-int compel_cpuid(compel_cpuinfo_t *info) { return 0; }
+void compel_set_cpu_cap(compel_cpuinfo_t *info, unsigned int feature)
+{
+}
+void compel_clear_cpu_cap(compel_cpuinfo_t *info, unsigned int feature)
+{
+}
+int compel_test_cpu_cap(compel_cpuinfo_t *info, unsigned int feature)
+{
+ return 0;
+}
+int compel_test_fpu_cap(compel_cpuinfo_t *info, unsigned int feature)
+{
+ return 0;
+}
+int compel_cpuid(compel_cpuinfo_t *info)
+{
+ return 0;
+}
bool compel_cpu_has_feature(unsigned int feature)
{
diff --git a/compel/arch/aarch64/src/lib/handle-elf.c b/compel/arch/aarch64/src/lib/handle-elf.c
index 1ee65ee2c..206aef4cd 100644
--- a/compel/arch/aarch64/src/lib/handle-elf.c
+++ b/compel/arch/aarch64/src/lib/handle-elf.c
@@ -5,15 +5,13 @@
#include "piegen.h"
#include "log.h"
-static const unsigned char __maybe_unused
-elf_ident_64_le[EI_NIDENT] = {
- 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x01, 0x01, 0x00,
+static const unsigned char __maybe_unused elf_ident_64_le[EI_NIDENT] = {
+ 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x01, 0x01, 0x00, /* clang-format */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
-static const unsigned char __maybe_unused
-elf_ident_64_be[EI_NIDENT] = {
- 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x02, 0x01, 0x00,
+static const unsigned char __maybe_unused elf_ident_64_be[EI_NIDENT] = {
+ 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x02, 0x01, 0x00, /* clang-format */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
diff --git a/compel/arch/aarch64/src/lib/infect.c b/compel/arch/aarch64/src/lib/infect.c
index 586eedac0..7cfa637eb 100644
--- a/compel/arch/aarch64/src/lib/infect.c
+++ b/compel/arch/aarch64/src/lib/infect.c
@@ -18,12 +18,11 @@ unsigned __page_shift = 0;
* Injected syscall instruction
*/
const char code_syscall[] = {
- 0x01, 0x00, 0x00, 0xd4, /* SVC #0 */
- 0x00, 0x00, 0x20, 0xd4 /* BRK #0 */
+ 0x01, 0x00, 0x00, 0xd4, /* SVC #0 */
+ 0x00, 0x00, 0x20, 0xd4 /* BRK #0 */
};
-static const int
-code_syscall_aligned = round_up(sizeof(code_syscall), sizeof(long));
+static const int code_syscall_aligned = round_up(sizeof(code_syscall), sizeof(long));
static inline void __always_unused __check_code_syscall(void)
{
@@ -31,17 +30,15 @@ static inline void __always_unused __check_code_syscall(void)
BUILD_BUG_ON(!is_log2(sizeof(code_syscall)));
}
-int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe,
- user_regs_struct_t *regs,
- user_fpregs_struct_t *fpregs)
+int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe, user_regs_struct_t *regs, user_fpregs_struct_t *fpregs)
{
struct fpsimd_context *fpsimd = RT_SIGFRAME_FPU(sigframe);
memcpy(sigframe->uc.uc_mcontext.regs, regs->regs, sizeof(regs->regs));
- sigframe->uc.uc_mcontext.sp = regs->sp;
- sigframe->uc.uc_mcontext.pc = regs->pc;
- sigframe->uc.uc_mcontext.pstate = regs->pstate;
+ sigframe->uc.uc_mcontext.sp = regs->sp;
+ sigframe->uc.uc_mcontext.pc = regs->pc;
+ sigframe->uc.uc_mcontext.pstate = regs->pstate;
memcpy(fpsimd->vregs, fpregs->vregs, 32 * sizeof(__uint128_t));
@@ -54,15 +51,13 @@ int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe,
return 0;
}
-int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe,
- struct rt_sigframe *rsigframe)
+int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe, struct rt_sigframe *rsigframe)
{
return 0;
}
-int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs,
- user_fpregs_struct_t *ext_regs, save_regs_t save,
- void *arg, __maybe_unused unsigned long flags)
+int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *ext_regs, save_regs_t save,
+ void *arg, __maybe_unused unsigned long flags)
{
user_fpregs_struct_t tmp, *fpsimd = ext_regs ? ext_regs : &tmp;
struct iovec iov;
@@ -104,13 +99,8 @@ int compel_set_task_ext_regs(pid_t pid, user_fpregs_struct_t *ext_regs)
return 0;
}
-int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
- unsigned long arg1,
- unsigned long arg2,
- unsigned long arg3,
- unsigned long arg4,
- unsigned long arg5,
- unsigned long arg6)
+int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret, unsigned long arg1, unsigned long arg2,
+ unsigned long arg3, unsigned long arg4, unsigned long arg5, unsigned long arg6)
{
user_regs_struct_t regs = ctl->orig.regs;
int err;
@@ -131,15 +121,12 @@ int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
return err;
}
-void *remote_mmap(struct parasite_ctl *ctl,
- void *addr, size_t length, int prot,
- int flags, int fd, off_t offset)
+void *remote_mmap(struct parasite_ctl *ctl, void *addr, size_t length, int prot, int flags, int fd, off_t offset)
{
long map;
int err;
- err = compel_syscall(ctl, __NR_mmap, &map,
- (unsigned long)addr, length, prot, flags, fd, offset);
+ err = compel_syscall(ctl, __NR_mmap, &map, (unsigned long)addr, length, prot, flags, fd, offset);
if (err < 0 || (long)map < 0)
map = 0;
@@ -166,9 +153,7 @@ int arch_fetch_sas(struct parasite_ctl *ctl, struct rt_sigframe *s)
long ret;
int err;
- err = compel_syscall(ctl, __NR_sigaltstack,
- &ret, 0, (unsigned long)&s->uc.uc_stack,
- 0, 0, 0, 0);
+ err = compel_syscall(ctl, __NR_sigaltstack, &ret, 0, (unsigned long)&s->uc.uc_stack, 0, 0, 0, 0);
return err ? err : ret;
}
@@ -191,4 +176,3 @@ unsigned long compel_task_size(void)
break;
return task_size;
}
-
diff --git a/compel/arch/arm/src/lib/handle-elf.c b/compel/arch/arm/src/lib/handle-elf.c
index 5b8d00a6f..a84524abd 100644
--- a/compel/arch/arm/src/lib/handle-elf.c
+++ b/compel/arch/arm/src/lib/handle-elf.c
@@ -5,9 +5,8 @@
#include "piegen.h"
#include "log.h"
-static const unsigned char __maybe_unused
-elf_ident_32[EI_NIDENT] = {
- 0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x00,
+static const unsigned char __maybe_unused elf_ident_32[EI_NIDENT] = {
+ 0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x00, /* clang-format */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
diff --git a/compel/arch/arm/src/lib/infect.c b/compel/arch/arm/src/lib/infect.c
index 1ddb48654..6715afdb3 100644
--- a/compel/arch/arm/src/lib/infect.c
+++ b/compel/arch/arm/src/lib/infect.c
@@ -17,12 +17,11 @@
* Injected syscall instruction
*/
const char code_syscall[] = {
- 0x00, 0x00, 0x00, 0xef, /* SVC #0 */
- 0xf0, 0x01, 0xf0, 0xe7 /* UDF #32 */
+ 0x00, 0x00, 0x00, 0xef, /* SVC #0 */
+ 0xf0, 0x01, 0xf0, 0xe7 /* UDF #32 */
};
-static const int
-code_syscall_aligned = round_up(sizeof(code_syscall), sizeof(long));
+static const int code_syscall_aligned = round_up(sizeof(code_syscall), sizeof(long));
static inline __always_unused void __check_code_syscall(void)
{
@@ -30,9 +29,7 @@ static inline __always_unused void __check_code_syscall(void)
BUILD_BUG_ON(!is_log2(sizeof(code_syscall)));
}
-int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe,
- user_regs_struct_t *regs,
- user_fpregs_struct_t *fpregs)
+int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe, user_regs_struct_t *regs, user_fpregs_struct_t *fpregs)
{
struct aux_sigframe *aux = (struct aux_sigframe *)(void *)&sigframe->sig.uc.uc_regspace;
@@ -62,16 +59,14 @@ int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe,
return 0;
}
-int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe,
- struct rt_sigframe *rsigframe)
+int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe, struct rt_sigframe *rsigframe)
{
return 0;
}
#define PTRACE_GETVFPREGS 27
-int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs,
- user_fpregs_struct_t *ext_regs, save_regs_t save,
- void *arg, __maybe_unused unsigned long flags)
+int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *ext_regs, save_regs_t save,
+ void *arg, __maybe_unused unsigned long flags)
{
user_fpregs_struct_t tmp, *vfp = ext_regs ? ext_regs : &tmp;
int ret = -1;
@@ -116,13 +111,8 @@ int compel_set_task_ext_regs(pid_t pid, user_fpregs_struct_t *ext_regs)
return 0;
}
-int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
- unsigned long arg1,
- unsigned long arg2,
- unsigned long arg3,
- unsigned long arg4,
- unsigned long arg5,
- unsigned long arg6)
+int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret, unsigned long arg1, unsigned long arg2,
+ unsigned long arg3, unsigned long arg4, unsigned long arg5, unsigned long arg6)
{
user_regs_struct_t regs = ctl->orig.regs;
int err;
@@ -141,9 +131,7 @@ int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
return err;
}
-void *remote_mmap(struct parasite_ctl *ctl,
- void *addr, size_t length, int prot,
- int flags, int fd, off_t offset)
+void *remote_mmap(struct parasite_ctl *ctl, void *addr, size_t length, int prot, int flags, int fd, off_t offset)
{
long map;
int err;
@@ -151,8 +139,7 @@ void *remote_mmap(struct parasite_ctl *ctl,
if (offset & ~PAGE_MASK)
return 0;
- err = compel_syscall(ctl, __NR_mmap2, &map,
- (unsigned long)addr, length, prot, flags, fd, offset >> 12);
+ err = compel_syscall(ctl, __NR_mmap2, &map, (unsigned long)addr, length, prot, flags, fd, offset >> 12);
if (err < 0 || map > ctl->ictx.task_size)
map = 0;
@@ -182,9 +169,7 @@ int arch_fetch_sas(struct parasite_ctl *ctl, struct rt_sigframe *s)
long ret;
int err;
- err = compel_syscall(ctl, __NR_sigaltstack,
- &ret, 0, (unsigned long)&s->sig.uc.uc_stack,
- 0, 0, 0, 0);
+ err = compel_syscall(ctl, __NR_sigaltstack, &ret, 0, (unsigned long)&s->sig.uc.uc_stack, 0, 0, 0, 0);
return err ? err : ret;
}
@@ -193,9 +178,9 @@ int arch_fetch_sas(struct parasite_ctl *ctl, struct rt_sigframe *s)
* arch/arm/include/asm/memory.h
* arch/arm/Kconfig (PAGE_OFFSET values in Memory split section)
*/
-#define TASK_SIZE_MIN 0x3f000000
-#define TASK_SIZE_MAX 0xbf000000
-#define SZ_1G 0x40000000
+#define TASK_SIZE_MIN 0x3f000000
+#define TASK_SIZE_MAX 0xbf000000
+#define SZ_1G 0x40000000
unsigned long compel_task_size(void)
{
@@ -207,4 +192,3 @@ unsigned long compel_task_size(void)
return task_size;
}
-
diff --git a/compel/arch/mips/src/lib/cpu.c b/compel/arch/mips/src/lib/cpu.c
index bdb65ff9f..172b90e27 100644
--- a/compel/arch/mips/src/lib/cpu.c
+++ b/compel/arch/mips/src/lib/cpu.c
@@ -6,22 +6,27 @@
#include "common/compiler.h"
#include "log.h"
-#undef LOG_PREFIX
+#undef LOG_PREFIX
#define LOG_PREFIX "cpu: "
static compel_cpuinfo_t rt_info;
static bool rt_info_done = false;
-void compel_set_cpu_cap(compel_cpuinfo_t *c, unsigned int feature){ }
+void compel_set_cpu_cap(compel_cpuinfo_t *c, unsigned int feature)
+{
+}
-void compel_clear_cpu_cap(compel_cpuinfo_t *c, unsigned int feature){ }
+void compel_clear_cpu_cap(compel_cpuinfo_t *c, unsigned int feature)
+{
+}
int compel_test_cpu_cap(compel_cpuinfo_t *c, unsigned int feature)
{
return 0;
}
-int compel_cpuid(compel_cpuinfo_t *c){
+int compel_cpuid(compel_cpuinfo_t *c)
+{
return 0;
}
diff --git a/compel/arch/mips/src/lib/handle-elf.c b/compel/arch/mips/src/lib/handle-elf.c
index 988985151..a605a5a45 100644
--- a/compel/arch/mips/src/lib/handle-elf.c
+++ b/compel/arch/mips/src/lib/handle-elf.c
@@ -5,9 +5,8 @@
#include "piegen.h"
#include "log.h"
-static const unsigned char __maybe_unused
-elf_ident_64_le[EI_NIDENT] = {
- 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x01, 0x01, 0x00,
+static const unsigned char __maybe_unused elf_ident_64_le[EI_NIDENT] = {
+ 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x01, 0x01, 0x00, /* clang-format */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
diff --git a/compel/arch/mips/src/lib/infect.c b/compel/arch/mips/src/lib/infect.c
index d8c03c33a..68d0a2728 100644
--- a/compel/arch/mips/src/lib/infect.c
+++ b/compel/arch/mips/src/lib/infect.c
@@ -23,8 +23,8 @@
* mips64el is Little Endian
*/
const char code_syscall[] = {
- 0x0c, 0x00, 0x00, 0x00, /* syscall */
- 0x0d, 0x00, 0x00, 0x00 /* break */
+ 0x0c, 0x00, 0x00, 0x00, /* syscall */
+ 0x0d, 0x00, 0x00, 0x00 /* break */
};
/* 10-byte legacy floating point register */
@@ -40,10 +40,7 @@ struct fpxreg {
uint16_t padding[3];
};
-
-int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe,
- user_regs_struct_t *regs,
- user_fpregs_struct_t *fpregs)
+int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe, user_regs_struct_t *regs, user_fpregs_struct_t *fpregs)
{
sigframe->rs_uc.uc_mcontext.sc_regs[0] = regs->regs[0];
sigframe->rs_uc.uc_mcontext.sc_regs[1] = regs->regs[1];
@@ -117,17 +114,15 @@ int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe,
return 0;
}
-int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe,
- struct rt_sigframe *rsigframe)
+int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe, struct rt_sigframe *rsigframe)
{
return 0;
}
-int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs,
- user_fpregs_struct_t *ext_regs, save_regs_t save,
- void *arg, __maybe_unused unsigned long flags)
+int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *ext_regs, save_regs_t save,
+ void *arg, __maybe_unused unsigned long flags)
{
- user_fpregs_struct_t xsave = { }, *xs = ext_regs ? ext_regs : &xsave;
+ user_fpregs_struct_t xsave = {}, *xs = ext_regs ? ext_regs : &xsave;
int ret = -1;
pr_info("Dumping GP/FPU registers for %d\n", pid);
@@ -143,7 +138,7 @@ int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs,
case ERESTARTNOHAND:
case ERESTARTSYS:
case ERESTARTNOINTR:
- regs->regs[2] = regs->regs[0];
+ regs->regs[2] = regs->regs[0];
regs->regs[7] = regs->regs[26];
regs->cp0_epc -= 4;
break;
@@ -170,13 +165,8 @@ int compel_set_task_ext_regs(pid_t pid, user_fpregs_struct_t *ext_regs)
return 0;
}
-int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
- unsigned long arg1,
- unsigned long arg2,
- unsigned long arg3,
- unsigned long arg4,
- unsigned long arg5,
- unsigned long arg6)
+int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret, unsigned long arg1, unsigned long arg2,
+ unsigned long arg3, unsigned long arg4, unsigned long arg5, unsigned long arg6)
{
/*refer to glibc-2.20/sysdeps/unix/sysv/linux/mips/mips64/syscall.S*/
user_regs_struct_t regs = ctl->orig.regs;
@@ -193,18 +183,15 @@ int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
err = compel_execute_syscall(ctl, &regs, code_syscall);
*ret = regs.regs[2];
- return err;
+ return err;
}
-void *remote_mmap(struct parasite_ctl *ctl,
- void *addr, size_t length, int prot,
- int flags, int fd, off_t offset)
+void *remote_mmap(struct parasite_ctl *ctl, void *addr, size_t length, int prot, int flags, int fd, off_t offset)
{
long map;
int err;
- err = compel_syscall(ctl, __NR_mmap, &map,
- (unsigned long)addr, length, prot, flags, fd, offset >> PAGE_SHIFT);
+ err = compel_syscall(ctl, __NR_mmap, &map, (unsigned long)addr, length, prot, flags, fd, offset >> PAGE_SHIFT);
if (err < 0 || IS_ERR_VALUE(map)) {
pr_err("remote mmap() failed: %s\n", strerror(-map));
@@ -236,13 +223,10 @@ int arch_fetch_sas(struct parasite_ctl *ctl, struct rt_sigframe *s)
long ret;
int err;
- err = compel_syscall(ctl, __NR_sigaltstack,
- &ret, 0, (unsigned long)&s->rs_uc.uc_stack,
- 0, 0, 0, 0);
+ err = compel_syscall(ctl, __NR_sigaltstack, &ret, 0, (unsigned long)&s->rs_uc.uc_stack, 0, 0, 0, 0);
return err ? err : ret;
}
-
int ptrace_set_breakpoint(pid_t pid, void *addr)
{
return 0;
@@ -256,9 +240,12 @@ int ptrace_flush_breakpoints(pid_t pid)
/*refer to kernel linux-3.10/arch/mips/include/asm/processor.h*/
#define TASK_SIZE32 0x7fff8000UL
#define TASK_SIZE64 0x10000000000UL
-#define TASK_SIZE TASK_SIZE64
+#define TASK_SIZE TASK_SIZE64
-unsigned long compel_task_size(void) { return TASK_SIZE; }
+unsigned long compel_task_size(void)
+{
+ return TASK_SIZE;
+}
/*
* Get task registers (overwrites weak function)
@@ -292,30 +279,31 @@ void compel_relocs_apply_mips(void *mem, void *vbase, struct parasite_blob_desc
for (i = 0, j = 0; i < nr_relocs; i++) {
if (elf_relocs[i].type & COMPEL_TYPE_MIPS_26) {
int *where = (mem + elf_relocs[i].offset);
- *where = *where | ((elf_relocs[i].addend + ((unsigned long)vbase & 0x00fffffff) /*low 28 bit*/)>>2);
+ *where = *where |
+ ((elf_relocs[i].addend + ((unsigned long)vbase & 0x00fffffff) /*low 28 bit*/) >> 2);
} else if (elf_relocs[i].type & COMPEL_TYPE_MIPS_64) {
unsigned long *where = (mem + elf_relocs[i].offset);
*where = elf_relocs[i].addend + (unsigned long)vbase;
} else if (elf_relocs[i].type & COMPEL_TYPE_MIPS_HI16) {
/* refer to binutils mips.cc */
int *where = (mem + elf_relocs[i].offset);
- int v_lo16 = (unsigned long)vbase &0x00ffff;
+ int v_lo16 = (unsigned long)vbase & 0x00ffff;
- if ((v_lo16+elf_relocs[i].value+elf_relocs[i].addend) >= 0x8000) {
- *where = *where | ((((unsigned long)vbase>>16) &0xffff)+0x1);
+ if ((v_lo16 + elf_relocs[i].value + elf_relocs[i].addend) >= 0x8000) {
+ *where = *where | ((((unsigned long)vbase >> 16) & 0xffff) + 0x1);
} else {
- *where = *where | ((((unsigned long)vbase>>16) &0xffff));
+ *where = *where | ((((unsigned long)vbase >> 16) & 0xffff));
}
} else if (elf_relocs[i].type & COMPEL_TYPE_MIPS_LO16) {
int *where = (mem + elf_relocs[i].offset);
- int v_lo16 = (unsigned long)vbase &0x00ffff;
+ int v_lo16 = (unsigned long)vbase & 0x00ffff;
*where = *where | ((v_lo16 + elf_relocs[i].addend) & 0xffff);
} else if (elf_relocs[i].type & COMPEL_TYPE_MIPS_HIGHER) {
int *where = (mem + elf_relocs[i].offset);
- *where = *where | ((( (unsigned long)vbase + (uint64_t) 0x80008000) >> 32) & 0xffff);
+ *where = *where | ((((unsigned long)vbase + (uint64_t)0x80008000) >> 32) & 0xffff);
} else if (elf_relocs[i].type & COMPEL_TYPE_MIPS_HIGHEST) {
int *where = (mem + elf_relocs[i].offset);
- *where = *where | ((( (unsigned long)vbase + (uint64_t) 0x800080008000llu) >> 48) & 0xffff);
+ *where = *where | ((((unsigned long)vbase + (uint64_t)0x800080008000llu) >> 48) & 0xffff);
} else {
BUG();
}
diff --git a/compel/arch/ppc64/src/lib/cpu.c b/compel/arch/ppc64/src/lib/cpu.c
index 7a3972790..f7a128ca3 100644
--- a/compel/arch/ppc64/src/lib/cpu.c
+++ b/compel/arch/ppc64/src/lib/cpu.c
@@ -10,7 +10,7 @@
#include "log.h"
-#undef LOG_PREFIX
+#undef LOG_PREFIX
#define LOG_PREFIX "cpu: "
static compel_cpuinfo_t rt_info;
@@ -25,10 +25,20 @@ static void fetch_rt_cpuinfo(void)
}
}
-void compel_set_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { }
-void compel_clear_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { }
-int compel_test_fpu_cap(compel_cpuinfo_t *info, unsigned int feature) { return 0; }
-int compel_test_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { return 0; }
+void compel_set_cpu_cap(compel_cpuinfo_t *info, unsigned int feature)
+{
+}
+void compel_clear_cpu_cap(compel_cpuinfo_t *info, unsigned int feature)
+{
+}
+int compel_test_fpu_cap(compel_cpuinfo_t *info, unsigned int feature)
+{
+ return 0;
+}
+int compel_test_cpu_cap(compel_cpuinfo_t *info, unsigned int feature)
+{
+ return 0;
+}
int compel_cpuid(compel_cpuinfo_t *info)
{
diff --git a/compel/arch/ppc64/src/lib/handle-elf.c b/compel/arch/ppc64/src/lib/handle-elf.c
index f29fdc8a3..84a360c43 100644
--- a/compel/arch/ppc64/src/lib/handle-elf.c
+++ b/compel/arch/ppc64/src/lib/handle-elf.c
@@ -5,15 +5,13 @@
#include "piegen.h"
#include "log.h"
-static const unsigned char __maybe_unused
-elf_ident_64_le[EI_NIDENT] = {
- 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x01, 0x01, 0x00,
+static const unsigned char __maybe_unused elf_ident_64_le[EI_NIDENT] = {
+ 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x01, 0x01, 0x00, /* clang-format */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
-static const unsigned char __maybe_unused
-elf_ident_64_be[EI_NIDENT] = {
- 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x02, 0x01, 0x00,
+static const unsigned char __maybe_unused elf_ident_64_be[EI_NIDENT] = {
+ 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x02, 0x01, 0x00, /* clang-format */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
diff --git a/compel/arch/ppc64/src/lib/infect.c b/compel/arch/ppc64/src/lib/infect.c
index 5797fb16d..fc174d0dd 100644
--- a/compel/arch/ppc64/src/lib/infect.c
+++ b/compel/arch/ppc64/src/lib/infect.c
@@ -15,11 +15,11 @@
#include "infect-priv.h"
#ifndef NT_PPC_TM_SPR
-#define NT_PPC_TM_CGPR 0x108 /* TM checkpointed GPR Registers */
-#define NT_PPC_TM_CFPR 0x109 /* TM checkpointed FPR Registers */
-#define NT_PPC_TM_CVMX 0x10a /* TM checkpointed VMX Registers */
-#define NT_PPC_TM_CVSX 0x10b /* TM checkpointed VSX Registers */
-#define NT_PPC_TM_SPR 0x10c /* TM Special Purpose Registers */
+#define NT_PPC_TM_CGPR 0x108 /* TM checkpointed GPR Registers */
+#define NT_PPC_TM_CFPR 0x109 /* TM checkpointed FPR Registers */
+#define NT_PPC_TM_CVMX 0x10a /* TM checkpointed VMX Registers */
+#define NT_PPC_TM_CVSX 0x10b /* TM checkpointed VSX Registers */
+#define NT_PPC_TM_SPR 0x10c /* TM Special Purpose Registers */
#endif
unsigned __page_size = 0;
@@ -29,8 +29,8 @@ unsigned __page_shift = 0;
* Injected syscall instruction
*/
const uint32_t code_syscall[] = {
- 0x44000002, /* sc */
- 0x0fe00000 /* twi 31,0,0 */
+ 0x44000002, /* sc */
+ 0x0fe00000 /* twi 31,0,0 */
};
static inline __always_unused void __check_code_syscall(void)
@@ -43,14 +43,14 @@ static void prep_gp_regs(mcontext_t *dst, user_regs_struct_t *regs)
{
memcpy(dst->gp_regs, regs->gpr, sizeof(regs->gpr));
- dst->gp_regs[PT_NIP] = regs->nip;
- dst->gp_regs[PT_MSR] = regs->msr;
- dst->gp_regs[PT_ORIG_R3] = regs->orig_gpr3;
- dst->gp_regs[PT_CTR] = regs->ctr;
- dst->gp_regs[PT_LNK] = regs->link;
- dst->gp_regs[PT_XER] = regs->xer;
- dst->gp_regs[PT_CCR] = regs->ccr;
- dst->gp_regs[PT_TRAP] = regs->trap;
+ dst->gp_regs[PT_NIP] = regs->nip;
+ dst->gp_regs[PT_MSR] = regs->msr;
+ dst->gp_regs[PT_ORIG_R3] = regs->orig_gpr3;
+ dst->gp_regs[PT_CTR] = regs->ctr;
+ dst->gp_regs[PT_LNK] = regs->link;
+ dst->gp_regs[PT_XER] = regs->xer;
+ dst->gp_regs[PT_CCR] = regs->ccr;
+ dst->gp_regs[PT_TRAP] = regs->trap;
}
static void put_fpu_regs(mcontext_t *mc, uint64_t *fpregs)
@@ -74,9 +74,7 @@ static void put_vsx_regs(mcontext_t *mc, uint64_t *vsxregs)
memcpy((uint64_t *)(mc->v_regs + 1), vsxregs, sizeof(*vsxregs) * NVSXREG);
}
-int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe,
- user_regs_struct_t *regs,
- user_fpregs_struct_t *fpregs)
+int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe, user_regs_struct_t *regs, user_fpregs_struct_t *fpregs)
{
mcontext_t *dst_tc = &sigframe->uc_transact.uc_mcontext;
mcontext_t *dst = &sigframe->uc.uc_mcontext;
@@ -134,14 +132,12 @@ static void update_vregs(mcontext_t *lcontext, mcontext_t *rcontext)
uint64_t offset = (uint64_t)(lcontext->v_regs) - (uint64_t)lcontext;
lcontext->v_regs = (vrregset_t *)((uint64_t)rcontext + offset);
- pr_debug("Updated v_regs:%llx (rcontext:%llx)\n",
- (unsigned long long)lcontext->v_regs,
+ pr_debug("Updated v_regs:%llx (rcontext:%llx)\n", (unsigned long long)lcontext->v_regs,
(unsigned long long)rcontext);
}
}
-int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *frame,
- struct rt_sigframe *rframe)
+int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *frame, struct rt_sigframe *rframe)
{
uint64_t msr = frame->uc.uc_mcontext.gp_regs[PT_MSR];
@@ -155,9 +151,8 @@ int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *frame,
/* Updating the transactional state address if any */
if (frame->uc.uc_link) {
- update_vregs(&frame->uc_transact.uc_mcontext,
- &rframe->uc_transact.uc_mcontext);
- frame->uc.uc_link = &rframe->uc_transact;
+ update_vregs(&frame->uc_transact.uc_mcontext, &rframe->uc_transact.uc_mcontext);
+ frame->uc.uc_link = &rframe->uc_transact;
}
return 0;
@@ -214,7 +209,7 @@ static int get_fpu_regs(pid_t pid, user_fpregs_struct_t *fp)
static int get_altivec_regs(pid_t pid, user_fpregs_struct_t *fp)
{
- if (ptrace(PTRACE_GETVRREGS, pid, 0, (void*)&fp->vrregs) < 0) {
+ if (ptrace(PTRACE_GETVRREGS, pid, 0, (void *)&fp->vrregs) < 0) {
/* PTRACE_GETVRREGS returns EIO if Altivec is not supported.
* This should not happen if msr_vec is set. */
if (errno != EIO) {
@@ -240,7 +235,7 @@ static int get_altivec_regs(pid_t pid, user_fpregs_struct_t *fp)
*/
static int get_vsx_regs(pid_t pid, user_fpregs_struct_t *fp)
{
- if (ptrace(PTRACE_GETVSRREGS, pid, 0, (void*)fp->vsxregs) < 0) {
+ if (ptrace(PTRACE_GETVSRREGS, pid, 0, (void *)fp->vsxregs) < 0) {
/*
* EIO is returned in the case PTRACE_GETVRREGS is not
* supported.
@@ -263,22 +258,23 @@ static int get_tm_regs(pid_t pid, user_fpregs_struct_t *fpregs)
pr_debug("Dumping TM registers\n");
-#define TM_REQUIRED 0
-#define TM_OPTIONAL 1
-#define PTRACE_GET_TM(s,n,c,u) do { \
- iov.iov_base = &s; \
- iov.iov_len = sizeof(s); \
- if (ptrace(PTRACE_GETREGSET, pid, c, &iov)) { \
- if (!u || errno != EIO) { \
- pr_perror("Couldn't get TM "n); \
- pr_err("Your kernel seems to not support the " \
- "new TM ptrace API (>= 4.8)\n"); \
- goto out_free; \
- } \
- pr_debug("TM "n" not supported.\n"); \
- iov.iov_base = NULL; \
- } \
-} while(0)
+#define TM_REQUIRED 0
+#define TM_OPTIONAL 1
+#define PTRACE_GET_TM(s, n, c, u) \
+ do { \
+ iov.iov_base = &s; \
+ iov.iov_len = sizeof(s); \
+ if (ptrace(PTRACE_GETREGSET, pid, c, &iov)) { \
+ if (!u || errno != EIO) { \
+ pr_perror("Couldn't get TM " n); \
+ pr_err("Your kernel seems to not support the " \
+ "new TM ptrace API (>= 4.8)\n"); \
+ goto out_free; \
+ } \
+ pr_debug("TM " n " not supported.\n"); \
+ iov.iov_base = NULL; \
+ } \
+ } while (0)
/* Get special registers */
PTRACE_GET_TM(fpregs->tm.tm_spr_regs, "SPR", NT_PPC_TM_SPR, TM_REQUIRED);
@@ -304,11 +300,10 @@ static int get_tm_regs(pid_t pid, user_fpregs_struct_t *fpregs)
return 0;
out_free:
- return -1; /* still failing the checkpoint */
+ return -1; /* still failing the checkpoint */
}
-static int __get_task_regs(pid_t pid, user_regs_struct_t *regs,
- user_fpregs_struct_t *fpregs)
+static int __get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *fpregs)
{
pr_info("Dumping GP/FPU registers for %d\n", pid);
@@ -317,7 +312,7 @@ static int __get_task_regs(pid_t pid, user_regs_struct_t *regs,
* arch/powerpc/kernel/signal.c
*/
#ifndef TRAP
-#define TRAP(r) ((r).trap & ~0xF)
+#define TRAP(r) ((r).trap & ~0xF)
#endif
if (TRAP(*regs) == 0x0C00 && regs->ccr & 0x10000000) {
@@ -347,10 +342,8 @@ static int __get_task_regs(pid_t pid, user_regs_struct_t *regs,
* impossible) or suspended (easy to get).
*/
if (MSR_TM_ACTIVE(regs->msr)) {
- pr_debug("Task %d has %s TM operation at 0x%lx\n",
- pid,
- (regs->msr & MSR_TMS) ? "a suspended" : "an active",
- regs->nip);
+ pr_debug("Task %d has %s TM operation at 0x%lx\n", pid,
+ (regs->msr & MSR_TMS) ? "a suspended" : "an active", regs->nip);
if (get_tm_regs(pid, fpregs))
return -1;
fpregs->flags = USER_FPREGS_FL_TM;
@@ -372,9 +365,8 @@ static int __get_task_regs(pid_t pid, user_regs_struct_t *regs,
return 0;
}
-int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs,
- user_fpregs_struct_t *ext_regs, save_regs_t save,
- void *arg, __maybe_unused unsigned long flags)
+int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *ext_regs, save_regs_t save,
+ void *arg, __maybe_unused unsigned long flags)
{
user_fpregs_struct_t tmp, *fpregs = ext_regs ? ext_regs : &tmp;
int ret;
@@ -401,11 +393,11 @@ int compel_set_task_ext_regs(pid_t pid, user_fpregs_struct_t *ext_regs)
}
if (ext_regs->flags & USER_FPREGS_FL_ALTIVEC) {
- if (ptrace(PTRACE_SETVRREGS, pid, 0, (void*)&ext_regs->vrregs) < 0) {
+ if (ptrace(PTRACE_SETVRREGS, pid, 0, (void *)&ext_regs->vrregs) < 0) {
pr_perror("Couldn't set Altivec registers");
ret = -1;
}
- if (ptrace(PTRACE_SETVSRREGS, pid, 0, (void*)ext_regs->vsxregs) < 0) {
+ if (ptrace(PTRACE_SETVSRREGS, pid, 0, (void *)ext_regs->vsxregs) < 0) {
pr_perror("Couldn't set VSX registers");
ret = -1;
}
@@ -414,13 +406,8 @@ int compel_set_task_ext_regs(pid_t pid, user_fpregs_struct_t *ext_regs)
return ret;
}
-int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
- unsigned long arg1,
- unsigned long arg2,
- unsigned long arg3,
- unsigned long arg4,
- unsigned long arg5,
- unsigned long arg6)
+int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret, unsigned long arg1, unsigned long arg2,
+ unsigned long arg3, unsigned long arg4, unsigned long arg5, unsigned long arg6)
{
user_regs_struct_t regs = ctl->orig.regs;
int err;
@@ -433,21 +420,18 @@ int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
regs.gpr[7] = arg5;
regs.gpr[8] = arg6;
- err = compel_execute_syscall(ctl, &regs, (char*)code_syscall);
+ err = compel_execute_syscall(ctl, &regs, (char *)code_syscall);
*ret = regs.gpr[3];
return err;
}
-void *remote_mmap(struct parasite_ctl *ctl,
- void *addr, size_t length, int prot,
- int flags, int fd, off_t offset)
+void *remote_mmap(struct parasite_ctl *ctl, void *addr, size_t length, int prot, int flags, int fd, off_t offset)
{
long map = 0;
int err;
- err = compel_syscall(ctl, __NR_mmap, &map,
- (unsigned long)addr, length, prot, flags, fd, offset);
+ err = compel_syscall(ctl, __NR_mmap, &map, (unsigned long)addr, length, prot, flags, fd, offset);
if (err < 0 || (long)map < 0)
map = 0;
@@ -463,7 +447,7 @@ void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *
regs->gpr[12] = new_ip;
regs->nip = new_ip;
if (stack)
- regs->gpr[1] = (unsigned long) stack;
+ regs->gpr[1] = (unsigned long)stack;
regs->trap = 0;
}
@@ -480,9 +464,7 @@ int arch_fetch_sas(struct parasite_ctl *ctl, struct rt_sigframe *s)
long ret;
int err;
- err = compel_syscall(ctl, __NR_sigaltstack,
- &ret, 0, (unsigned long)&s->uc.uc_stack,
- 0, 0, 0, 0);
+ err = compel_syscall(ctl, __NR_sigaltstack, &ret, 0, (unsigned long)&s->uc.uc_stack, 0, 0, 0, 0);
return err ? err : ret;
}
@@ -491,7 +473,7 @@ int arch_fetch_sas(struct parasite_ctl *ctl, struct rt_sigframe *s)
*
* NOTE: 32bit tasks are not supported.
*/
-#define TASK_SIZE_64TB (0x0000400000000000UL)
+#define TASK_SIZE_64TB (0x0000400000000000UL)
#define TASK_SIZE_512TB (0x0002000000000000UL)
#define TASK_SIZE_MIN TASK_SIZE_64TB
diff --git a/compel/arch/s390/plugins/std/syscalls/syscalls-s390.c b/compel/arch/s390/plugins/std/syscalls/syscalls-s390.c
index 2b35cca4a..11c3284ab 100644
--- a/compel/arch/s390/plugins/std/syscalls/syscalls-s390.c
+++ b/compel/arch/s390/plugins/std/syscalls/syscalls-s390.c
@@ -3,14 +3,13 @@
/*
* Define prototype because of compile error if we include uapi/std/syscall.h
*/
-long sys_old_mmap (struct mmap_arg_struct *);
+long sys_old_mmap(struct mmap_arg_struct *);
/*
* On s390 we have defined __ARCH_WANT_SYS_OLD_MMAP - Therefore implement
* system call with one parameter "mmap_arg_struct".
*/
-unsigned long sys_mmap(void *addr, unsigned long len, unsigned long prot,
- unsigned long flags, unsigned long fd,
+unsigned long sys_mmap(void *addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd,
unsigned long offset)
{
struct mmap_arg_struct arg_struct;
diff --git a/compel/arch/s390/src/lib/cpu.c b/compel/arch/s390/src/lib/cpu.c
index 5d86bf239..c98607e16 100644
--- a/compel/arch/s390/src/lib/cpu.c
+++ b/compel/arch/s390/src/lib/cpu.c
@@ -9,7 +9,7 @@
#include "log.h"
-#undef LOG_PREFIX
+#undef LOG_PREFIX
#define LOG_PREFIX "cpu: "
static compel_cpuinfo_t rt_info;
@@ -23,10 +23,20 @@ static void fetch_rt_cpuinfo(void)
}
}
-void compel_set_cpu_cap(compel_cpuinfo_t *c, unsigned int feature) { }
-void compel_clear_cpu_cap(compel_cpuinfo_t *c, unsigned int feature) { }
-int compel_test_fpu_cap(compel_cpuinfo_t *info, unsigned int feature) { return 0; }
-int compel_test_cpu_cap(compel_cpuinfo_t *c, unsigned int feature) { return 0; }
+void compel_set_cpu_cap(compel_cpuinfo_t *c, unsigned int feature)
+{
+}
+void compel_clear_cpu_cap(compel_cpuinfo_t *c, unsigned int feature)
+{
+}
+int compel_test_fpu_cap(compel_cpuinfo_t *info, unsigned int feature)
+{
+ return 0;
+}
+int compel_test_cpu_cap(compel_cpuinfo_t *c, unsigned int feature)
+{
+ return 0;
+}
int compel_cpuid(compel_cpuinfo_t *info)
{
diff --git a/compel/arch/s390/src/lib/handle-elf.c b/compel/arch/s390/src/lib/handle-elf.c
index 6ed382c92..8e766dc1b 100644
--- a/compel/arch/s390/src/lib/handle-elf.c
+++ b/compel/arch/s390/src/lib/handle-elf.c
@@ -5,9 +5,8 @@
#include "piegen.h"
#include "log.h"
-static const unsigned char __maybe_unused
-elf_ident_64[EI_NIDENT] = {
- 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x02, 0x01, 0x00,
+static const unsigned char __maybe_unused elf_ident_64[EI_NIDENT] = {
+ 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x02, 0x01, 0x00, /* clang-format */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
diff --git a/compel/arch/s390/src/lib/infect.c b/compel/arch/s390/src/lib/infect.c
index a928c72c3..77ace713a 100644
--- a/compel/arch/s390/src/lib/infect.c
+++ b/compel/arch/s390/src/lib/infect.c
@@ -17,25 +17,23 @@
#include "ptrace.h"
#include "infect-priv.h"
-#define NT_PRFPREG 2
-#define NT_S390_VXRS_LOW 0x309
-#define NT_S390_VXRS_HIGH 0x30a
-#define NT_S390_GS_CB 0x30b
-#define NT_S390_GS_BC 0x30c
-#define NT_S390_RI_CB 0x30d
+#define NT_PRFPREG 2
+#define NT_S390_VXRS_LOW 0x309
+#define NT_S390_VXRS_HIGH 0x30a
+#define NT_S390_GS_CB 0x30b
+#define NT_S390_GS_BC 0x30c
+#define NT_S390_RI_CB 0x30d
/*
* Print general purpose and access registers
*/
-static void print_user_regs_struct(const char *msg, int pid,
- user_regs_struct_t *regs)
+static void print_user_regs_struct(const char *msg, int pid, user_regs_struct_t *regs)
{
int i;
pr_debug("%s: Registers for pid=%d\n", msg, pid);
- pr_debug("system_call %08lx\n", (unsigned long) regs->system_call);
- pr_debug(" psw %016lx %016lx\n", regs->prstatus.psw.mask,
- regs->prstatus.psw.addr);
+ pr_debug("system_call %08lx\n", (unsigned long)regs->system_call);
+ pr_debug(" psw %016lx %016lx\n", regs->prstatus.psw.mask, regs->prstatus.psw.addr);
pr_debug(" orig_gpr2 %016lx\n", regs->prstatus.orig_gpr2);
for (i = 0; i < 16; i++)
pr_debug(" g%02d %016lx\n", i, regs->prstatus.gprs[i]);
@@ -57,9 +55,7 @@ static void print_vxrs(user_fpregs_struct_t *fpregs)
for (i = 0; i < 16; i++)
pr_debug(" vx_low%02d %016lx\n", i, fpregs->vxrs_low[i]);
for (i = 0; i < 16; i++)
- pr_debug(" vx_high%02d %016lx %016lx\n", i,
- fpregs->vxrs_high[i].part1,
- fpregs->vxrs_high[i].part2);
+ pr_debug(" vx_high%02d %016lx %016lx\n", i, fpregs->vxrs_high[i].part1, fpregs->vxrs_high[i].part2);
}
/*
@@ -111,8 +107,7 @@ static void print_ri_cb(user_fpregs_struct_t *fpregs)
* Print FP registers, VX registers, guarded-storage, and
* runtime-instrumentation
*/
-static void print_user_fpregs_struct(const char *msg, int pid,
- user_fpregs_struct_t *fpregs)
+static void print_user_fpregs_struct(const char *msg, int pid, user_fpregs_struct_t *fpregs)
{
int i;
@@ -126,28 +121,19 @@ static void print_user_fpregs_struct(const char *msg, int pid,
print_ri_cb(fpregs);
}
-int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe,
- user_regs_struct_t *regs,
- user_fpregs_struct_t *fpregs)
+int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe, user_regs_struct_t *regs, user_fpregs_struct_t *fpregs)
{
_sigregs_ext *dst_ext = &sigframe->uc.uc_mcontext_ext;
_sigregs *dst = &sigframe->uc.uc_mcontext;
- memcpy(dst->regs.gprs, regs->prstatus.gprs,
- sizeof(regs->prstatus.gprs));
- memcpy(dst->regs.acrs, regs->prstatus.acrs,
- sizeof(regs->prstatus.acrs));
- memcpy(&dst->regs.psw, &regs->prstatus.psw,
- sizeof(regs->prstatus.psw));
- memcpy(&dst->fpregs.fpc, &fpregs->prfpreg.fpc,
- sizeof(fpregs->prfpreg.fpc));
- memcpy(&dst->fpregs.fprs, &fpregs->prfpreg.fprs,
- sizeof(fpregs->prfpreg.fprs));
+ memcpy(dst->regs.gprs, regs->prstatus.gprs, sizeof(regs->prstatus.gprs));
+ memcpy(dst->regs.acrs, regs->prstatus.acrs, sizeof(regs->prstatus.acrs));
+ memcpy(&dst->regs.psw, &regs->prstatus.psw, sizeof(regs->prstatus.psw));
+ memcpy(&dst->fpregs.fpc, &fpregs->prfpreg.fpc, sizeof(fpregs->prfpreg.fpc));
+ memcpy(&dst->fpregs.fprs, &fpregs->prfpreg.fprs, sizeof(fpregs->prfpreg.fprs));
if (fpregs->flags & USER_FPREGS_VXRS) {
- memcpy(&dst_ext->vxrs_low, &fpregs->vxrs_low,
- sizeof(fpregs->vxrs_low));
- memcpy(&dst_ext->vxrs_high, &fpregs->vxrs_high,
- sizeof(fpregs->vxrs_high));
+ memcpy(&dst_ext->vxrs_low, &fpregs->vxrs_low, sizeof(fpregs->vxrs_low));
+ memcpy(&dst_ext->vxrs_high, &fpregs->vxrs_high, sizeof(fpregs->vxrs_high));
} else {
memset(&dst_ext->vxrs_low, 0, sizeof(dst_ext->vxrs_low));
memset(&dst_ext->vxrs_high, 0, sizeof(dst_ext->vxrs_high));
@@ -155,8 +141,7 @@ int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe,
return 0;
}
-int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe,
- struct rt_sigframe *rsigframe)
+int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe, struct rt_sigframe *rsigframe)
{
return 0;
}
@@ -169,9 +154,7 @@ static inline void rewind_psw(psw_t *psw, unsigned long bytes)
unsigned long mask;
pr_debug("Rewind psw: %016lx bytes=%lu\n", psw->addr, bytes);
- mask = (psw->mask & PSW_MASK_EA) ? -1UL :
- (psw->mask & PSW_MASK_BA) ? (1UL << 31) - 1 :
- (1UL << 24) - 1;
+ mask = (psw->mask & PSW_MASK_EA) ? -1UL : (psw->mask & PSW_MASK_BA) ? (1UL << 31) - 1 : (1UL << 24) - 1;
psw->addr = (psw->addr - bytes) & mask;
}
@@ -310,9 +293,8 @@ static int s390_disable_ri_bit(pid_t pid, user_regs_struct_t *regs)
/*
* Prepare task registers for restart
*/
-int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs,
- user_fpregs_struct_t *ext_regs, save_regs_t save,
- void *arg, __maybe_unused unsigned long flags)
+int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *ext_regs, save_regs_t save,
+ void *arg, __maybe_unused unsigned long flags)
{
user_fpregs_struct_t tmp, *fpregs = ext_regs ? ext_regs : &tmp;
struct iovec iov;
@@ -429,10 +411,10 @@ int compel_set_task_ext_regs(pid_t pid, user_fpregs_struct_t *ext_regs)
* Injected syscall instruction
*/
const char code_syscall[] = {
- 0x0a, 0x00, /* sc 0 */
- 0x00, 0x01, /* S390_BREAKPOINT_U16 */
- 0x00, 0x01, /* S390_BREAKPOINT_U16 */
- 0x00, 0x01, /* S390_BREAKPOINT_U16 */
+ 0x0a, 0x00, /* sc 0 */
+ 0x00, 0x01, /* S390_BREAKPOINT_U16 */
+ 0x00, 0x01, /* S390_BREAKPOINT_U16 */
+ 0x00, 0x01, /* S390_BREAKPOINT_U16 */
};
static inline void __check_code_syscall(void)
@@ -444,19 +426,14 @@ static inline void __check_code_syscall(void)
/*
* Issue s390 system call
*/
-int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
- unsigned long arg1,
- unsigned long arg2,
- unsigned long arg3,
- unsigned long arg4,
- unsigned long arg5,
- unsigned long arg6)
+int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret, unsigned long arg1, unsigned long arg2,
+ unsigned long arg3, unsigned long arg4, unsigned long arg5, unsigned long arg6)
{
user_regs_struct_t regs = ctl->orig.regs;
int err;
/* Load syscall number into %r1 */
- regs.prstatus.gprs[1] = (unsigned long) nr;
+ regs.prstatus.gprs[1] = (unsigned long)nr;
/* Load parameter registers %r2-%r7 */
regs.prstatus.gprs[2] = arg1;
regs.prstatus.gprs[3] = arg2;
@@ -465,7 +442,7 @@ int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
regs.prstatus.gprs[6] = arg5;
regs.prstatus.gprs[7] = arg6;
- err = compel_execute_syscall(ctl, &regs, (char *) code_syscall);
+ err = compel_execute_syscall(ctl, &regs, (char *)code_syscall);
/* Return code from system is in %r2 */
if (ret)
@@ -476,9 +453,7 @@ int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
/*
* Issue s390 mmap call
*/
-void *remote_mmap(struct parasite_ctl *ctl,
- void *addr, size_t length, int prot,
- int flags, int fd, off_t offset)
+void *remote_mmap(struct parasite_ctl *ctl, void *addr, size_t length, int prot, int flags, int fd, off_t offset)
{
void *where = (void *)ctl->ictx.syscall_ip + BUILTIN_SYSCALL_SIZE;
struct mmap_arg_struct arg_struct;
@@ -501,8 +476,7 @@ void *remote_mmap(struct parasite_ctl *ctl,
}
/* Do syscall */
- err = compel_syscall(ctl, __NR_mmap, &map, (unsigned long) where,
- 0, 0, 0, 0, 0);
+ err = compel_syscall(ctl, __NR_mmap, &map, (unsigned long)where, 0, 0, 0, 0, 0);
if (err < 0 || (long)map < 0)
map = 0;
@@ -510,8 +484,7 @@ void *remote_mmap(struct parasite_ctl *ctl,
if (ptrace_poke_area(pid, &arg_struct, where, sizeof(arg_struct))) {
pr_err("Can't restore mmap args (pid: %d)\n", pid);
if (map != 0) {
- err = compel_syscall(ctl, __NR_munmap, NULL, map,
- length, 0, 0, 0, 0);
+ err = compel_syscall(ctl, __NR_munmap, NULL, map, length, 0, 0, 0, 0);
if (err)
pr_err("Can't munmap %d\n", err);
map = 0;
@@ -524,14 +497,12 @@ void *remote_mmap(struct parasite_ctl *ctl,
/*
* Setup registers for parasite call
*/
-void parasite_setup_regs(unsigned long new_ip, void *stack,
- user_regs_struct_t *regs)
+void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs)
{
regs->prstatus.psw.addr = new_ip;
if (!stack)
return;
- regs->prstatus.gprs[15] = ((unsigned long) stack) -
- STACK_FRAME_OVERHEAD;
+ regs->prstatus.gprs[15] = ((unsigned long)stack) - STACK_FRAME_OVERHEAD;
}
/*
@@ -579,9 +550,7 @@ int arch_fetch_sas(struct parasite_ctl *ctl, struct rt_sigframe *s)
long ret;
int err;
- err = compel_syscall(ctl, __NR_sigaltstack,
- &ret, 0, (unsigned long)&s->uc.uc_stack,
- 0, 0, 0, 0);
+ err = compel_syscall(ctl, __NR_sigaltstack, &ret, 0, (unsigned long)&s->uc.uc_stack, 0, 0, 0, 0);
return err ? err : ret;
}
@@ -655,9 +624,9 @@ enum kernel_ts_level {
};
/* See arch/s390/include/asm/processor.h */
-#define TASK_SIZE_LEVEL_3 0x40000000000UL /* 4 TB */
-#define TASK_SIZE_LEVEL_4 0x20000000000000UL /* 8 PB */
-#define TASK_SIZE_LEVEL_5 0xffffffffffffefffUL /* 16 EB - 0x1000 */
+#define TASK_SIZE_LEVEL_3 0x40000000000UL /* 4 TB */
+#define TASK_SIZE_LEVEL_4 0x20000000000000UL /* 8 PB */
+#define TASK_SIZE_LEVEL_5 0xffffffffffffefffUL /* 16 EB - 0x1000 */
/*
* Return detected kernel version regarding task size level
@@ -671,12 +640,12 @@ static enum kernel_ts_level get_kernel_ts_level(void)
/* Check for 5 levels */
if (criu_end_addr >= TASK_SIZE_LEVEL_4)
return KERNEL_TS_LEVEL_5;
- else if (munmap((void *) TASK_SIZE_LEVEL_4, 0x1000) == 0)
+ else if (munmap((void *)TASK_SIZE_LEVEL_4, 0x1000) == 0)
return KERNEL_TS_LEVEL_5;
if (criu_end_addr < TASK_SIZE_LEVEL_3) {
/* Check for 4 level kernel with fix */
- if (munmap((void *) TASK_SIZE_LEVEL_3, 0x1000) == 0)
+ if (munmap((void *)TASK_SIZE_LEVEL_3, 0x1000) == 0)
return KERNEL_TS_LEVEL_4_FIX_YES;
else
return KERNEL_TS_LEVEL_4_FIX_NO;
diff --git a/compel/arch/x86/plugins/std/syscalls/syscall32.c b/compel/arch/x86/plugins/std/syscalls/syscall32.c
index e172cacff..0f2fec3ff 100644
--- a/compel/arch/x86/plugins/std/syscalls/syscall32.c
+++ b/compel/arch/x86/plugins/std/syscalls/syscall32.c
@@ -1,16 +1,16 @@
#include "asm/types.h"
#include "syscall-32.h"
-#define SYS_SOCKET 1 /* sys_socket(2) */
-#define SYS_BIND 2 /* sys_bind(2) */
-#define SYS_CONNECT 3 /* sys_connect(2) */
-#define SYS_SENDTO 11 /* sys_sendto(2) */
-#define SYS_RECVFROM 12 /* sys_recvfrom(2) */
-#define SYS_SHUTDOWN 13 /* sys_shutdown(2) */
-#define SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */
-#define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */
-#define SYS_SENDMSG 16 /* sys_sendmsg(2) */
-#define SYS_RECVMSG 17 /* sys_recvmsg(2) */
+#define SYS_SOCKET 1 /* sys_socket(2) */
+#define SYS_BIND 2 /* sys_bind(2) */
+#define SYS_CONNECT 3 /* sys_connect(2) */
+#define SYS_SENDTO 11 /* sys_sendto(2) */
+#define SYS_RECVFROM 12 /* sys_recvfrom(2) */
+#define SYS_SHUTDOWN 13 /* sys_shutdown(2) */
+#define SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */
+#define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */
+#define SYS_SENDMSG 16 /* sys_sendmsg(2) */
+#define SYS_RECVMSG 17 /* sys_recvmsg(2) */
long sys_socket(int domain, int type, int protocol)
{
@@ -20,59 +20,61 @@ long sys_socket(int domain, int type, int protocol)
long sys_connect(int sockfd, struct sockaddr *addr, int addrlen)
{
- uint32_t a[] = {(uint32_t)sockfd, (uint32_t)addr, (uint32_t)addrlen};
+ uint32_t a[] = { (uint32_t)sockfd, (uint32_t)addr, (uint32_t)addrlen };
return sys_socketcall(SYS_CONNECT, (unsigned long *)a);
}
long sys_sendto(int sockfd, void *buff, size_t len, unsigned int flags, struct sockaddr *addr, int addr_len)
{
- uint32_t a[] = {(uint32_t)sockfd, (uint32_t)buff, (uint32_t)len, (uint32_t)flags, (uint32_t)addr, (uint32_t)addr_len};
+ uint32_t a[] = { (uint32_t)sockfd, (uint32_t)buff, (uint32_t)len,
+ (uint32_t)flags, (uint32_t)addr, (uint32_t)addr_len };
return sys_socketcall(SYS_SENDTO, (unsigned long *)a);
}
long sys_recvfrom(int sockfd, void *ubuf, size_t size, unsigned int flags, struct sockaddr *addr, int *addr_len)
{
- uint32_t a[] = {(uint32_t)sockfd, (uint32_t)ubuf, (uint32_t)size, (uint32_t)flags, (uint32_t)addr, (uint32_t)addr_len};
+ uint32_t a[] = { (uint32_t)sockfd, (uint32_t)ubuf, (uint32_t)size,
+ (uint32_t)flags, (uint32_t)addr, (uint32_t)addr_len };
return sys_socketcall(SYS_RECVFROM, (unsigned long *)a);
}
long sys_sendmsg(int sockfd, const struct msghdr *msg, int flags)
{
- uint32_t a[] = {(uint32_t)sockfd, (uint32_t)msg, (uint32_t)flags};
+ uint32_t a[] = { (uint32_t)sockfd, (uint32_t)msg, (uint32_t)flags };
return sys_socketcall(SYS_SENDMSG, (unsigned long *)a);
}
long sys_recvmsg(int sockfd, struct msghdr *msg, int flags)
{
- uint32_t a[] = {(uint32_t)sockfd, (uint32_t)msg, (uint32_t)flags};
+ uint32_t a[] = { (uint32_t)sockfd, (uint32_t)msg, (uint32_t)flags };
return sys_socketcall(SYS_RECVMSG, (unsigned long *)a);
}
long sys_shutdown(int sockfd, int how)
{
- uint32_t a[] = {(uint32_t)sockfd, (uint32_t)how};
+ uint32_t a[] = { (uint32_t)sockfd, (uint32_t)how };
return sys_socketcall(SYS_SHUTDOWN, (unsigned long *)a);
}
long sys_bind(int sockfd, const struct sockaddr *addr, int addrlen)
{
- uint32_t a[] = {(uint32_t)sockfd, (uint32_t)addr, (uint32_t)addrlen};
+ uint32_t a[] = { (uint32_t)sockfd, (uint32_t)addr, (uint32_t)addrlen };
return sys_socketcall(SYS_BIND, (unsigned long *)a);
}
long sys_setsockopt(int sockfd, int level, int optname, const void *optval, unsigned int optlen)
{
- uint32_t a[] = {(uint32_t)sockfd, (uint32_t)level, (uint32_t)optname, (uint32_t)optval, (uint32_t)optlen};
+ uint32_t a[] = { (uint32_t)sockfd, (uint32_t)level, (uint32_t)optname, (uint32_t)optval, (uint32_t)optlen };
return sys_socketcall(SYS_SETSOCKOPT, (unsigned long *)a);
}
long sys_getsockopt(int sockfd, int level, int optname, const void *optval, unsigned int *optlen)
{
- uint32_t a[] = {(uint32_t)sockfd, (uint32_t)level, (uint32_t)optname, (uint32_t)optval, (uint32_t)optlen};
+ uint32_t a[] = { (uint32_t)sockfd, (uint32_t)level, (uint32_t)optname, (uint32_t)optval, (uint32_t)optlen };
return sys_socketcall(SYS_GETSOCKOPT, (unsigned long *)a);
}
-#define SHMAT 21
+#define SHMAT 21
long sys_shmat(int shmid, void *shmaddr, int shmflag)
{
diff --git a/compel/arch/x86/src/lib/cpu.c b/compel/arch/x86/src/lib/cpu.c
index c96f01353..5ca794ea0 100644
--- a/compel/arch/x86/src/lib/cpu.c
+++ b/compel/arch/x86/src/lib/cpu.c
@@ -8,7 +8,7 @@
#include "log.h"
#include "common/bug.h"
-#undef LOG_PREFIX
+#undef LOG_PREFIX
#define LOG_PREFIX "cpu: "
static compel_cpuinfo_t rt_info;
@@ -29,32 +29,24 @@ static void fetch_rt_cpuinfo(void)
* to save/restore PT state in Linux.
*/
-static const char * const xfeature_names[] = {
- "x87 floating point registers" ,
- "SSE registers" ,
- "AVX registers" ,
- "MPX bounds registers" ,
- "MPX CSR" ,
- "AVX-512 opmask" ,
- "AVX-512 Hi256" ,
- "AVX-512 ZMM_Hi256" ,
- "Processor Trace" ,
+static const char *const xfeature_names[] = {
+ "x87 floating point registers",
+ "SSE registers",
+ "AVX registers",
+ "MPX bounds registers",
+ "MPX CSR",
+ "AVX-512 opmask",
+ "AVX-512 Hi256",
+ "AVX-512 ZMM_Hi256",
+ "Processor Trace",
"Protection Keys User registers",
- "Hardware Duty Cycling" ,
+ "Hardware Duty Cycling",
};
static short xsave_cpuid_features[] = {
- X86_FEATURE_FPU,
- X86_FEATURE_XMM,
- X86_FEATURE_AVX,
- X86_FEATURE_MPX,
- X86_FEATURE_MPX,
- X86_FEATURE_AVX512F,
- X86_FEATURE_AVX512F,
- X86_FEATURE_AVX512F,
- X86_FEATURE_INTEL_PT,
- X86_FEATURE_PKU,
- X86_FEATURE_HDC,
+ X86_FEATURE_FPU, X86_FEATURE_XMM, X86_FEATURE_AVX, X86_FEATURE_MPX,
+ X86_FEATURE_MPX, X86_FEATURE_AVX512F, X86_FEATURE_AVX512F, X86_FEATURE_AVX512F,
+ X86_FEATURE_INTEL_PT, X86_FEATURE_PKU, X86_FEATURE_HDC,
};
void compel_set_cpu_cap(compel_cpuinfo_t *c, unsigned int feature)
@@ -89,8 +81,7 @@ static int compel_fpuid(compel_cpuinfo_t *c)
uint32_t eax, ebx, ecx, edx;
size_t i;
- BUILD_BUG_ON(ARRAY_SIZE(xsave_cpuid_features) !=
- ARRAY_SIZE(xfeature_names));
+ BUILD_BUG_ON(ARRAY_SIZE(xsave_cpuid_features) != ARRAY_SIZE(xfeature_names));
if (!compel_test_cpu_cap(c, X86_FEATURE_FPU)) {
pr_err("fpu: No FPU detected\n");
@@ -98,9 +89,7 @@ static int compel_fpuid(compel_cpuinfo_t *c)
}
if (!compel_test_cpu_cap(c, X86_FEATURE_XSAVE)) {
- pr_info("fpu: x87 FPU will use %s\n",
- compel_test_cpu_cap(c, X86_FEATURE_FXSR) ?
- "FXSAVE" : "FSAVE");
+ pr_info("fpu: x87 FPU will use %s\n", compel_test_cpu_cap(c, X86_FEATURE_FXSR) ? "FXSAVE" : "FSAVE");
return 0;
}
@@ -140,12 +129,11 @@ static int compel_fpuid(compel_cpuinfo_t *c)
c->xsaves_size = ebx;
pr_debug("fpu: xfeatures_mask 0x%llx xsave_size %u xsave_size_max %u xsaves_size %u\n",
- (unsigned long long)c->xfeatures_mask,
- c->xsave_size, c->xsave_size_max, c->xsaves_size);
+ (unsigned long long)c->xfeatures_mask, c->xsave_size, c->xsave_size_max, c->xsaves_size);
if (c->xsave_size_max > sizeof(struct xsave_struct))
- pr_warn_once("fpu: max xsave frame exceed xsave_struct (%u %u)\n",
- c->xsave_size_max, (unsigned)sizeof(struct xsave_struct));
+ pr_warn_once("fpu: max xsave frame exceed xsave_struct (%u %u)\n", c->xsave_size_max,
+ (unsigned)sizeof(struct xsave_struct));
memset(c->xstate_offsets, 0xff, sizeof(c->xstate_offsets));
memset(c->xstate_sizes, 0xff, sizeof(c->xstate_sizes));
@@ -160,10 +148,10 @@ static int compel_fpuid(compel_cpuinfo_t *c)
* in the fixed offsets in the xsave area in either compacted form
* or standard form.
*/
- c->xstate_offsets[0] = 0;
- c->xstate_sizes[0] = offsetof(struct i387_fxsave_struct, xmm_space);
- c->xstate_offsets[1] = c->xstate_sizes[0];
- c->xstate_sizes[1] = FIELD_SIZEOF(struct i387_fxsave_struct, xmm_space);
+ c->xstate_offsets[0] = 0;
+ c->xstate_sizes[0] = offsetof(struct i387_fxsave_struct, xmm_space);
+ c->xstate_offsets[1] = c->xstate_sizes[0];
+ c->xstate_sizes[1] = FIELD_SIZEOF(struct i387_fxsave_struct, xmm_space);
for (i = FIRST_EXTENDED_XFEATURE; i < XFEATURE_MAX; i++) {
if (!(c->xfeatures_mask & (1UL << i)))
@@ -189,8 +177,7 @@ static int compel_fpuid(compel_cpuinfo_t *c)
* highest offset in the buffer. Ensure it does.
*/
if (last_good_offset > c->xstate_offsets[i])
- pr_warn_once("fpu: misordered xstate %d %d\n",
- last_good_offset, c->xstate_offsets[i]);
+ pr_warn_once("fpu: misordered xstate %d %d\n", last_good_offset, c->xstate_offsets[i]);
last_good_offset = c->xstate_offsets[i];
}
@@ -198,10 +185,10 @@ static int compel_fpuid(compel_cpuinfo_t *c)
BUILD_BUG_ON(sizeof(c->xstate_offsets) != sizeof(c->xstate_sizes));
BUILD_BUG_ON(sizeof(c->xstate_comp_offsets) != sizeof(c->xstate_comp_sizes));
- c->xstate_comp_offsets[0] = 0;
- c->xstate_comp_sizes[0] = offsetof(struct i387_fxsave_struct, xmm_space);
- c->xstate_comp_offsets[1] = c->xstate_comp_sizes[0];
- c->xstate_comp_sizes[1] = FIELD_SIZEOF(struct i387_fxsave_struct, xmm_space);
+ c->xstate_comp_offsets[0] = 0;
+ c->xstate_comp_sizes[0] = offsetof(struct i387_fxsave_struct, xmm_space);
+ c->xstate_comp_offsets[1] = c->xstate_comp_sizes[0];
+ c->xstate_comp_sizes[1] = FIELD_SIZEOF(struct i387_fxsave_struct, xmm_space);
if (!compel_test_cpu_cap(c, X86_FEATURE_XSAVES)) {
for (i = FIRST_EXTENDED_XFEATURE; i < XFEATURE_MAX; i++) {
@@ -211,8 +198,7 @@ static int compel_fpuid(compel_cpuinfo_t *c)
}
}
} else {
- c->xstate_comp_offsets[FIRST_EXTENDED_XFEATURE] =
- FXSAVE_SIZE + XSAVE_HDR_SIZE;
+ c->xstate_comp_offsets[FIRST_EXTENDED_XFEATURE] = FXSAVE_SIZE + XSAVE_HDR_SIZE;
for (i = FIRST_EXTENDED_XFEATURE; i < XFEATURE_MAX; i++) {
if ((c->xfeatures_mask & (1UL << i)))
@@ -221,8 +207,7 @@ static int compel_fpuid(compel_cpuinfo_t *c)
c->xstate_comp_sizes[i] = 0;
if (i > FIRST_EXTENDED_XFEATURE) {
- c->xstate_comp_offsets[i] = c->xstate_comp_offsets[i-1]
- + c->xstate_comp_sizes[i-1];
+ c->xstate_comp_offsets[i] = c->xstate_comp_offsets[i - 1] + c->xstate_comp_sizes[i - 1];
/*
* The value returned by ECX[1] indicates the alignment
@@ -240,9 +225,9 @@ static int compel_fpuid(compel_cpuinfo_t *c)
for (i = 0; i < ARRAY_SIZE(c->xstate_offsets); i++) {
if (!(c->xfeatures_mask & (1UL << i)))
continue;
- pr_debug("fpu: %-32s xstate_offsets %6d / %-6d xstate_sizes %6d / %-6d\n",
- xfeature_names[i], c->xstate_offsets[i], c->xstate_comp_offsets[i],
- c->xstate_sizes[i], c->xstate_comp_sizes[i]);
+ pr_debug("fpu: %-32s xstate_offsets %6d / %-6d xstate_sizes %6d / %-6d\n", xfeature_names[i],
+ c->xstate_offsets[i], c->xstate_comp_offsets[i], c->xstate_sizes[i],
+ c->xstate_comp_sizes[i]);
}
}
@@ -261,20 +246,15 @@ int compel_cpuid(compel_cpuinfo_t *c)
*/
/* Get vendor name */
- cpuid(0x00000000,
- (unsigned int *)&c->cpuid_level,
- (unsigned int *)&c->x86_vendor_id[0],
- (unsigned int *)&c->x86_vendor_id[8],
- (unsigned int *)&c->x86_vendor_id[4]);
+ cpuid(0x00000000, (unsigned int *)&c->cpuid_level, (unsigned int *)&c->x86_vendor_id[0],
+ (unsigned int *)&c->x86_vendor_id[8], (unsigned int *)&c->x86_vendor_id[4]);
if (!strcmp(c->x86_vendor_id, "GenuineIntel")) {
c->x86_vendor = X86_VENDOR_INTEL;
- } else if (!strcmp(c->x86_vendor_id, "AuthenticAMD") ||
- !strcmp(c->x86_vendor_id, "HygonGenuine")) {
+ } else if (!strcmp(c->x86_vendor_id, "AuthenticAMD") || !strcmp(c->x86_vendor_id, "HygonGenuine")) {
c->x86_vendor = X86_VENDOR_AMD;
} else {
- pr_err("Unsupported CPU vendor %s\n",
- c->x86_vendor_id);
+ pr_err("Unsupported CPU vendor %s\n", c->x86_vendor_id);
return -1;
}
@@ -369,7 +349,7 @@ int compel_cpuid(compel_cpuinfo_t *c)
while (*p)
*q++ = *p++;
while (q <= &c->x86_model_id[48])
- *q++ = '\0'; /* Zero-pad the rest */
+ *q++ = '\0'; /* Zero-pad the rest */
}
}
@@ -440,8 +420,7 @@ int compel_cpuid(compel_cpuinfo_t *c)
break;
}
- pr_debug("x86_family %u x86_vendor_id %s x86_model_id %s\n",
- c->x86_family, c->x86_vendor_id, c->x86_model_id);
+ pr_debug("x86_family %u x86_vendor_id %s x86_model_id %s\n", c->x86_family, c->x86_vendor_id, c->x86_model_id);
return compel_fpuid(c);
}
@@ -461,8 +440,7 @@ bool compel_fpu_has_feature(unsigned int feature)
uint32_t compel_fpu_feature_size(unsigned int feature)
{
fetch_rt_cpuinfo();
- if (feature >= FIRST_EXTENDED_XFEATURE &&
- feature < XFEATURE_MAX)
+ if (feature >= FIRST_EXTENDED_XFEATURE && feature < XFEATURE_MAX)
return rt_info.xstate_sizes[feature];
return 0;
}
@@ -470,8 +448,7 @@ uint32_t compel_fpu_feature_size(unsigned int feature)
uint32_t compel_fpu_feature_offset(unsigned int feature)
{
fetch_rt_cpuinfo();
- if (feature >= FIRST_EXTENDED_XFEATURE &&
- feature < XFEATURE_MAX)
+ if (feature >= FIRST_EXTENDED_XFEATURE && feature < XFEATURE_MAX)
return rt_info.xstate_offsets[feature];
return 0;
}
diff --git a/compel/arch/x86/src/lib/handle-elf.c b/compel/arch/x86/src/lib/handle-elf.c
index 938999b2e..78b23f28a 100644
--- a/compel/arch/x86/src/lib/handle-elf.c
+++ b/compel/arch/x86/src/lib/handle-elf.c
@@ -5,9 +5,8 @@
#include "piegen.h"
#include "log.h"
-static const unsigned char __maybe_unused
-elf_ident_64_le[EI_NIDENT] = {
- 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x01, 0x01, 0x00,
+static const unsigned char __maybe_unused elf_ident_64_le[EI_NIDENT] = {
+ 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x01, 0x01, 0x00, /* clang-format */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c
index 566238d2d..1e344bf3a 100644
--- a/compel/arch/x86/src/lib/infect.c
+++ b/compel/arch/x86/src/lib/infect.c
@@ -24,29 +24,27 @@
#include "log.h"
#ifndef NT_X86_XSTATE
-#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
+#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
#endif
#ifndef NT_PRSTATUS
-#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */
+#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */
#endif
/*
* Injected syscall instruction
*/
const char code_syscall[] = {
- 0x0f, 0x05, /* syscall */
- 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc /* int 3, ... */
+ 0x0f, 0x05, /* syscall */
+ 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc /* int 3, ... */
};
const char code_int_80[] = {
- 0xcd, 0x80, /* int $0x80 */
- 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc /* int 3, ... */
+ 0xcd, 0x80, /* int $0x80 */
+ 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc /* int 3, ... */
};
-static const int
-code_syscall_aligned = round_up(sizeof(code_syscall), sizeof(long));
-static const int
-code_int_80_aligned = round_up(sizeof(code_syscall), sizeof(long));
+static const int code_syscall_aligned = round_up(sizeof(code_syscall), sizeof(long));
+static const int code_int_80_aligned = round_up(sizeof(code_syscall), sizeof(long));
static inline __always_unused void __check_code_syscall(void)
{
@@ -57,22 +55,22 @@ static inline __always_unused void __check_code_syscall(void)
/* 10-byte legacy floating point register */
struct fpreg {
- uint16_t significand[4];
- uint16_t exponent;
+ uint16_t significand[4];
+ uint16_t exponent;
};
/* 16-byte floating point register */
struct fpxreg {
- uint16_t significand[4];
- uint16_t exponent;
- uint16_t padding[3];
+ uint16_t significand[4];
+ uint16_t exponent;
+ uint16_t padding[3];
};
-#define FPREG_ADDR(f, n) ((void *)&(f)->st_space + (n) * 16)
-#define FP_EXP_TAG_VALID 0
-#define FP_EXP_TAG_ZERO 1
-#define FP_EXP_TAG_SPECIAL 2
-#define FP_EXP_TAG_EMPTY 3
+#define FPREG_ADDR(f, n) ((void *)&(f)->st_space + (n)*16)
+#define FP_EXP_TAG_VALID 0
+#define FP_EXP_TAG_ZERO 1
+#define FP_EXP_TAG_SPECIAL 2
+#define FP_EXP_TAG_EMPTY 3
static inline uint32_t twd_fxsr_to_i387(struct i387_fxsave_struct *fxsave)
{
@@ -92,9 +90,7 @@ static inline uint32_t twd_fxsr_to_i387(struct i387_fxsave_struct *fxsave)
tag = FP_EXP_TAG_SPECIAL;
break;
case 0x0000:
- if (!st->significand[0] &&
- !st->significand[1] &&
- !st->significand[2] &&
+ if (!st->significand[0] && !st->significand[1] && !st->significand[2] &&
!st->significand[3])
tag = FP_EXP_TAG_ZERO;
else
@@ -115,8 +111,7 @@ static inline uint32_t twd_fxsr_to_i387(struct i387_fxsave_struct *fxsave)
return ret;
}
-void compel_convert_from_fxsr(struct user_i387_ia32_struct *env,
- struct i387_fxsave_struct *fxsave)
+void compel_convert_from_fxsr(struct user_i387_ia32_struct *env, struct i387_fxsave_struct *fxsave)
{
struct fpxreg *from = (struct fpxreg *)&fxsave->st_space[0];
struct fpreg *to = (struct fpreg *)env->st_space;
@@ -140,16 +135,12 @@ void compel_convert_from_fxsr(struct user_i387_ia32_struct *env,
memcpy(&to[i], &from[i], sizeof(to[0]));
}
-int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe,
- user_regs_struct_t *regs,
- user_fpregs_struct_t *fpregs)
+int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe, user_regs_struct_t *regs, user_fpregs_struct_t *fpregs)
{
bool is_native = user_regs_native(regs);
- fpu_state_t *fpu_state = is_native ?
- &sigframe->native.fpu_state :
- &sigframe->compat.fpu_state;
+ fpu_state_t *fpu_state = is_native ? &sigframe->native.fpu_state : &sigframe->compat.fpu_state;
if (is_native) {
-#define cpreg64_native(d, s) sigframe->native.uc.uc_mcontext.d = regs->native.s
+#define cpreg64_native(d, s) sigframe->native.uc.uc_mcontext.d = regs->native.s
cpreg64_native(rdi, di);
cpreg64_native(rsi, si);
cpreg64_native(rbp, bp);
@@ -173,7 +164,7 @@ int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe,
sigframe->is_native = true;
#undef cpreg64_native
} else {
-#define cpreg32_compat(d) sigframe->compat.uc.uc_mcontext.d = regs->compat.d
+#define cpreg32_compat(d) sigframe->compat.uc.uc_mcontext.d = regs->compat.d
cpreg32_compat(gs);
cpreg32_compat(fs);
cpreg32_compat(es);
@@ -206,34 +197,28 @@ int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe,
return 0;
}
-int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe,
- struct rt_sigframe *rsigframe)
+int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe, struct rt_sigframe *rsigframe)
{
- fpu_state_t *fpu_state = (sigframe->is_native) ?
- &rsigframe->native.fpu_state :
- &rsigframe->compat.fpu_state;
+ fpu_state_t *fpu_state = (sigframe->is_native) ? &rsigframe->native.fpu_state : &rsigframe->compat.fpu_state;
if (sigframe->is_native) {
unsigned long addr = (unsigned long)(void *)&fpu_state->fpu_state_64.xsave;
if ((addr % 64ul)) {
- pr_err("Unaligned address passed: %lx (native %d)\n",
- addr, sigframe->is_native);
+ pr_err("Unaligned address passed: %lx (native %d)\n", addr, sigframe->is_native);
return -1;
}
sigframe->native.uc.uc_mcontext.fpstate = (uint64_t)addr;
} else if (!sigframe->is_native) {
- sigframe->compat.uc.uc_mcontext.fpstate =
- (uint32_t)(unsigned long)(void *)&fpu_state->fpu_state_ia32;
+ sigframe->compat.uc.uc_mcontext.fpstate = (uint32_t)(unsigned long)(void *)&fpu_state->fpu_state_ia32;
}
return 0;
}
-#define get_signed_user_reg(pregs, name) \
- ((user_regs_native(pregs)) ? (int64_t)((pregs)->native.name) : \
- (int32_t)((pregs)->compat.name))
+#define get_signed_user_reg(pregs, name) \
+ ((user_regs_native(pregs)) ? (int64_t)((pregs)->native.name) : (int32_t)((pregs)->compat.name))
static int get_task_xsave(pid_t pid, user_fpregs_struct_t *xsave)
{
@@ -310,8 +295,7 @@ static int corrupt_extregs(pid_t pid)
* - zdtm.py will grep it auto-magically from logs
* (and the seed will be known from an automatical testing)
*/
- pr_err("Corrupting %s for %d, seed %u\n",
- use_xsave ? "xsave" : "fpuregs", pid, seed);
+ pr_err("Corrupting %s for %d, seed %u\n", use_xsave ? "xsave" : "fpuregs", pid, seed);
if (!use_xsave) {
if (ptrace(PTRACE_SETFPREGS, pid, NULL, &ext_regs)) {
@@ -334,15 +318,13 @@ static int corrupt_extregs(pid_t pid)
return 0;
}
-int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs,
- user_fpregs_struct_t *ext_regs, save_regs_t save,
- void *arg, unsigned long flags)
+int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *ext_regs, save_regs_t save,
+ void *arg, unsigned long flags)
{
- user_fpregs_struct_t xsave = { }, *xs = ext_regs ? ext_regs : &xsave;
+ user_fpregs_struct_t xsave = {}, *xs = ext_regs ? ext_regs : &xsave;
int ret = -1;
- pr_info("Dumping general registers for %d in %s mode\n", pid,
- user_regs_native(regs) ? "native" : "compat");
+ pr_info("Dumping general registers for %d in %s mode\n", pid, user_regs_native(regs) ? "native" : "compat");
/* Did we come from a system call? */
if (get_signed_user_reg(regs, orig_ax) >= 0) {
@@ -423,13 +405,8 @@ int compel_set_task_ext_regs(pid_t pid, user_fpregs_struct_t *ext_regs)
return 0;
}
-int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
- unsigned long arg1,
- unsigned long arg2,
- unsigned long arg3,
- unsigned long arg4,
- unsigned long arg5,
- unsigned long arg6)
+int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret, unsigned long arg1, unsigned long arg2,
+ unsigned long arg3, unsigned long arg4, unsigned long arg5, unsigned long arg6)
{
user_regs_struct_t regs = ctl->orig.regs;
bool native = user_regs_native(&regs);
@@ -438,51 +415,47 @@ int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
if (native) {
user_regs_struct64 *r = &regs.native;
- r->ax = (uint64_t)nr;
- r->di = arg1;
- r->si = arg2;
- r->dx = arg3;
+ r->ax = (uint64_t)nr;
+ r->di = arg1;
+ r->si = arg2;
+ r->dx = arg3;
r->r10 = arg4;
- r->r8 = arg5;
- r->r9 = arg6;
+ r->r8 = arg5;
+ r->r9 = arg6;
err = compel_execute_syscall(ctl, &regs, code_syscall);
} else {
user_regs_struct32 *r = &regs.compat;
- r->ax = (uint32_t)nr;
- r->bx = arg1;
- r->cx = arg2;
- r->dx = arg3;
- r->si = arg4;
- r->di = arg5;
- r->bp = arg6;
+ r->ax = (uint32_t)nr;
+ r->bx = arg1;
+ r->cx = arg2;
+ r->dx = arg3;
+ r->si = arg4;
+ r->di = arg5;
+ r->bp = arg6;
err = compel_execute_syscall(ctl, &regs, code_int_80);
}
- *ret = native ?
- (long)get_user_reg(&regs, ax) :
- (int)get_user_reg(&regs, ax);
+ *ret = native ? (long)get_user_reg(&regs, ax) : (int)get_user_reg(&regs, ax);
return err;
}
-void *remote_mmap(struct parasite_ctl *ctl,
- void *addr, size_t length, int prot,
- int flags, int fd, off_t offset)
+void *remote_mmap(struct parasite_ctl *ctl, void *addr, size_t length, int prot, int flags, int fd, off_t offset)
{
long map;
int err;
bool compat_task = !user_regs_native(&ctl->orig.regs);
- err = compel_syscall(ctl, __NR(mmap, compat_task), &map,
- (unsigned long)addr, length, prot, flags, fd, offset);
+ err = compel_syscall(ctl, __NR(mmap, compat_task), &map, (unsigned long)addr, length, prot, flags, fd, offset);
if (err < 0)
return NULL;
if (map == -EACCES && (prot & PROT_WRITE) && (prot & PROT_EXEC)) {
pr_warn("mmap(PROT_WRITE | PROT_EXEC) failed for %d, "
- "check selinux execmem policy\n", ctl->rpid);
+ "check selinux execmem policy\n",
+ ctl->rpid);
return NULL;
}
if (IS_ERR_VALUE(map)) {
@@ -507,18 +480,17 @@ void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *
{
set_user_reg(regs, ip, new_ip);
if (stack)
- set_user_reg(regs, sp, (unsigned long) stack);
+ set_user_reg(regs, sp, (unsigned long)stack);
/* Avoid end of syscall processing */
set_user_reg(regs, orig_ax, -1);
/* Make sure flags are in known state */
- set_user_reg(regs, flags, get_user_reg(regs, flags) &
- ~(X86_EFLAGS_TF | X86_EFLAGS_DF | X86_EFLAGS_IF));
+ set_user_reg(regs, flags, get_user_reg(regs, flags) & ~(X86_EFLAGS_TF | X86_EFLAGS_DF | X86_EFLAGS_IF));
}
-#define USER32_CS 0x23
-#define USER_CS 0x33
+#define USER32_CS 0x23
+#define USER_CS 0x33
static bool ldt_task_selectors(pid_t pid)
{
@@ -574,30 +546,26 @@ bool arch_can_dump_task(struct parasite_ctl *ctl)
int arch_fetch_sas(struct parasite_ctl *ctl, struct rt_sigframe *s)
{
int native = compel_mode_native(ctl);
- void *where = native ?
- (void *)&s->native.uc.uc_stack :
- (void *)&s->compat.uc.uc_stack;
+ void *where = native ? (void *)&s->native.uc.uc_stack : (void *)&s->compat.uc.uc_stack;
long ret;
int err;
- err = compel_syscall(ctl, __NR(sigaltstack, !native),
- &ret, 0, (unsigned long)where,
- 0, 0, 0, 0);
+ err = compel_syscall(ctl, __NR(sigaltstack, !native), &ret, 0, (unsigned long)where, 0, 0, 0, 0);
return err ? err : ret;
}
/* Copied from the gdb header gdb/nat/x86-dregs.h */
/* Debug registers' indices. */
-#define DR_FIRSTADDR 0
-#define DR_LASTADDR 3
-#define DR_NADDR 4 /* The number of debug address registers. */
-#define DR_STATUS 6 /* Index of debug status register (DR6). */
-#define DR_CONTROL 7 /* Index of debug control register (DR7). */
+#define DR_FIRSTADDR 0
+#define DR_LASTADDR 3
+#define DR_NADDR 4 /* The number of debug address registers. */
+#define DR_STATUS 6 /* Index of debug status register (DR6). */
+#define DR_CONTROL 7 /* Index of debug control register (DR7). */
-#define DR_LOCAL_ENABLE_SHIFT 0 /* Extra shift to the local enable bit. */
-#define DR_GLOBAL_ENABLE_SHIFT 1 /* Extra shift to the global enable bit. */
-#define DR_ENABLE_SIZE 2 /* Two enable bits per debug register. */
+#define DR_LOCAL_ENABLE_SHIFT 0 /* Extra shift to the local enable bit. */
+#define DR_GLOBAL_ENABLE_SHIFT 1 /* Extra shift to the global enable bit. */
+#define DR_ENABLE_SIZE 2 /* Two enable bits per debug register. */
/* Locally enable the break/watchpoint in the I'th debug register. */
#define X86_DR_LOCAL_ENABLE(i) (1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i)))
@@ -607,17 +575,14 @@ int ptrace_set_breakpoint(pid_t pid, void *addr)
int ret;
/* Set a breakpoint */
- if (ptrace(PTRACE_POKEUSER, pid,
- offsetof(struct user, u_debugreg[DR_FIRSTADDR]),
- addr)) {
+ if (ptrace(PTRACE_POKEUSER, pid, offsetof(struct user, u_debugreg[DR_FIRSTADDR]), addr)) {
pr_perror("Unable to setup a breakpoint into %d", pid);
return -1;
}
/* Enable the breakpoint */
- if (ptrace(PTRACE_POKEUSER, pid,
- offsetof(struct user, u_debugreg[DR_CONTROL]),
- X86_DR_LOCAL_ENABLE(DR_FIRSTADDR))) {
+ if (ptrace(PTRACE_POKEUSER, pid, offsetof(struct user, u_debugreg[DR_CONTROL]),
+ X86_DR_LOCAL_ENABLE(DR_FIRSTADDR))) {
pr_perror("Unable to enable the breakpoint for %d", pid);
return -1;
}
@@ -634,9 +599,7 @@ int ptrace_set_breakpoint(pid_t pid, void *addr)
int ptrace_flush_breakpoints(pid_t pid)
{
/* Disable the breakpoint */
- if (ptrace(PTRACE_POKEUSER, pid,
- offsetof(struct user, u_debugreg[DR_CONTROL]),
- 0)) {
+ if (ptrace(PTRACE_POKEUSER, pid, offsetof(struct user, u_debugreg[DR_CONTROL]), 0)) {
pr_perror("Unable to disable the breakpoint for %d", pid);
return -1;
}
@@ -668,8 +631,7 @@ int ptrace_get_regs(pid_t pid, user_regs_struct_t *regs)
}
pr_err("PTRACE_GETREGSET read %zu bytes for pid %d, but native/compat regs sizes are %zu/%zu bytes\n",
- iov.iov_len, pid,
- sizeof(regs->native), sizeof(regs->compat));
+ iov.iov_len, pid, sizeof(regs->native), sizeof(regs->compat));
return -1;
}
@@ -687,11 +649,14 @@ int ptrace_set_regs(pid_t pid, user_regs_struct_t *regs)
return ptrace(PTRACE_SETREGSET, pid, NT_PRSTATUS, &iov);
}
-#define TASK_SIZE ((1UL << 47) - PAGE_SIZE)
+#define TASK_SIZE ((1UL << 47) - PAGE_SIZE)
/*
* Task size may be limited to 3G but we need a
* higher limit, because it's backward compatible.
*/
-#define TASK_SIZE_IA32 (0xffffe000)
+#define TASK_SIZE_IA32 (0xffffe000)
-unsigned long compel_task_size(void) { return TASK_SIZE; }
+unsigned long compel_task_size(void)
+{
+ return TASK_SIZE;
+}
diff --git a/compel/arch/x86/src/lib/thread_area.c b/compel/arch/x86/src/lib/thread_area.c
index 3ff5dc5d4..4750c6cdd 100644
--- a/compel/arch/x86/src/lib/thread_area.c
+++ b/compel/arch/x86/src/lib/thread_area.c
@@ -8,7 +8,7 @@
#include "infect-priv.h"
#ifndef PTRACE_GET_THREAD_AREA
-# define PTRACE_GET_THREAD_AREA 25
+#define PTRACE_GET_THREAD_AREA 25
#endif
/*
@@ -49,12 +49,10 @@ int __compel_arch_fetch_thread_area(int tid, struct thread_ctx *th)
d->entry_number = GDT_ENTRY_TLS_MIN + i;
}
- for (i = 0; i < GDT_ENTRY_TLS_NUM; i++)
- {
+ for (i = 0; i < GDT_ENTRY_TLS_NUM; i++) {
user_desc_t *d = &ptls->desc[i];
- err = ptrace(PTRACE_GET_THREAD_AREA, tid,
- GDT_ENTRY_TLS_MIN + i, d);
+ err = ptrace(PTRACE_GET_THREAD_AREA, tid, GDT_ENTRY_TLS_MIN + i, d);
/*
* Ignoring absent syscall on !CONFIG_IA32_EMULATION
* where such mixed code can't run.