Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation trouble on Debian Buster (10.5) #10

Open
rwhitworth opened this issue Aug 19, 2020 · 4 comments
Open

Installation trouble on Debian Buster (10.5) #10

rwhitworth opened this issue Aug 19, 2020 · 4 comments

Comments

@rwhitworth
Copy link

This looks like an issue with the Debian supplied kernel-headers package. Any ideas on what to do?

This is a fresh install of Debian Buster 10.5. I had to install packages build-essential sudo linux-headers-amd64 to get to this point.

uname -a output:
Linux deb-afl-kernel 4.19.0-10-amd64 #1 SMP Debian 4.19.132-1 (2020-07-24) x86_64 GNU/Linux

root@deb-afl-kernel:~/AFL-Snapshot-LKM# ./load.sh
sudo env LINUX_SYSTEM_MAP='/boot/System.map-4.19.0-10-amd64' python3 lookup_symbols.py
make -C '/lib/modules/4.19.0-10-amd64/build' M='/root/AFL-Snapshot-LKM/src' modules
make[1]: Entering directory '/usr/src/linux-headers-4.19.0-10-amd64'
  CC [M]  /root/AFL-Snapshot-LKM/src/memory.o
/root/AFL-Snapshot-LKM/src/memory.c: In function ‘recover_memory_snapshot’:
/root/AFL-Snapshot-LKM/src/memory.c:483:30: warning: unused variable ‘entry’ [-Wunused-variable]
   pte_t *               pte, entry;
                              ^~~~~
/root/AFL-Snapshot-LKM/src/memory.c:481:30: warning: unused variable ‘prev_sp’ [-Wunused-variable]
   struct snapshot_page *sp, *prev_sp = NULL;
                              ^~~~~~~
  CC [M]  /root/AFL-Snapshot-LKM/src/files.o
/root/AFL-Snapshot-LKM/src/files.c: In function ‘recover_files_snapshot’:
/root/AFL-Snapshot-LKM/src/files.c:56:24: warning: unused variable ‘file’ [-Wunused-variable]
           struct file *file = fdt->fd[i];
                        ^~~~
/root/AFL-Snapshot-LKM/src/files.c: In function ‘clean_files_snapshot’:
/root/AFL-Snapshot-LKM/src/files.c:78:24: warning: unused variable ‘files’ [-Wunused-variable]
   struct files_struct *files = current->files;
                        ^~~~~
  CC [M]  /root/AFL-Snapshot-LKM/src/threads.o
In file included from /usr/src/linux-headers-4.19.0-10-common/include/linux/sched/signal.h:9,
                 from /usr/src/linux-headers-4.19.0-10-common/include/linux/ptrace.h:7,
                 from /usr/src/linux-headers-4.19.0-10-common/include/linux/ftrace.h:14,
                 from /usr/src/linux-headers-4.19.0-10-common/include/linux/kprobes.h:42,
                 from /root/AFL-Snapshot-LKM/src/snapshot.h:10,
                 from /root/AFL-Snapshot-LKM/src/task_data.h:4,
                 from /root/AFL-Snapshot-LKM/src/threads.c:3:
/root/AFL-Snapshot-LKM/src/threads.c: In function ‘recover_threads_snapshot’:
/usr/src/linux-headers-4.19.0-10-common/include/linux/sched/task.h:91:30: error: expected expression before ‘do’
 #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
                              ^~
/root/AFL-Snapshot-LKM/src/threads.c:41:27: note: in expansion of macro ‘get_task_struct’
   struct task_struct *t = get_task_struct(data->tsk->group_leader);
                           ^~~~~~~~~~~~~~~
make[4]: *** [/usr/src/linux-headers-4.19.0-10-common/scripts/Makefile.build:309: /root/AFL-Snapshot-LKM/src/threads.o] Error 1
make[3]: *** [/usr/src/linux-headers-4.19.0-10-common/Makefile:1545: _module_/root/AFL-Snapshot-LKM/src] Error 2
make[2]: *** [Makefile:146: sub-make] Error 2
make[1]: *** [Makefile:8: all] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.19.0-10-amd64'
make: *** [Makefile:30: all] Error 2
insmod: ERROR: could not load module afl_snapshot.ko: No such file or directory

@JoeyJiao
Copy link
Contributor

Same issue on my debian also seen on ubuntu 16.04.

@JoeyJiao
Copy link
Contributor

JoeyJiao commented Aug 20, 2020

The patch can fix the build error:

diff --git a/src/threads.c b/src/threads.c
index 38b633f..547f21e 100644
--- a/src/threads.c
+++ b/src/threads.c
@@ -38,7 +38,9 @@ static struct task_struct *next_tid(struct task_struct *start) {

 void recover_threads_snapshot(struct task_data *data) {

-  struct task_struct *t = get_task_struct(data->tsk->group_leader);
+  //struct task_struct *t = get_task_struct(data->tsk->group_leader);
+  struct task_struct *t = data->tsk->group_leader;
+  atomic_inc(&(data->tsk->group_leader)->usage);
   while (t) {

     if (t != data->tsk) send_sig(SIGKILL, t, 1);

JoeyJiao added a commit to JoeyJiao/AFL-Snapshot-LKM that referenced this issue Aug 20, 2020
@andreafioraldi
Copy link
Member

4.19 seems too old, we tested on various 5.x builds of ubuntu and arch

@rwhitworth
Copy link
Author

@andreafioraldi I had no trouble compiling on Ubuntu 20.04.1 which is 5.4 based. Thank you for pointing me in the correct direction.

I'll leave this ticket open since @JoeyJiao has also reported the issue and looks to be interested in issuing a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants