Commit Graph

297 Commits

Author SHA1 Message Date
Andy Shevchenko
b8bbcd8a07 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>
2023-02-23 12:54:30 +02:00
Andy Shevchenko
e62dff0df4 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>
2023-02-23 12:54:30 +02:00
Andy Shevchenko
e07bf16bfd 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>
2023-02-21 23:04:41 +02:00
Jim Huang
53f4b4c640
Merge pull request #184 from linD026/master
syscall: Use openat() instead of open()
2022-12-25 20:24:10 +08:00
linD026
78e3e062c4 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
2022-12-25 14:27:03 +08:00
Jim Huang
2f5fd9a75d
Merge pull request #183 from linD026/master
example/syscall: Fix typo and unmatch types
2022-12-25 12:50:15 +08:00
linD026
6062f64bcf example/syscall: Fix typo and unmatch types 2022-12-25 12:33:52 +08:00
Jim Huang
0decb83073
Merge pull request #182 from lyctw/master
Add error message when sha256 algorithm is not supported
2022-12-13 01:11:45 +08:00
Peter Lin
3133ee5293 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>
2022-12-12 23:07:20 +08:00
Jim Huang
d249317c87
Merge pull request #181 from lyctw/master
Fix typo in interrupt handlers section
2022-12-11 16:49:44 +08:00
Peter Lin
55e7a155fa Fix typo in interrupt handlers section
%s/assembler/assembly language/

Signed-off-by: Yu Chien Peter Lin <peterlin.tw@pm.me>
2022-12-11 14:46:08 +08:00
Jim Huang
1c916a79a9 CI: Bump validation host versioning
The CI is now running on Ubuntu 22.04-LTS along with gcc-11 and
clang-format-12 .
2022-12-10 06:21:02 +08:00
Jim Huang
c6b59d2a8f CI: Bump dependency versions 2022-12-10 06:11:09 +08:00
Jim Huang
0fe984fd04 Make the naming for GitHub Actions more consistent 2022-12-10 06:07:56 +08:00
Iûnn Kiàn-îng
9c25e59b43
Convey secure boot specific considerations (#177) 2022-11-10 22:24:37 +08:00
Jim Huang
910715dab6
Merge pull request #176 from linD026/master
vinput: Fix missing error code
2022-11-04 01:35:33 +08:00
Chih-En Lin
d81d968b0e 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'
2022-11-04 01:16:14 +08:00
Johan Calle
9892214764
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 ..."
2022-10-24 21:52:05 +08:00
Jim Huang
b950a100f6
Merge pull request #124 from tzuyichan/patch
Fix grammar
2022-10-23 00:28:11 +08:00
Jim Huang
d2ddcccce3 Fix dead link
Close #173
2022-10-21 09:36:47 +08:00
Kohei Otsuka
7b38f3713a
Fix typo (#169) 2022-10-05 00:52:07 +08:00
Jim Huang
760df73743
Merge pull request #168 from linD026/master
Fix dereference NULL pointer with proc_lseek
2022-09-23 13:52:06 +08:00
Jim Huang
422f387ae3
Merge pull request #167 from linD026/minmax
Improve the compatibility with kernel < v5.10
2022-09-23 13:51:25 +08:00
linD026
0f9c72631c 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
2022-09-21 16:57:23 +08:00
linD026
eb2c766da4 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] b296a6d533
2022-09-21 13:53:06 +08:00
Jim Huang
c69eff9d1f
Merge pull request #163 from linD026/read-write
procfs{2, 3}: Change to use offset parameter
2022-09-08 22:24:20 +08:00
linD026
39a313dc20 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.
2022-09-08 12:53:29 +08:00
Jim Huang
53c2794fdb
Merge pull request #164 from linD026/file-proc_ops
Improve the description of proc in file-ops
2022-09-08 12:22:12 +08:00
Jim Huang
d79fdc8559
Merge pull request #162 from linD026/master
Fix the buffer length may cause a read error
2022-09-08 12:19:42 +08:00
linD026
9db8c92cf5 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.
2022-09-08 08:34:06 +08:00
linD026
95a7ca513f 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.
2022-09-08 06:08:04 +08:00
Cheng-En Lee
637e707a1a
Add additional macos installation instruction in README.md (#157)
Signed-off-by: Cheng-En Lee <chengenl@usc.edu>
2022-08-27 10:14:17 +08:00
Jim Huang
cd2ba2447d
Merge pull request #156 from linD026/master
Adjust "in the mean time" description of tasklet
2022-07-02 22:38:06 +08:00
Chih-En Lin
87bd9ceb34 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
2022-07-02 22:31:48 +08:00
Jim Huang
2a2cfb5188
Merge pull request #155 from linD026/master
Add more information about the CFI of timer API
2022-07-02 13:49:15 +08:00
Chih-En Lin
3d1fb29070 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
2022-07-01 21:31:08 +08:00
Jim Huang
08eee1abf1
Merge pull request #154 from leovincentseles/master
module_init and module_exit are defined in module.h
2022-06-25 23:39:19 +08:00
leovincentseles
22ebabe297 module_init and module_exit are defined in module.h
Both module_init and module_exit are defined in
include/linux/module.h
2022-06-25 23:15:48 +08:00
Jim Huang
63ac35dd4f CI: Bump dependency versions 2022-04-28 19:19:29 +08:00
Jim Huang
96e522cb36
Merge pull request #150 from asas1asas200/zeng-feat-attributes
Add description of sysfs attribute
2022-04-19 03:22:04 +08:00
asas1asas200
04465b1a44 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.
2022-04-19 01:54:24 +08:00
Jim Huang
565a599342
Merge pull request #149 from linD026/master
Fix potential concurrent problems in chardev2.c
2022-04-17 02:52:15 +08:00
linD026
beb1ff1595 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
2022-04-17 02:41:25 +08:00
Jim Huang
aa4b5d7421
Merge pull request #147 from linD026/master
Fix wrong regular expression of clang-format
2022-04-10 22:59:12 +08:00
linD026
9f92fe4d6a Fix wrong regular expression of clang-format 2022-04-10 22:51:59 +08:00
Jim Huang
afc4f6bf56
Merge pull request #146 from linD026/master
Fix typo
2022-04-10 21:38:52 +08:00
linD026
6e7eda6398 Fix typo 2022-04-10 20:31:19 +08:00
Jim Huang
3beae490ee
Merge pull request #145 from linD026/master
Introduce Virtual Input Device Driver
2022-04-08 18:15:57 +08:00
linD026
636c1e702d 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
2022-04-06 17:13:29 +08:00
Jim Huang
413c7d54cd
Merge pull request #144 from henrybear327/improvement/latexmk
Use latexmk instead of pdflatex for PDF generation
2022-03-18 20:20:41 +01:00