Tyler Fanelli [Sat, 8 Jul 2023 03:58:30 +0000 (23:58 -0400)]
headers: Update header installation for Fedora
Sam Erickson [Wed, 5 Jul 2023 15:14:49 +0000 (10:14 -0500)]
static_key: Include <linux/jump_label.h> (#210)
Chih-En Lin [Wed, 5 Jul 2023 01:44:21 +0000 (09:44 +0800)]
examples: Add missing __init/__exit (#209)
Close #207
Jim Huang [Tue, 4 Jul 2023 23:56:03 +0000 (07:56 +0800)]
Merge pull request #208 from samuelerickson977/master
include linux/init.h in bottomhalf.c
Sam Erickson [Tue, 4 Jul 2023 15:10:18 +0000 (10:10 -0500)]
include linux/init.h in bottomhalf.c
Jim Huang [Mon, 3 Jul 2023 21:37:06 +0000 (05:37 +0800)]
Merge pull request #206 from ekangmonyet/master
Cleanup redundant workflow step, fix release body and timestamp
Ekang Monyet [Mon, 3 Jul 2023 01:47:24 +0000 (09:47 +0800)]
Delete old release and retag latest commit
This ensures the latest commit message and timestamp can be correctly
included in the release.
Ekang Monyet [Mon, 3 Jul 2023 01:32:35 +0000 (09:32 +0800)]
Revert "Delete existing release asset before releasing"
This reverts commit
7ee66c559ff12c254d04c65c54325acbb655133a.
Jim Huang [Tue, 2 May 2023 02:58:15 +0000 (10:58 +0800)]
Merge pull request #200 from lyctw/static_key
Introduce static key in optimizations section
Peter Lin [Mon, 1 May 2023 08:15:58 +0000 (16:15 +0800)]
Introduce static key in optimizations section
This patch introduces static key technique and adds a kernel module
to demostrate how to use static key to optimize an almost unlikely
branch, the module can interact with userspace thru a character device.
Signed-off-by: Peter Lin <peterlin@qilai.dev>
Jim Huang [Mon, 1 May 2023 15:48:53 +0000 (23:48 +0800)]
Merge pull request #202 from linD026/master
CI: Switch Smatch source code to GitHub mirror
Chih-En Lin [Mon, 1 May 2023 15:26:17 +0000 (23:26 +0800)]
CI: Switch Smatch source code to GitHub mirror
Since the Smatch repository is unavailable recently [1], let's switch
to GitHub mirror, https://github.com/error27/smatch.git [2], instead
of using https://repo.or.cz/smatch.git.
[1] https://lore.kernel.org/all/Y1qf7w%2Fjo8FH5I8G@kadam/
[2] https://lore.kernel.org/all/
20220810105926.GS3460@kadam/
Jim Huang [Thu, 27 Apr 2023 03:28:05 +0000 (11:28 +0800)]
Merge pull request #198 from linD026/master
Remove sleep_on family
Chih-En Lin [Thu, 27 Apr 2023 02:20:48 +0000 (10:20 +0800)]
Remove sleep_on family
Since the commit
b8780c363d80 ("sched: remove sleep_on() and friends
"), the description about sleep_on is incorrect and the example code has
been fixed by replacing it with wait_event family. Let's also fix the
description to match the corrected code.
Jim Huang [Sun, 26 Mar 2023 01:21:53 +0000 (09:21 +0800)]
Fix macOS prerequisites
Jim Huang [Fri, 24 Mar 2023 04:23:24 +0000 (12:23 +0800)]
Merge pull request #193 from linD026/master
procfs: Enforce Linux naming style
Chih-En Lin [Fri, 24 Mar 2023 03:36:33 +0000 (11:36 +0800)]
procfs: Enforce Linux naming style
Jim Huang [Tue, 14 Mar 2023 01:01:22 +0000 (09:01 +0800)]
Merge pull request #189 from linD026/master
Improve the compatibility and fix the missing header
linD026 [Mon, 13 Mar 2023 23:59:42 +0000 (07:59 +0800)]
completion: Improve the compatibility with v5.17+
Since v5.17-rc1, particularly after the commit
cead1855266 ("exit:
Rename complete_and_exit to kthread_complete_and_exit"),
complete_and_exit() is renamed to kthread_complete_and_exit().
Close #188
linD026 [Mon, 13 Mar 2023 23:51:00 +0000 (07:51 +0800)]
chardev2: Fix missing header for {get, put}_user
Jim Huang [Thu, 23 Feb 2023 13:58:20 +0000 (21:58 +0800)]
Merge pull request #187 from linD026/master
Relocate Archlinux code snippet to avoid confusion
Chih-En Lin [Thu, 23 Feb 2023 12:53:27 +0000 (20:53 +0800)]
Relocate Archlinux code snippet to avoid confusion
Close #185
Jim Huang [Thu, 23 Feb 2023 12:33:11 +0000 (20:33 +0800)]
Merge pull request #186 from ashevche/kernel.h
Discourage kernel.h usage and other header cleanups
Andy Shevchenko [Thu, 23 Feb 2023 10:41:23 +0000 (12:41 +0200)]
treewide: Replace kernel.h by printk.h
The kernel.h should be discouraged for use.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Andy Shevchenko [Wed, 22 Feb 2023 15:43:27 +0000 (17:43 +0200)]
treewide: Clean up the headers
The rule of thumb is to include the headers we are the direct user of.
In particular, if we need an atomic API, we include <linux/atomic.h>.
On the other hand we should not use headers for no reason. In particular,
if we are not doing any IRQ job, why is the <linux/irq.h> included?
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Andy Shevchenko [Tue, 21 Feb 2023 21:03:25 +0000 (23:03 +0200)]
devicemodel: Remove duplicate owner assignment
platform_driver_register() macro already does the correct assignment for
the owner of the driver.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Jim Huang [Sun, 25 Dec 2022 12:24:10 +0000 (20:24 +0800)]
Merge pull request #184 from linD026/master
syscall: Use openat() instead of open()
linD026 [Sun, 25 Dec 2022 05:31:01 +0000 (13:31 +0800)]
syscall: Use openat() instead of open()
Since sys_open is deprecated and some architectures don't support it.
We switch the implementation to sys_openat.
Moreover, in some architectures like x86-64, the prototype of syscall,
for example, openat(), might have been changed to struct pt_regs [1]
but we cannot promise that so support the two types
(sys_openat and pt_regs).
Also, to prevent other untraced tasks print out the information, add
the uid checking in our_sys_openat().
[1] https://lore.kernel.org/lkml/
20180405095307.3730-1-linux@dominikbrodowski.net/
Close #159
Jim Huang [Sun, 25 Dec 2022 04:50:15 +0000 (12:50 +0800)]
Merge pull request #183 from linD026/master
example/syscall: Fix typo and unmatch types
linD026 [Sun, 25 Dec 2022 04:33:52 +0000 (12:33 +0800)]
example/syscall: Fix typo and unmatch types
Jim Huang [Mon, 12 Dec 2022 17:11:45 +0000 (01:11 +0800)]
Merge pull request #182 from lyctw/master
Add error message when sha256 algorithm is not supported
Peter Lin [Mon, 12 Dec 2022 14:55:06 +0000 (22:55 +0800)]
Add error message when sha256 algorithm is not supported
It failed silently when crypto_alloc_tfm() failed, so add an error
message to inform the developer to enable sha256 algorithm support.
Signed-off-by: Yu Chien Peter Lin <peterlin.tw@pm.me>
Jim Huang [Sun, 11 Dec 2022 08:49:44 +0000 (16:49 +0800)]
Merge pull request #181 from lyctw/master
Fix typo in interrupt handlers section
Peter Lin [Sun, 11 Dec 2022 06:45:42 +0000 (14:45 +0800)]
Fix typo in interrupt handlers section
%s/assembler/assembly language/
Signed-off-by: Yu Chien Peter Lin <peterlin.tw@pm.me>
Jim Huang [Fri, 9 Dec 2022 22:21:02 +0000 (06:21 +0800)]
CI: Bump validation host versioning
The CI is now running on Ubuntu 22.04-LTS along with gcc-11 and
clang-format-12 .
Jim Huang [Fri, 9 Dec 2022 22:11:09 +0000 (06:11 +0800)]
CI: Bump dependency versions
Jim Huang [Fri, 9 Dec 2022 22:07:56 +0000 (06:07 +0800)]
Make the naming for GitHub Actions more consistent
Iûnn Kiàn-îng [Thu, 10 Nov 2022 14:24:37 +0000 (22:24 +0800)]
Convey secure boot specific considerations (#177)
Jim Huang [Thu, 3 Nov 2022 17:35:33 +0000 (01:35 +0800)]
Merge pull request #176 from linD026/master
vinput: Fix missing error code
Chih-En Lin [Thu, 3 Nov 2022 17:16:14 +0000 (01:16 +0800)]
vinput: Fix missing error code
Fix the missing error code when register_chrdev() failed.
The report is from Smatch:
Smatch failed: 1 warning(s), 0 error(s)
/home/runner/work/lkmpg/lkmpg/examples/vinput.c:372 vinput_init() warn: missing error code 'err'
Johan Calle [Mon, 24 Oct 2022 13:52:05 +0000 (22:52 +0900)]
Fix typo (line 1019) (#174)
Changed "The choose of two different functions depend on whether ..." to
"The choice between two different functions depends on whether ..."
Jim Huang [Sat, 22 Oct 2022 16:28:11 +0000 (00:28 +0800)]
Merge pull request #124 from tzuyichan/patch
Fix grammar
Jim Huang [Fri, 21 Oct 2022 01:36:47 +0000 (09:36 +0800)]
Fix dead link
Close #173
Kohei Otsuka [Tue, 4 Oct 2022 16:52:07 +0000 (18:52 +0200)]
Fix typo (#169)
Jim Huang [Fri, 23 Sep 2022 05:52:06 +0000 (13:52 +0800)]
Merge pull request #168 from linD026/master
Fix dereference NULL pointer with proc_lseek
Jim Huang [Fri, 23 Sep 2022 05:51:25 +0000 (13:51 +0800)]
Merge pull request #167 from linD026/minmax
Improve the compatibility with kernel < v5.10
linD026 [Wed, 21 Sep 2022 05:55:30 +0000 (13:55 +0800)]
Fix dereference NULL pointer with proc_lseek
Since the operations are static storage duration, the pointer in
operation structures will initialize with NULL. But, the kernel
doesn't check whether the pointer is NULL or not when calling it.
Related Discussion:
- https://github.com/sysprog21/lkmpg/issues/165
- https://github.com/sysprog21/lkmpg/issues/160
Close #165
linD026 [Wed, 21 Sep 2022 05:53:06 +0000 (13:53 +0800)]
Improve the compatibility with kernel < v5.10
min()/max() splited from kernel.h to minmax.h since v5.10-rc1.
Before v5.10, minmax.h doesn't exist [1].
[1] https://github.com/torvalds/linux/commit/
b296a6d53339a79082c1d2c1761e948e8b3def69
Jim Huang [Thu, 8 Sep 2022 14:24:20 +0000 (22:24 +0800)]
Merge pull request #163 from linD026/read-write
procfs{2, 3}: Change to use offset parameter
linD026 [Wed, 7 Sep 2022 22:51:14 +0000 (06:51 +0800)]
procfs{2, 3}: Change to use offset parameter
To make sure the behavior of the read and write operations are correct
with offset, update it each time. Also, since it is using the offset,
modify the part of read for removing unnecessary variable.
Jim Huang [Thu, 8 Sep 2022 04:22:12 +0000 (12:22 +0800)]
Merge pull request #164 from linD026/file-proc_ops
Improve the description of proc in file-ops
Jim Huang [Thu, 8 Sep 2022 04:19:42 +0000 (12:19 +0800)]
Merge pull request #162 from linD026/master
Fix the buffer length may cause a read error
linD026 [Thu, 8 Sep 2022 00:24:47 +0000 (08:24 +0800)]
Improve the description of proc in file-ops
Currently, the description of the proc_ops in the file operation section
will confuse the reader with registering the device. Add more hints to
avoid it.
linD026 [Wed, 7 Sep 2022 21:37:48 +0000 (05:37 +0800)]
Fix the buffer length may cause a read error
Since The length of the message buffer is BUF_LEN. When writing the
BUF_LEN length of the string it will overwrite the last character
(usually it is '\0' from the initialization). And, because the read
operation uses the character in the message buffer ('\0') to stop the
read loop. It will cause the read operation will read out of the
message buffer when the length parameter of read() is not lower than
or equal to BUF_LEN. So add one more byte space to avoid this problem.
Cheng-En Lee [Sat, 27 Aug 2022 02:14:17 +0000 (19:14 -0700)]
Add additional macos installation instruction in README.md (#157)
Signed-off-by: Cheng-En Lee <chengenl@usc.edu>
Jim Huang [Sat, 2 Jul 2022 14:38:06 +0000 (22:38 +0800)]
Merge pull request #156 from linD026/master
Adjust "in the mean time" description of tasklet
Chih-En Lin [Sat, 2 Jul 2022 13:58:50 +0000 (21:58 +0800)]
Adjust "in the mean time" description of tasklet
Since the init function may be interrupted. Tweak the description of
"in the mean time".
Close #152
Jim Huang [Sat, 2 Jul 2022 05:49:15 +0000 (13:49 +0800)]
Merge pull request #155 from linD026/master
Add more information about the CFI of timer API
Chih-En Lin [Fri, 1 Jul 2022 13:09:38 +0000 (21:09 +0800)]
Add more information about the CFI of timer API
Currently, in 13.2 Flashing keyboard LEDs, the description of the
control-flow integrity, "Furthermore, the function prototype with
unsigned long argument may be an obstacle to the control-flow integrity
.", will confuse the reader.
It may lead the reader to think about hardware-assisted CFI like Intel
CET uses the shadow stack attack for ROP (backward-edge protection). But
the description of CFI here talks about the function pointer checking
with the prototype (forward-edge protection).
So add more information to make it more clear.
Close #151
Jim Huang [Sat, 25 Jun 2022 15:39:19 +0000 (23:39 +0800)]
Merge pull request #154 from leovincentseles/master
module_init and module_exit are defined in module.h
leovincentseles [Sat, 25 Jun 2022 15:15:48 +0000 (23:15 +0800)]
module_init and module_exit are defined in module.h
Both module_init and module_exit are defined in
include/linux/module.h
Jim Huang [Thu, 28 Apr 2022 11:19:29 +0000 (19:19 +0800)]
CI: Bump dependency versions
Jim Huang [Mon, 18 Apr 2022 19:22:04 +0000 (03:22 +0800)]
Merge pull request #150 from asas1asas200/zeng-feat-attributes
Add description of sysfs attribute
asas1asas200 [Sun, 17 Apr 2022 14:20:18 +0000 (22:20 +0800)]
Add description of sysfs attribute
The description of the attribute was added in sysfs section and referenced in vinput section.
In vinput section, just described the class_attribute and some macros about sysfs class.
Add file name at vinput-related examples begin.
Jim Huang [Sat, 16 Apr 2022 18:52:15 +0000 (02:52 +0800)]
Merge pull request #149 from linD026/master
Fix potential concurrent problems in chardev2.c
linD026 [Sat, 16 Apr 2022 16:23:49 +0000 (00:23 +0800)]
Fix potential concurrent problems in chardev2.c
After forking, Each file descriptor in the child refers to the same
open file description as the parent. So when calling open() before
fork(), the child can access the device file without checking by
exclusive access in device_open(). It may cause race conditions
in device_ioctl().
Because of that, it is unnecessary to check the multiple access
in device_open(). It just needs check in device_ioctl(), since
read(), write(), seek() system call are atomic [1][2].
Related discussion:
- https://github.com/sysprog21/lkmpg/issues/148
[1] https://lore.kernel.org/lkml/
53022DB1.
4070805@gmail.com/
[2] https://www.kernel.org/doc/html/latest/filesystems/files.html
Close #148
Jim Huang [Sun, 10 Apr 2022 14:59:12 +0000 (22:59 +0800)]
Merge pull request #147 from linD026/master
Fix wrong regular expression of clang-format
linD026 [Sun, 10 Apr 2022 14:51:59 +0000 (22:51 +0800)]
Fix wrong regular expression of clang-format
Jim Huang [Sun, 10 Apr 2022 13:38:52 +0000 (21:38 +0800)]
Merge pull request #146 from linD026/master
Fix typo
linD026 [Sun, 10 Apr 2022 12:31:19 +0000 (20:31 +0800)]
Fix typo
Jim Huang [Fri, 8 Apr 2022 10:15:57 +0000 (18:15 +0800)]
Merge pull request #145 from linD026/master
Introduce Virtual Input Device Driver
linD026 [Tue, 5 Apr 2022 15:51:54 +0000 (23:51 +0800)]
Introduce Virtual Input Device Driver
Add the new section of input device driver, vinput[1].
Also, update the Acknowledgements.
[1] https://github.com/sysprog21/vinput
Jim Huang [Fri, 18 Mar 2022 19:20:41 +0000 (20:20 +0100)]
Merge pull request #144 from henrybear327/improvement/latexmk
Use latexmk instead of pdflatex for PDF generation
Chun-Hung Tseng [Fri, 18 Mar 2022 18:56:25 +0000 (19:56 +0100)]
Update README and Makefile for the latexmk existence check
Signed-off-by: Chun-Hung Tseng <henrybear327@gmail.com>
Jim Huang [Fri, 18 Mar 2022 18:26:43 +0000 (02:26 +0800)]
Tweak the style of sudoers file
Chun-Hung Tseng [Fri, 18 Mar 2022 18:08:26 +0000 (19:08 +0100)]
Update .gitignore files to ignore latexmk tmp files
Signed-off-by: Chun-Hung Tseng <henrybear327@gmail.com>
Chun-Hung Tseng [Fri, 18 Mar 2022 18:02:21 +0000 (19:02 +0100)]
Fix the pdf generation code in Makefile
The current Makefile is missing one more pdflatex pass.
The correct steps are : pdflatex -> bibtex -> pdflatex -> pdflatex [1]. Otherwise, bib items will not be showing properly.
[1] https://github.com/James-Yu/LaTeX-Workshop/wiki/Compile#latex-recipes
Signed-off-by: Chun-Hung Tseng <henrybear327@gmail.com>
Jim Huang [Thu, 17 Mar 2022 00:13:26 +0000 (08:13 +0800)]
Merge pull request #143 from linD026/master
Improve the description of finding syscall table
linD026 [Wed, 16 Mar 2022 15:17:31 +0000 (23:17 +0800)]
Improve the description of finding syscall table
Presently, the representation of showing which version will use the
method to find out the system call table is vague.
Related discussion:
* sysprog21/lkmpg: https://github.com/sysprog21/lkmpg/pull/142
Jim Huang [Wed, 16 Mar 2022 06:32:08 +0000 (14:32 +0800)]
Refine wording on module loading
Close #134
Jim Huang [Wed, 9 Mar 2022 06:23:17 +0000 (14:23 +0800)]
Merge pull request #141 from steven1lung/master
Fix grammar and typo
Steven Lung [Wed, 9 Mar 2022 06:14:08 +0000 (14:14 +0800)]
Fix grammar
Jim Huang [Mon, 7 Mar 2022 09:11:05 +0000 (17:11 +0800)]
Merge pull request #140 from steven1lung/master
Fix typo, grammar and remove duplicated words
Steven Lung [Mon, 7 Mar 2022 08:56:13 +0000 (16:56 +0800)]
Fix typo, grammar and remove duplicated words
Replaced 'a' with 'an' since a vowel sound is after.
Bob Lee [Sun, 20 Feb 2022 16:58:47 +0000 (00:58 +0800)]
Fix a logic error in examples/ioctl.c (#137)
Change the "alloc_ret" and "cdev_ret" initial values to non-zero.
According to the source code, "alloc_chrdev_region" and "cdev_add"
return zero on success, and negative code on failure.
So, if the "alloc_chrdev_region" failed, the if condition becomes true,
then we will jump to the label "error" by goto, checking each return
value whether is a success state from both functions mentioned above
and dealing with it properly for exiting the process.
However, it checks the success state by comparing the return value
with zero (means success), and we got "cdev_ret == 0" is true from
the initial value zero, while we didn't execute "cdev_add" yet.
Hence, there was a logic error when the initial value is zero.
Co-authored-by: NOVBobLee <defru04002@gamil.com>
linD026 [Sun, 20 Feb 2022 16:53:29 +0000 (00:53 +0800)]
Fix incoherent ioctl examples (#139)
Previously ioctl.c is a userspace program for chardev2.c and chardev.h [1].
But now, this file is an independent kernel module, and the original code
disappear.
This patch adds back the original userspace code and renames it to
userspace_ioctl.c.
[1] https://tldp.org/LDP/lkmpg/2.4/html/x856.html
Ching-Hua (Vivian) Lin [Sun, 9 Jan 2022 12:26:07 +0000 (20:26 +0800)]
Add book cover (#136)
Both PDF and HTML generation are supported.
萌新阿岩 [Tue, 28 Dec 2021 12:45:50 +0000 (20:45 +0800)]
Update Makefile and Add explanation (#133)
Add `PWD := $(CURDIR)` in Makefile and the explanation about `sudo make`
when only having `PWD`.
Jim Huang [Sat, 25 Dec 2021 06:48:13 +0000 (14:48 +0800)]
Merge pull request #135 from RinHizakura/master
Revise chardev registration
RinHizakura [Tue, 21 Dec 2021 16:06:05 +0000 (00:06 +0800)]
Introduce the new method for chardev registration
Instead of using the old register_chrdev / unregister_chrdev API,
cdev interface which is newer and would be better for new driver programmers
in most cases. This commit is trying to give the brief overview for
this different interface.
Jim Huang [Sat, 4 Dec 2021 16:13:22 +0000 (16:13 +0000)]
modinfo does not require superuser permission
Jim Huang [Tue, 16 Nov 2021 08:01:56 +0000 (16:01 +0800)]
Merge pull request #130 from lyctw/master
Fix typo
lyctw [Tue, 16 Nov 2021 06:50:01 +0000 (14:50 +0800)]
Fix typo
Jim Huang [Mon, 8 Nov 2021 14:30:20 +0000 (22:30 +0800)]
Merge pull request #128 from sudoliyang/patch-2
Fix typo
Jim Huang [Mon, 8 Nov 2021 14:14:16 +0000 (22:14 +0800)]
Merge pull request #127 from sudoliyang/patch-1
Fix typo
Liyang Zhang [Mon, 8 Nov 2021 14:10:21 +0000 (22:10 +0800)]
Fix typo
Liyang Zhang [Mon, 8 Nov 2021 14:07:08 +0000 (22:07 +0800)]
Fix typo
Jim Huang [Mon, 8 Nov 2021 04:07:57 +0000 (12:07 +0800)]
Merge pull request #123 from fennecJ/patch
Generate contributor list as a modular inclusion
manbing [Mon, 8 Nov 2021 04:06:19 +0000 (12:06 +0800)]
Adjust the position of Figure 1 (#126)
fennecJ [Wed, 3 Nov 2021 11:32:48 +0000 (19:32 +0800)]
Add script to gen contributor list and contrib.tex
This script do mainly 2 things:
1.
Generate file `Contributors` with git log in following format:
Contributor's name,<1-st e-mail>[,<2nd e-mail>][,<3rd e-mail>]...
The 2-nd email and so on are based on file `.mailmap` in the root
directory of the repo.
Note that it will also append contributors in File `Include`; and
will NOT append contributors in File `Exclude`.
If there are new contributors, script will sort `Contributor` after
append new contributors into each file; Otherwise it do nothing.
2.
Generate contrib.tex based on `Contributors` into lib/contrib.tex in
following format:
[name], (reasonable width) % [1-st e-mail]
Which is inspired by The Not So Short Introduction to Latex 2e[1]
We need to maintain `.mailmap`, `Exclude` and `Include` manually.
All Chinese name should be converted into English/Pinyin in `.mailmap`,
otherwise we may need extra pkg for latex to parse Chinese characters.
[1] - https://tobi.oetiker.ch/lshort/lshort.pdf
Close #68