website: document the replacement of do_faccessat for some non-GKI (#206)
Signed-off-by: Ookiineko <chiisaineko@protonmail.com>
This commit is contained in:
@@ -169,4 +169,31 @@ index 068fdbcc9e26..5348b7bb9db2 100644
|
||||
goto out;
|
||||
```
|
||||
|
||||
对于早于 4.17 的内核,如果没有 `do_faccessat`,可以直接找到 `faccessat` 系统调用的定义然后修改:
|
||||
|
||||
```diff
|
||||
diff --git a/fs/open.c b/fs/open.c
|
||||
index 2ff887661237..e758d7db7663 100644
|
||||
--- a/fs/open.c
|
||||
+++ b/fs/open.c
|
||||
@@ -355,6 +355,9 @@ SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)
|
||||
return error;
|
||||
}
|
||||
|
||||
+extern int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,
|
||||
+ int *flags);
|
||||
+
|
||||
/*
|
||||
* access() needs to use the real uid/gid, not the effective uid/gid.
|
||||
* We do this by temporarily clearing all FS-related capabilities and
|
||||
@@ -370,6 +373,8 @@ SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)
|
||||
int res;
|
||||
unsigned int lookup_flags = LOOKUP_FOLLOW;
|
||||
|
||||
+ ksu_handle_faccessat(&dfd, &filename, &mode, NULL);
|
||||
+
|
||||
if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
|
||||
return -EINVAL;
|
||||
```
|
||||
|
||||
改完之后重新编译内核即可。
|
||||
|
||||
Reference in New Issue
Block a user