Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
e14f629
update the TODO some.
kernelslacker Sep 19, 2017
72b934f
add a script I use to monitor when the kernel interfaces change
kernelslacker Sep 19, 2017
2c49c86
add hashcheck use to TODO
kernelslacker Sep 19, 2017
14e3dbf
Fix up null ptr deref when no -l arg.
kernelslacker Sep 23, 2017
d4cb8d8
ignore possible error codes like ERESTARTSYS
kernelslacker Oct 6, 2017
68362e3
add SO_ZEROCOPY
kernelslacker Oct 26, 2017
6485043
add statx for i386
kernelslacker Oct 26, 2017
3acf7d3
add MSG_ZEROCOPY
kernelslacker Oct 26, 2017
e1b99c6
add new madvise flags
kernelslacker Oct 26, 2017
31a5115
update hashes
kernelslacker Oct 26, 2017
4060515
perf_event_open: update features to 4.14-rc6
deater Oct 26, 2017
6a3de54
TODO: some extra cmdline args
kernelslacker Oct 27, 2017
6ddabfd
1.8 release
kernelslacker Nov 3, 2017
0403334
Begin 1.9
kernelslacker Nov 28, 2017
a80833f
fd logging -> object logging
kernelslacker Nov 28, 2017
e4f31d5
compat: handle removed autofs macros
Nov 28, 2017
00a1a51
document why we take that rec->lock in the extrafork path
kernelslacker Dec 19, 2017
32aff3d
trinity: Fix compile error on linux 4.15 kernel
Feb 6, 2018
496b05a
trinity: Update and comment on s390 system call table
Feb 6, 2018
0cac1c4
trinity: Add support for preadv2/pwritev2 svcs
Feb 6, 2018
37bf9f6
trinity: Add support for statx svc
Feb 6, 2018
22d843e
trinity: Add support for mlock2 svc
Feb 6, 2018
3d26b9e
trinity: Add support for copy_file_range svc
Feb 6, 2018
b9a7bd0
trinity: Add support for readdir svc
Feb 6, 2018
617b496
trinity: Add support for runtime_instr svc
Feb 13, 2018
b57df76
trinity: Add support for s390_pci_mmio_read and write
Feb 13, 2018
3bfc517
trinity: Add support for s390_guarded_storage svc
Feb 13, 2018
2989c11
trinity: Add support for s390_sthyi svc
Feb 13, 2018
0f2a328
add ioctl pattern for sgx driver
daveti Feb 25, 2018
f966367
add sgxv2
daveti Feb 26, 2018
c07cd60
suppress packed warning
daveti Mar 1, 2018
c93bb18
memfd: fix build with glibc 2.27
baruchsiach Mar 13, 2018
b4c6f51
mlock: move MLOCK_ONFAULT to compat.h
Mar 10, 2018
83e0d12
short-circuit log handle discovery if logging disabled
kernelslacker Mar 13, 2018
43e5614
Fix pthread undefined references
jbicha Apr 2, 2018
1751b2b
parisc-specific updates
hdeller Apr 13, 2018
6ecbf3e
trinity: check pidstatfile before fclose
Chunyu-Hu Jun 8, 2018
1b2d43c
configure: fix build with kernel headers v4.17+
baruchsiach Jun 8, 2018
a5f32b9
Check if VIDIOC_RESERVED is defined.
vinsonlee Aug 23, 2018
9f6f9f9
Fixed trinity compile issue as on gcc gcc (Ubuntu 8.2.0-6ubuntu1) 8.2.0
PraveenPenguin Sep 21, 2018
62fe9d0
add skeletons for io_pgetevents & rseq
kernelslacker Jan 24, 2019
3c1c657
Silence spew from fds/bpf.c
kernelslacker Jan 24, 2019
048a4e3
proto-rds: include libc network headers first
baruchsiach Dec 12, 2018
78830fb
Compile fix missing bits of commit that added the new syscalls.
kernelslacker Jan 24, 2019
865ac5d
1.9 release
kernelslacker Jan 24, 2019
865d3fc
Begin 1.10
kernelslacker Jan 24, 2019
d9bd3f7
strncpy -> memcpy
kernelslacker Jun 14, 2019
313d5a8
cppcheck fixes
kernelslacker Jun 14, 2019
2d0c181
memfd build fixes for modern glibc
kernelslacker Jun 14, 2019
930cbe3
Add PF_XDP support
kernelslacker Jun 27, 2019
8412f26
commit the additional PF_XDP bits
kernelslacker Jun 27, 2019
c0b44d0
Add pidfd_send_signal
kernelslacker Jun 27, 2019
7cf7122
basic io_uring support
kernelslacker Jun 27, 2019
8558648
basic open_tree support
kernelslacker Jun 27, 2019
4579181
basic move_mount support
kernelslacker Jun 27, 2019
7f6e54a
basic fsopen support
kernelslacker Jun 27, 2019
fcaf829
basic fsconfig support
kernelslacker Jun 27, 2019
4953ccf
basic fsmount support
kernelslacker Jun 27, 2019
55e63bc
basic fspick support
kernelslacker Jun 27, 2019
0c15cb4
update setsockopts
kernelslacker Jun 27, 2019
415dadc
update prctl
kernelslacker Jun 27, 2019
d157fd8
update x86-32 syscalls
kernelslacker Jun 27, 2019
a9973ae
Fix compile failure on centos7
kernelslacker Jun 27, 2019
aee3c70
Bump version string to something that makes more sense
kernelslacker Jun 27, 2019
0a835af
no logging by default
kernelslacker Jun 27, 2019
02c01ee
Don't do 10 iterations of sockets we can't generate
kernelslacker Jun 27, 2019
9c209af
socket args are unsigned
kernelslacker Jun 27, 2019
92ce235
silence the perf dumper
kernelslacker Jun 27, 2019
d015b95
more signed->unsigned
kernelslacker Jun 27, 2019
ca32294
Map PF_XDP to string
kernelslacker Jun 27, 2019
4cdf48b
Fix cut-n-paste errors in smc socket creation
kernelslacker Jun 27, 2019
b28d72f
Fix reversed file closures in ftrace code.
kernelslacker Jul 1, 2019
134c1a8
remove pointless or
kernelslacker Jul 1, 2019
b5c8c4b
don't free the default dump filename ptr
kernelslacker Jul 1, 2019
28c9d12
format string fixes
kernelslacker Jul 1, 2019
ff43703
add new 5.3 syscalls
kernelslacker Jul 22, 2019
db82a52
update x86-32 syscalls
kernelslacker Jul 22, 2019
0bf2d39
Add SO_DETACH_REUSEPORT_BPF
kernelslacker Jul 22, 2019
b896011
update TCP setsockopts
kernelslacker Jul 22, 2019
f93256f
Remove DEVEL crud
kernelslacker Aug 2, 2019
45fdc97
modify_ldt: include linux/types.h before ASSEMBLY == 1
Nov 18, 2019
af355e9
syscalls: remove arch_prctl from x86_32
Nov 19, 2019
1e9e055
Remove unnecessary abstraction.
kernelslacker Dec 26, 2019
c927ff9
remove all the udp logging
kernelslacker Dec 26, 2019
185fa77
remove dead var
kernelslacker Dec 27, 2019
44e1852
Remove leftover udp.h include.
vinsonlee Dec 30, 2019
1c734c7
remove more udp detritus
kernelslacker Dec 31, 2019
e53e25c
Fix build with GCC 10.
vinsonlee Jan 31, 2020
4d2343b
new io_uring_register opcodes
kernelslacker Feb 28, 2020
c2d9174
Yet more new io_uring flags
kernelslacker Mar 29, 2021
8fc6695
syscall update for 5.12-rc5
kernelslacker Mar 29, 2021
ba354eb
Update socketopts to 5.12rc5
kernelslacker Mar 30, 2021
d295fa4
Update madvise flags
kernelslacker Mar 30, 2021
03f10b6
Update mremap flags for 5.12-rc5
kernelslacker Mar 30, 2021
da65f0a
net/proto-ip-raw.c: fix build with kernel >= 5.13
ffontaine Jul 17, 2021
b1a0aef
Use fcntl.h for dev_t & mode_t
kernelslacker Aug 26, 2021
9b8ff05
protect other children's shm from corruption
Sep 26, 2021
c1c705c
Merge pull request #36 from ZhangHongchen1/master
kernelslacker Oct 11, 2021
a3cab04
Add skeletons for a bunch of new syscalls
kernelslacker Oct 11, 2021
eadc80e
new setsockopts
kernelslacker Oct 11, 2021
75c06e1
do not let created timer send SIGINT signal
Nov 22, 2021
608712d
reduce variable scoping
kernelslacker Nov 29, 2021
80fb616
add support for riscv64 platform
changbindu Jan 9, 2022
762f31d
Fix compiler warning
brianphaley Mar 8, 2022
57081b9
panic when fd number is close to limition
May 6, 2021
2a6d0f7
remove -Wdeclaration-after-statement
kernelslacker Mar 9, 2022
74a370d
fix unlikely overflow in stallcounter
kernelslacker Mar 9, 2022
3f8670b
Ignore compiler warning
brianphaley Mar 9, 2022
5714d41
fix warning about pragma diagnostic pop without push
kernelslacker Aug 28, 2022
ee70baf
futex_waitv skeleton
kernelslacker Sep 13, 2022
e63e484
set_mempolicy_home_node skeleton
kernelslacker Sep 13, 2022
99a1822
drop decnet
ffontaine Jan 8, 2023
09ddd02
fix: previous_op_count may more than op_count case process data compe…
ZYV037 May 3, 2020
87f1530
periodic version bump
kernelslacker Jan 9, 2023
ca07c86
kvm: drop KVM_SET_MEMORY_REGION (#42)
jirislaby Mar 17, 2023
abe9de8
Avoid array access out of bounds error during initialzation of fd pro…
Weisson-Han Apr 26, 2023
3cebd54
update i386 syscall list
kernelslacker May 4, 2023
6823bac
ioctls/drm: check i810,mga,r128 and savage support (#44)
Chunyu-Hu Jun 30, 2023
e718724
ioctls/drm: fix DRM_MGA check (#45)
Chunyu-Hu Jul 10, 2023
dd950fa
add support for loongarch
wuruilong01 Sep 13, 2023
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
436 changes: 355 additions & 81 deletions Documentation/TODO

Large diffs are not rendered by default.

25 changes: 4 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
VERSION="1.8pre"

ifeq (,$(findstring pre,$(VERSION)))
DEVEL = 0
else
DEVEL = 1
endif
VERSION="2023.01"

INSTALL_PREFIX ?= $(DESTDIR)
INSTALL_PREFIX ?= $(HOME)
Expand All @@ -22,19 +16,10 @@ CFLAGS += -Wall -Wextra -I. -Iinclude/ -include config.h -Wimplicit -D_GNU_SOURC
CCSTD := $(shell if $(CC) -std=gnu11 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-std=gnu11"; else echo "-std=gnu99"; fi)
CFLAGS += $(CCSTD)

# -Werror only enabled during development, and on gcc 7+
ifeq ($(DEVEL), 1)
CPP_MAJOR := $(shell $(CPP) -dumpversion 2>&1 | cut -d'.' -f1)
CPP_MINOR := $(shell $(CPP) -dumpversion 2>&1 | cut -d'.' -f2)
WERROR := $(shell if [ $(CPP_MAJOR) -ge 7 ] ; then echo "-Werror"; else echo ""; fi)
CFLAGS += $(WERROR)
endif

ifneq ($(SYSROOT),)
CFLAGS += --sysroot=$(SYSROOT)
endif
#CFLAGS += $(shell if $(CC) -m32 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-m32"; fi)
CFLAGS += -Wdeclaration-after-statement
CFLAGS += -Wformat=2
CFLAGS += -Winit-self
CFLAGS += -Wnested-externs
Expand All @@ -46,6 +31,8 @@ CFLAGS += -Wwrite-strings
CFLAGS += -Wno-format-nonliteral
CFLAGS += -Wstrict-prototypes -Wmissing-prototypes
CFLAGS += -fsigned-char
# BPF spew.
CFLAGS += -Wno-missing-field-initializers

# needed for show_backtrace() to work correctly.
LDFLAGS += -rdynamic
Expand All @@ -57,9 +44,6 @@ LDLIBS += -lrt
ifneq ($(shell $(CC) -v 2>&1 | grep -c "clang"), 1)
CFLAGS += -Wlogical-op
CFLAGS += -Wstrict-aliasing=3
ifeq ($(DEVEL), 0)
CFLAGS += -Wno-maybe-uninitialized
endif
endif

# Sometimes useful for debugging. more useful with clang than gcc.
Expand Down Expand Up @@ -87,14 +71,14 @@ SYSCALLS_ARCH := $(shell case "$(MACHINE)" in \
syscalls/x86/x86_64/*.c;; \
(i?86*) echo syscalls/x86/*.c \
syscalls/x86/i386/*.c;; \
(s390x*) echo syscalls/s390x/*.c ;; \
esac)

VERSION_H := include/version.h

HEADERS := $(patsubst %.h,%.h,$(wildcard *.h)) $(patsubst %.h,%.h,$(wildcard syscalls/*.h)) $(patsubst %.h,%.h,$(wildcard ioctls/*.h))

SRCS := $(wildcard *.c) \
$(wildcard childops/*.c) \
$(wildcard fds/*.c) \
$(wildcard ioctls/*.c) \
$(wildcard mm/*.c) \
Expand All @@ -104,7 +88,6 @@ SRCS := $(wildcard *.c) \
$(SYSCALLS_ARCH)

OBJS := $(sort $(patsubst %.c,%.o,$(wildcard *.c))) \
$(sort $(patsubst %.c,%.o,$(wildcard childops/*.c))) \
$(sort $(patsubst %.c,%.o,$(wildcard fds/*.c))) \
$(sort $(patsubst %.c,%.o,$(wildcard ioctls/*.c))) \
$(sort $(patsubst %.c,%.o,$(wildcard mm/*.c))) \
Expand Down
117 changes: 9 additions & 108 deletions child.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,59 +27,8 @@
#include "tables.h"
#include "trinity.h" // ARRAY_SIZE
#include "uid.h"
#include "udp.h"
#include "utils.h" // zmalloc

enum childflags {
NONE,
ONESHOT,
};

struct child_funcs {
const char *name;
bool (*func)(struct childdata *child);
unsigned char likelyhood;
enum childtype type;
unsigned int flags;
};

static const struct child_funcs child_ops[] = {
{
.name = "rand_syscall",
.func = random_syscall,
.likelyhood = 100,
.type = CHILD_RAND_SYSCALL
},
/* {
.name = "read_all_files",
.func = read_all_files,
.likelyhood = 10,
.type = CHILD_READ_ALL_FILES
},
{
.name = "thrash_pid_files",
.func = thrash_pidfiles,
.likelyhood = 50,
.type = CHILD_THRASH_PID
},
{
.name = "truncate_testfile",
.func = truncate_testfile,
.likelyhood = 10,
.type = CHILD_TRUNCATE_TESTFILE
},
*/
};

static const struct child_funcs root_child_ops[] = {
{
.name = "drop_privs",
.func = drop_privs,
.likelyhood = 90,
.type = CHILD_ROOT_DROP_PRIVS,
.flags = ONESHOT,
},
};
/*
* Provide temporary immunity from the reaper
* This is useful if we're going to do something that might take
Expand Down Expand Up @@ -233,26 +182,21 @@ static void bind_child_to_cpu(struct childdata *child)
sched_setaffinity(pid, sizeof(set), &set);
}

static void log_child_spawned(pid_t pid, int childno)
{
struct msg_childspawned childmsg;

if (logging_enabled == FALSE)
return;

init_msgchildhdr(&childmsg.hdr, CHILD_SPAWNED, pid, childno);
sendudp((char *) &childmsg, sizeof(childmsg));
}

/*
* Called from the fork_children loop in the main process.
*/
static void init_child(struct childdata *child, int childno)
{
pid_t pid = getpid();
char childname[17];
unsigned int i;

for_each_child(i) {
if (child->num != i)
mprotect(shm->children[i], sizeof(struct childdata), PROT_READ);
}

log_child_spawned(pid, childno);
mprotect(pids, max_children * sizeof(int), PROT_READ);

/* Wait for parent to set our childno */
while (pids[childno] != pid) {
Expand Down Expand Up @@ -438,36 +382,12 @@ static bool handle_sigreturn(int sigwas)
if (sigwas != SIGALRM)
output(1, "[%d] Back from signal handler! (sig was %s)\n", getpid(), strsignal(sigwas));
else {
log_child_signalled(child->num, pids[child->num], SIGALRM, child->op_nr);
child->op_nr++;
}
return TRUE;
}


static const struct child_funcs * set_new_op(struct childdata *child)
{
const struct child_funcs *ops = child_ops;
size_t len = ARRAY_SIZE(child_ops);

if (orig_uid == 0) {
if (child->dropped_privs == FALSE) {
ops = root_child_ops;
len = ARRAY_SIZE(root_child_ops);
}
}

while (1) {
unsigned int i = rnd() % len;

if (rnd() % 100 <= ops[i].likelyhood) {
//output(0, "Chose %s.\n", ops[i].name);
child->type = ops[i].type;
return ops;
}
}
}

/*
* This is the child main loop, entered after init_child has completed
* from the fork_children() loop.
Expand All @@ -477,9 +397,6 @@ static const struct child_funcs * set_new_op(struct childdata *child)

void child_process(struct childdata *child, int childno)
{
const struct child_funcs *ops;
bool (*op)(struct childdata *child);
unsigned int loops;
int ret;

init_child(child, childno);
Expand All @@ -495,10 +412,6 @@ void child_process(struct childdata *child, int childno)
goto out; // Exit the child, things are getting too weird.
}

op = NULL;
ops = NULL;
loops = 0;

while (shm->exit_reason == STILL_RUNNING) {
/* If the parent reseeded, we should reflect the latest seed too. */
if (shm->seed != child->seed) {
Expand All @@ -508,28 +421,16 @@ void child_process(struct childdata *child, int childno)

periodic_work();

/* Every NEW_OP_COUNT potentially pick a new childop. */
if (loops == 0) {
ops = set_new_op(child);
op = ops->func;
loops = NEW_OP_COUNT;
}

/* timestamp, and do the childop */
/* timestamp, and do the syscall */
clock_gettime(CLOCK_MONOTONIC, &child->tp);

ret = op(child);
ret = random_syscall(child);

child->op_nr++;

if (ret == FAIL)
goto out;

loops--;

if (ops->flags & ONESHOT)
loops = 0;

if (syscalls_todo) {
if (shm->stats.op_count >= syscalls_todo) {
shm->exit_reason = EXIT_REACHED_COUNT;
Expand Down
61 changes: 0 additions & 61 deletions childops/read-all-files.c

This file was deleted.

67 changes: 0 additions & 67 deletions childops/thrash-pid-files.c

This file was deleted.

Loading