fennecJ
76c7b0edbd
Keep workflow running even if no release tag found
...
The action we used to delete the old release somehow cannot find the
release tag in forked repo and cause the workflow failed.
To solve this issue, simply setting `fail-if-no-release` option to false
will do the trick.
2021-09-24 13:34:32 +08:00
linD026
0d5ac2a5e2
CI: Enforce status checks once pull requests received ( #113 )
...
We tend to reject the pull requests if they fail to pass coding style checks
and static analysis.
See https://www.wesleyhaakman.org/working-with-pull-requests-status-checks-arm-templates-and-github-actions/
2021-09-23 20:01:13 +08:00
linD026
1a6fb67cf2
Fix potential concurrent access problems with VFS ( #108 )
...
Since Linux v3.14, the read, write and seek operations of "struct file" are
guaranteed for thread safety [1][2]. This patch added an explanation.
Here are the potential problems:
chardev.c:
- Move the "msg_ptr" pointer into the read function to remove unnecessary usage.
- List the clear states of "already_open" by using mnemonic enumeration.
chardev2.c:
- The "buffer" in the write function is user space data. It cannot use in the
kernel space.
- Reduce the redundant type transformation.
- List the states of "already_open". Same as chardev.c.
[1] https://lore.kernel.org/lkml/20140303210359.26624.qmail@science.horizon.com/T/#u
[2] 9c225f2655
2021-09-23 12:20:10 +08:00
Jim Huang
027f39c0c1
Denote LWN hyperlink
2021-09-23 00:36:42 +08:00
Jim Huang
37f9a86fec
Mention the Online Books Page
2021-09-22 01:38:39 +08:00
Jim Huang
81a1e88c64
Merge pull request #109 from YLowy/master
...
Fix typo
2021-09-19 20:47:19 +08:00
Ylowy
24257e837e
Typo.
2021-09-19 20:39:56 +08:00
Jim Huang
09e636cc80
Merge pull request #107 from sprowell/master
...
Fixed parameter name for hello-5.
2021-09-16 04:19:49 +08:00
Stacy Prowell
728b7fd432
Fixed parameter name for hello-5.
...
Parameters are case-sensitive, so myintArray is different from myintarray, and people who are running the example with copy/paste will find it doesn't work as described in the text.
2021-09-15 16:05:26 -04:00
Jim Huang
7fd696cb95
Merge pull request #106 from linD026/master
...
CI: Integrate the Sparse into the CI pipeline
2021-09-15 13:27:02 +08:00
linD026
25d82ec47f
CI: Integrate the Sparse into the CI pipeline
...
Sparse[1] is a semantic parser for C language, it can find out the
potential problem of the example code.
[1] https://www.kernel.org/doc/html/latest/dev-tools/sparse.html
2021-09-15 12:43:56 +08:00
linD026
5070fcd9d0
CI: Run static analysis with Cppcheck ( #105 )
...
Cppcheck[1] is integrated into CI pipeline for running static analysis.
However, Cppcheck is known to report false-positive, and we have to
suppress some warnings in advance.
[1] https://cppcheck.sourceforge.io/
2021-09-14 00:52:04 +08:00
Jim Huang
55b77fac8d
Merge pull request #104 from linD026/master
...
ioctl: Remove unnecessary initialization
2021-09-13 16:15:08 +08:00
linD026
fa035da36e
ioctl.c: Remove unnecessary initialization
...
The "alloc_chrdev_region" function will dynamically choose the
major number and store it at "dev". It is unnecessary to initialize
the "dev" before the "alloc_chrdev_region" function.
2021-09-13 14:55:16 +08:00
Jim Huang
a1aa18efe0
Trivial GitHub workflow tweak
2021-09-13 06:41:47 +00:00
Jim Huang
0a4aad90b4
Make CI validation more verbose
2021-09-13 04:03:04 +00:00
Jim Huang
42a21d2c55
Mention Free Ebook Foundation
2021-09-12 09:34:04 +00:00
Jim Huang
4473733c2e
Merge pull request #102 from giladreti/patch-1
...
Fix typo
2021-09-12 17:11:44 +08:00
Gilad Reti
e8d5bf7fd4
fix typo: compatibiity -> compatibility
2021-09-12 08:54:53 +03:00
Jim Huang
3c3ef728bf
Merge pull request #101 from fennecJ/patch
...
Enable kbleds in CI pipeline
2021-09-12 12:05:00 +08:00
fennecJ
377e63449b
Remove kbleds from non-working list
...
Since #98 has fixed the error with kbleds caused by changed timer API,
now it can work again with docker container.
2021-09-12 11:47:00 +08:00
Jim Huang
c519f57403
Simplify the wording
2021-09-10 14:19:22 +00:00
Jim Huang
0400543038
Improve top-level documentation
...
This patch introduced the changes:
- Build instructions
- Strip duplicated commands
- Add more hyperlinks
- Mention nerdctl as Docker CLI replacement
2021-09-10 14:03:09 +00:00
linD026
62dbb1b7b8
Adapt the timer API Usage ( #98 )
...
Since v4.14 [1], the timer API has been changed to improve memory safety.
The series of improvements ended up at v4.15 [2].
Reference: https://lwn.net/Articles/735887/
Close #97
[1] 686fef928b
[2] 841b86f328
2021-09-10 12:29:48 +08:00
Kellegram
d5c43420c8
Workaround inconsistent text scaling ( #100 )
...
p + pre remains at em as we want to use the parent element here (however rem
could be used too, just requires a bigger value). I am setting it to 110% size,
otherwise some code blocks have relatively small text. The smaller code blocks
do appear bigger.
2021-09-10 12:08:57 +08:00
Kellegram
3b9a3bd0b8
Improve readability ( #96 )
...
This new foreground + background color maintains the minimum of 7:1 contrast ratio as specified by WCAG (this has 7.36:1) and is the same colors Firefox reading mode uses when choosing the sepia theme.
Fonts are too small by default, using responsive units (em) let's me increase them, I am unsure where or if there is font-size specified for parent anywhere but it seems to have been manually decreased.
Increased max-width slightly to adjust for new size and more standard line-height, so the doc doesn't feel significantly longer, still maintains good eye travel.
2021-09-09 11:20:41 +08:00
Jim Huang
4ef3d90ffe
suppress warning: no newline at end of file
2021-09-08 22:23:02 +08:00
fennecJ
3fcbb8e182
Improve CI pipeline to automate module testing ( #95 )
...
The script executes insmod/rmmod twice with available kernel modules.
Close #72
2021-09-08 20:38:50 +08:00
linD026
148fb013ee
Avoid unexpected concurrent access ( #94 )
...
In file {chardev,chardev2,sleep}.c, the variable to determine
the exclusive access was of integer type, which led to race
condition.
This patch rewrote the above with atomic CAS respectively
to eliminate the race.
Close #93
2021-09-07 23:42:06 +08:00
linD026
9289bfe59c
Fix the warnings raised by Sparse ( #92 )
...
Sparse[1] is a semantic parser, capable of finding out the potential
problems of Linux kernel code. This patch fixed the warnings.
[1] https://www.kernel.org/doc/html/latest/dev-tools/sparse.html
2021-09-04 17:53:29 +08:00
Jim Huang
21ca08a17e
Merge pull request #91 from ccs100203/master
...
Fix Typo
2021-09-03 23:13:10 +08:00
ccs100203
56c99328b3
Fix Typo
...
from "mask" to "masks"
from "quick" to "quickly"
from "a" to "an"
2021-09-03 23:02:17 +08:00
linD026
d27203ef46
Enforce consistent style for directory "other" ( #89 )
2021-09-02 16:26:29 +08:00
linD026
eef2bc4395
Enforce Linux kernel coding style ( #88 )
...
The only exception is to indent with four spaces rather than tabs
for sticking to compact layout of source listing.
Close #87
2021-09-02 15:15:07 +08:00
Jim Huang
6110f8ee3c
Rewrite the descriptions about bottom half
2021-09-01 12:07:25 +08:00
Jim Huang
5b953eea75
Merge pull request #86 from linD026/master
...
Fix typo
2021-09-01 09:44:45 +08:00
linzhien
5cd96a80c9
Fix typo
2021-09-01 07:44:40 +08:00
fennecJ
0e11c00e1b
Add GitHub buttons in rendered HTML ( #85 )
...
GitHub buttons are rendered in the generated HTML:
one is GitHub project page; another is PDF download.
Close #84
2021-08-31 23:49:18 +08:00
linD026
cccc98ab2c
Fix disallowed cr0 write protection and close_fd ( #80 )
...
Since the commit 8dbec27a242cd3e2816eeb98d3237b9f57cf6232 [1]
(kernel version v5.3+ [2]) the sensitive CR0 bits in x86 is pinned,
we need to use the inline asm [3][4] to bypass it.
commit 8dbec27a242cd3e2816eeb98d3237b9f57cf6232 :
> With sensitive CR4 bits pinned now, it's possible that the WP bit for
> CR0 might become a target as well.
>
> Following the same reasoning for the CR4 pinning, pin CR0's WP
> bit. Contrary to the cpu feature dependend CR4 pinning this can be done
> with a constant value.
Also, getting "sys_call_table" [8] from the symbol lookup by using the address
of "close_fd" does not work for v5.11+ [5][6]. The reason is the entry of
"sys_call_table[__NR_close]" is not the address of "close_fd", actually
it is "__x64_sys_close" in x86.
Two solutions were proposed: using "kallsyms_lookup_name" [7] or just specifying
the address into the module. The symbol "kallsyms_lookup_name" is unexported
since v5.7; the address of "sys_call_table" can be found in
"/boot/System.map" or "/proc/kallsyms".
Since v5.7, the manual symbol lookup is not guaranteed to work
because of control-flow integrity (or control-flow enforcement [9][10]) is added
[11] for x86, but it is disabled since v5.11 [12][13]. To make sure manual symbol
lookup work, it only uses up to v5.4.
Reference:
[1] 8dbec27a24
[2] https://outflux.net/blog/archives/2019/11/14/security-things-in-linux-v5-3/
[3] https://patchwork.kernel.org/project/linux-kbuild/patch/20200903203053.3411268-3-samitolvanen@google.com/
[4] https://stackoverflow.com/questions/58512430/how-to-write-to-protected-pages-in-the-linux-kernel
[5] https://lore.kernel.org/bpf/20201120231441.29911-21-ebiederm@xmission.com/
[6] https://lore.kernel.org/bpf/87blj83ysq.fsf@x220.int.ebiederm.org/
[7] 0bd476e6c6
[8] 8f27766a88
[9] https://lore.kernel.org/lkml/20200204171425.28073-1-yu-cheng.yu@intel.com/
[10] https://lore.kernel.org/linux-doc/20201110162211.9207-1-yu-cheng.yu@intel.com/T/
[11] 5790921bc1
[12] 20bf2b3787
[13] https://lore.kernel.org/bpf/20210128123842.c9e33949e62f504b84bfadf5@gmail.com/
2021-08-31 11:07:01 +08:00
Jim Huang
d3bde7daed
print_string: Validate tty before accessing its operations
...
Close #81
2021-08-30 01:41:57 +08:00
Jim Huang
b990049715
Merge pull request #79 from xatier/patch-1
...
Update Arch Linux kernel headers information
2021-08-26 11:14:11 +08:00
xatier
1f9f201940
Update Archlinux kernel headers instructions
...
`linux-libre-headers` has been moved to AUR [1]. We can simply install `linux-headers` [2] instead.
[1] https://aur.archlinux.org/packages/linux-libre-headers/
[2] https://archlinux.org/packages/core/x86_64/linux-headers/
2021-08-25 20:11:27 -07:00
linD026
06b75942cc
Fix incorrect major number registration in chardev ( #77 )
...
chardev2.c demonstrates the ioctl operation with static major
number MAJOR_NUM, but there also exists "Major," the dynamic
one, which results in registration and deregistration on different
device. Once the module remove, it cannot insert again:
$ sudo insmod chardev2.ko
$ sudo rmmod chardev2
$ cat /proc/devices
Character devices:
...
100 char_dev
$ sudo insmod chardev2.ko
insmod: ERROR: could not insert module chardev2.ko: Device or resource busy
This patch removed the use of dynamic major number.
2021-08-26 03:16:17 +08:00
Jim Huang
c97348d2d5
Merge pull request #75 from tuckerpo/fix/errno_assignment
...
Fix: errno assignment should be comparison.
2021-08-24 23:22:32 +08:00
Tucker Polomik
a183cc72f0
Fix: errno assignment should be comparison.
2021-08-24 11:16:25 -04:00
Jim Huang
ecfe9606de
Get rid of the initial 0 that shows up in every (sub)section
...
Every section and subsection number can be eliminated by adding the
renewcommand.
Suggested by Lars Engebretsen.
2021-08-24 19:02:16 +08:00
Jim Huang
9d39f658c7
Merge pull request #74 from brdbkr/master
...
Fixed typo
2021-08-24 14:08:24 +08:00
Brad Baker
8012508508
Fixing typo
2021-08-24 00:15:47 -04:00
Jim Huang
fe3db9f939
Merge pull request #70 from fennecJ/patch
...
Adapt recent kernel changes
2021-08-24 03:41:14 +08:00
fennecJ
870b26fa2d
Update several example code for newer kernel
...
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/
2021-08-23 21:30:43 +08:00