-
Notifications
You must be signed in to change notification settings - Fork 519
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
Update several example code for newer kernel #70
Conversation
There are 2 things to worry about.
My kernel version: 5.11.0-27-generic |
The error/warning I've met with previous code:
lkmpg/examples/syscall.c:83:50: error: ‘ksys_close’ undeclared (first use in this function); did you mean ‘ksys_chown’?
83 | if (sct[__NR_close] == (unsigned long *) ksys_close)
lkmpg/examples/cryptosk.c:17:24: error: field ‘sg’ has incomplete type
17 | struct scatterlist sg;
lkmpg/examples/cryptosk.c:143:9: error: implicit declaration of function ‘get_random_bytes’ [-Werror=implicit-function-declaration]
143 | get_random_bytes(sk->ivdata, CIPHER_BLOCK_SIZE);
lkmpg/examples/cryptosk.c:156:5: error: implicit declaration of function ‘sg_init_one’ [-Werror=implicit-function-declaration]
156 | sg_init_one(&sk->sg, sk->scratchpad, CIPHER_BLOCK_SIZE);
error: macro "DECLARE_TASKLET" passed 3 arguments, but takes just 2 |
Seems like |
5e2bb72
to
ae2f994
Compare
872b02d
to
9c79f0f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modify the the description in TeX document about DECLARE_TASKLET_OLD transition.
There appears with a lot of |
"fn-in" in Makefile is intended to prevent make4ht from Output can be checked in https://fennecj.github.io/lkmpg/#tasklets |
Known issues with current example code: If you using newer kernel(e.g linux 5.11.x) to compile the example code, you may meet following error: 1. syscall.c:83:50: error: ‘ksys_close’ undeclared; 2. cryptosk.c:17:24: error: field ‘sg’ has incomplete type 3. cryptosk.c:143:9: error: implicit declaration of function ‘get_random_bytes’ 4. error: macro "DECLARE_TASKLET" passed 3 arguments, but takes just 2 Solutions/workaround: 1. In syscall.c, replace #include <linux/syscalls.h> with #include <linux/fdtable.h> and replace ksys_close with close_fd if the kernel version >= 5.11. [1][2] 2. Add #include <linux/scatterlist.h> into cryptosk.c 3. Add #include <linux/random.h> into cryptosk.c 4. In bottomhalf.c and example_tasklet.c, replace DECLARE_TASKLET with DECLARE_TASKLET_OLD and dispose third argument(0L). [3] [1] - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1572bfdf21d4d50e51941498ffe0b56c2289f783 [2] - https://www.mail-archive.com/meta-arago@arago-project.org//msg11939.html [3] - https://patchwork.kernel.org/project/kernel-hardening/patch/20200716030847.1564131-3-keescook@chromium.org/
Thank @fennecJ for the great work! |
Known issues with current example code:
If you using newer kernel(e.g linux 5.11.x) to compile the example code,
you may meet following error:
‘get_random_bytes’
Solutions/workaround:
#include <linux/fdtable.h> and replace ksys_close with close_fd
if the kernel version >= 5.11. [1][2]
with DECLARE_TASKLET_OLD and dispose third argument(0L). [3]
[1] - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1572bfdf21d4d50e51941498ffe0b56c2289f783
[2] - https://www.mail-archive.com/meta-arago@arago-project.org//msg11939.html
[3] - https://patchwork.kernel.org/project/kernel-hardening/patch/20200716030847.1564131-3-keescook@chromium.org/