Commit Graph

423 Commits

Author SHA1 Message Date
b0c7a463f7 [优化]优化说明文档 2024-09-05 12:55:06 +08:00
ffe2d62bef [优化]添加新翻译第零章 2024-09-05 12:53:35 +08:00
88db7fbc28 使用md格式重写翻译 2024-09-03 14:48:19 +08:00
b8430a39b5 [更新] 添加md格式文档 2024-08-13 09:24:26 +08:00
c23e68ba24 [更新] 修复pdf生成 2024-08-12 18:02:09 +08:00
2155f68a8d [汉化] 翻译第6章节 2024-08-05 17:31:33 +08:00
b03a709553 [汉化] 翻译1-5章节 2024-08-02 18:05:24 +08:00
7ef351b791 [汉化] 汉化项目说明 2024-07-30 09:56:28 +08:00
Andrew Lin
84cc7fee1c
Fix typo (#265)
Some checks failed
build-deploy-assets / build (push) Has been cancelled
deploy-github-page / build (push) Has been cancelled
status-checks / validate (push) Has been cancelled
Change return-object programming to return-oriented programming.
2024-07-22 01:56:37 +08:00
Hao.Dong
950408472e
Add a hook on syscall using Kprobes under x86 (#260)
For x86 architecture, the system call table cannot be used to invoke
a system call after commit 1e3ad78 since v6.9. This commit has been
backported to long term stable kernels, like v5.15.154+, v6.1.85+,
v6.6.26+ and v6.8.5+[1]. In this case, thanks to Kprobes, a hook can be
used instead on the system call entry to intercept the system call.

[1] https://stackoverflow.com/a/78607015

Co-authored-by: Hao Dong <hao.dong.work@outlook.com>
2024-07-05 07:40:53 +08:00
Jim Huang
032d1b8c0c
Merge pull request #264 from jouae/master
Fix a typo
2024-07-04 02:12:50 +08:00
jouae
74a450ba92
Fix a typo
Delete the duplicate word "otherwise"

Before and after:
otherwise, otherwise -> otherwise
2024-07-03 18:46:45 +08:00
Jim Huang
7bcc4fbf46
Merge pull request #263 from pao0626/command-permission-changes
Add sudo for file access permissions
2024-07-03 17:04:14 +08:00
HJ Pao
be16ad6710 Add sudo for file access permissions
Add sudo to commands in Chapter 8 for example module interaction.

The "myvariables" in the module are set with 0660 permissions
via __ATTR(), preventing direct user access.

Options to fix this:
1. Instruct users to use 'sudo' to read/write files.
2. Relax the permission settings to 0666.

This commit adopts the sudo method to maintain security constraints.
2024-07-03 16:31:53 +08:00
Jim Huang
031b9d2b39
Merge pull request #262 from jouae/master
Modify the descritions of seq_file and flowchart
2024-07-03 00:04:38 +08:00
jouae
7a6dd1f582
Modify the descritions of seq_file and flowchart
7.4 The seq_file is missing the behavior that occurs when it
directly returns NULL after the start step.

Also, in the flowchart, the first decision where `return is NULL`
is `Yes` points to nothing, which is not defined in ISO 5807.

ISO 5807 section 10.3.1.2 states logic path of a decision,
"Each exit from a symbol be accompanied by the appropriate
condition values to show the logic path which it represents,
so that the conditions and the associated references are identified."

The behavior of pointing to nothing does not have associated
references and does not indicate the relation of this logic path.

Refs:
	1. The Liunx Kernel Module Programming Guide
	   7.4 Manage /proc file with seq_file
	2. ISO-5807-1985
2024-07-02 23:47:43 +08:00
Jim Huang
1d3943a72b CI: Enforce newline at end of files
Reference:
https://medium.com/@alexey.inkin/how-to-force-newline-at-end-of-files-and-why-you-should-do-it-fdf76d1d090e
2024-06-21 16:39:05 +08:00
Jim Huang
b5709f89f8 Update contributor list 2024-05-26 01:49:53 +08:00
Jim Huang
e1eced6d2f
Merge pull request #258 from visitorckw/fix-vinput
vinput: Fix multiple issue
2024-05-15 05:54:44 +08:00
Kuan-Wei Chiu
0a23ecd027 vinput: Fix incorrect handling on raw_copy_to_user() failure
When raw_copy_to_user() failed in vinput_read(), the function would set
'count' to -EFAULT and then subtract EFAULT from '*offset'. However,
modifying '*offset' on raw_copy_to_user() failure was incorrect. Fix
this behavior by changing count = -EFAULT to return -EFAULT.
2024-05-09 02:01:18 +08:00
Kuan-Wei Chiu
c068fa47e9 vinput: Fix NULL pointer dereference caused by failed kzalloc allocation
When kzalloc fails to allocate memory and returns NULL, it leads to a
NULL pointer dereference error later on. Add a check for the return
value of kzalloc. When kzalloc fails to allocate memory, it prints an
error message and returns ERR_PTR(-ENOMEM).
2024-05-09 02:01:14 +08:00
Kuan-Wei Chiu
1e26743c30 vinput: Remove redundant memset call
Remove redundant memset calls as memory allocated with kzalloc is
already zeroed due to the presence of the __GFP_ZERO gfp flag.
2024-05-09 01:38:14 +08:00
cvvletter
0a27a0140f
Fix typo (#257) 2024-05-05 19:19:43 +08:00
Jim Huang
0d434088f1
Merge pull request #256 from yeh-sudo/improve-readability
Improve readibility
2024-04-25 15:27:40 +08:00
yeh-sudo
617a1d4d52 Improve readibility
Add \cpp before |main()| to improve readibility so that it won't look
like "|main()|" in the paragraph.
2024-04-25 14:49:43 +08:00
Jim Huang
eacb844ad5 Update contributor list 2024-04-21 01:38:20 +08:00
Jim Huang
9952f38afb Fix style 2024-04-21 01:12:33 +08:00
Yo-Jung Lin
86b5e86e5b Refine description in request_threaded_irq usage 2024-04-21 01:09:32 +08:00
Yo-Jung Lin
0c3aaac3c1 Pass proper cookies to the request_threaded_irq
The last parameter of request_threaded_irq must be a globally unique
cookie[1]. Usually this would be the device struct received by probe().
Since we are not using driver model, pass the gpio structs instead.

[1] https://docs.kernel.org/core-api/genericirq.html
2024-04-21 01:09:32 +08:00
Yo-Jung Lin
65397e2d53 Correct the IRQ numbers passed to the request_threaded_irq 2024-04-21 01:09:32 +08:00
Yo-Jung Lin
8cd1c6a322 Refine wordings 2024-04-21 01:09:32 +08:00
Jim Huang
56f566abe6 Provide a tasklet-free example
Co-authored-by: Bob Mottram <bob@freedombone.net>
2024-04-21 01:09:28 +08:00
0xff07
3e472c84fd
Describe atomic context in spinlock section (#254)
Aquiring a spinlock makes the holder enter atomic context. Extra
attention is needed in atomic context. In particular, functions
that may sleep must not be used. Add this detail to the spinlock
section.
2024-04-16 21:25:46 +08:00
Jim Huang
e1b44579b0 Ensure Linux v6.5 compatibility 2024-04-16 06:24:06 +08:00
Jim Huang
1c31bac22c Fix Linux v6.5 compatibility 2024-04-16 06:19:52 +08:00
Jim Huang
f5893d8140 Remove the crypto section due to poor maintenance
The past content in the crypto section lacks informative descriptions,
and there should be a proper procedure to demonstrate how Linux
cryptography works. Due to poor maintenance, let's drop the section.
2024-04-16 05:39:11 +08:00
Jim Huang
1d38d2ed19
Merge pull request #253 from weihsinyeh/master
Fix typo
2024-04-16 04:58:32 +08:00
Jim Huang
d92fcd1ce4
Merge pull request #248 from vax-r/Fix_typos
Fix typo
2024-04-16 04:58:07 +08:00
weihsinyeh
f52c126c43 Fix typo
Correct `parameters name` to `parameter's name` in a comment.
2024-04-16 02:38:07 +08:00
weihsinyeh
6640ccdc0f
Fix unmatched quotation (#251) 2024-04-13 13:37:28 +08:00
Jim Huang
cb41da7c27
Merge pull request #250 from 0xff07/up-to-date-irq-flags
Replace SA_xxx IRQ flags with the IRQF_xxx ones
2024-04-09 20:00:49 +08:00
Yo-Jung Lin
b9a10fe17b Replace SA_xxx IRQ flags with the IRQF_xxx ones
The SA_xxx flags has been removed for years. Nowadays the kernel uses
the IRQF_xxx flags to specify IRQ behaviors. Adjust the descriptions
in the book accordingly.
2024-04-09 19:39:18 +08:00
vax-r
a700043862 Fix typo
Correct "dynamicly" to "dynamically" and correct "initialised" to
"initialized".
2024-02-01 15:09:23 +08:00
毛毛
470fbcd97d
Fix switch-case condition error in sample code (#245)
The code 'case -EINPROGRESS || -EBUSY: ' is the same as
'case -115 || -16 :' at compiler time, as both error code are
implemented with macro like '#define EBUSY 16'.

The code above is essentially the same as 'case 1:'. In C, there is no
real boolean value. Boolean-like value will be converted to 1 or 0.

It does not matter too much if the '-EINPROGRESS || -EBUSY' is
calculated at build time or at runtime. In both case, it will compare
the 'rc' with 1 in the switch expression. It will not compare the
'rc' with any real error code number. When the code is really '-EBUSY',
the execution will fallback to the default branch.

And in practice, most of the compilers will do this simple compile-time
static calculation, and generate code like

static int test_skcipher_result(struct skcipher_def *sk, int rc)
{
    switch (rc) {
    case 0:
        break;
    case 1:
        rc = wait_for_completion_interruptible(&sk->result.completion);
/* code removed for conciseness */
        break;
    default:
        pr_info("skcipher encrypt returned with %d result %d\n", rc,
                sk->result.err);
        break;
    }
    init_completion(&sk->result.completion);
    return rc;
}
2024-01-03 22:13:26 +08:00
Jim Huang
391f111d8a Update contributor list 2024-01-03 22:05:56 +08:00
Jim Huang
a3f5e3b931
Merge pull request #246 from mechanicalamit/egrep_to_grep_E
Change occurrences of egrep to grep -E
2024-01-03 21:59:46 +08:00
Amit Dhingra
e19b1850e1 Change occurrences of egrep to grep -E
A lot of distributions are emitting warnings when using egrep and fgrep
since these are deprecated.

Update occurrences of egrep to 'grep -E' keeping the same functionality
and making the code more portable without emitting warnings.
2024-01-03 13:07:52 +00:00
Jim Huang
15f9a4999b Proofread 2023-12-22 21:22:32 +08:00
Jim Huang
e631ad9267 Proofread 2023-12-22 21:02:18 +08:00
Jim Huang
80e400b8d2 syscall-steal: Refine comment 2023-12-22 20:53:21 +08:00