summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorGeorg Veichtlbauer <georg@vware.at>2023-05-05 22:54:31 +0200
committerDavide Garberi <dade.garberi@gmail.com>2023-05-22 19:29:39 +0200
commit7ef1b1f38a94bf54b215c4c56ea8d62ec607f73b (patch)
tree5ccd47727a21e268b014a44ce64d575ddbc03d5f /fs
parentb4790673989b7d98dfeebf7f544104c4a0efd7b7 (diff)
Revert "kernel: Only expose su when daemon is running"lineage-19.1
This patch is no longer necessary because we no longer ship su add-ons, which is this patch initially designed for. Now it causes another issue which breaks custom root solution such as Magisk, as Magisk switches worker tmpfs dir to RO instead of RW for safety reasons and happens to satisfy MS_RDONLY check for su file, resulting in su file totally inaccessible. This reverts commit 08ff8a2e58eb226015fa68d577121137a7e0953f. Change-Id: If25a9ef7e64c79412948f4619e08faaedb18aa13
Diffstat (limited to 'fs')
-rw-r--r--fs/exec.c5
-rw-r--r--fs/namei.c10
-rw-r--r--fs/readdir.c15
3 files changed, 0 insertions, 30 deletions
diff --git a/fs/exec.c b/fs/exec.c
index ebf8c18f6d56..341b872d758f 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1640,11 +1640,6 @@ static int do_execveat_common(int fd, struct filename *filename,
if (retval < 0)
goto out;
- if (d_is_su(file->f_path.dentry) && capable(CAP_SYS_ADMIN)) {
- current->flags |= PF_SU;
- su_exec();
- }
-
/* execve succeeded */
current->fs->in_exec = 0;
current->in_execve = 0;
diff --git a/fs/namei.c b/fs/namei.c
index e1d54d342ad5..8f350e39be96 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2292,16 +2292,6 @@ static int path_lookupat(struct nameidata *nd, unsigned flags, struct path *path
err = -ENOTDIR;
if (!err) {
- struct super_block *sb = nd->inode->i_sb;
- if (sb->s_flags & MS_RDONLY) {
- if (d_is_su(nd->path.dentry) && !su_visible()) {
- path_put(&nd->path);
- err = -ENOENT;
- }
- }
- }
-
- if (!err) {
*path = nd->path;
nd->path.mnt = NULL;
nd->path.dentry = NULL;
diff --git a/fs/readdir.c b/fs/readdir.c
index 27807505fc4a..3494d7a8ff65 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -39,7 +39,6 @@ int iterate_dir(struct file *file, struct dir_context *ctx)
res = -ENOENT;
if (!IS_DEADDIR(inode)) {
ctx->pos = file->f_pos;
- ctx->romnt = (inode->i_sb->s_flags & MS_RDONLY);
res = file->f_op->iterate(file, ctx);
file->f_pos = ctx->pos;
fsnotify_access(file);
@@ -51,14 +50,6 @@ out:
}
EXPORT_SYMBOL(iterate_dir);
-static bool hide_name(const char *name, int namlen)
-{
- if (namlen == 2 && !memcmp(name, "su", 2))
- if (!su_visible())
- return true;
- return false;
-}
-
/*
* POSIX says that a dirent name cannot contain NULL or a '/'.
*
@@ -132,8 +123,6 @@ static int fillonedir(struct dir_context *ctx, const char *name, int namlen,
buf->result = -EOVERFLOW;
return -EOVERFLOW;
}
- if (hide_name(name, namlen) && buf->ctx.romnt)
- return 0;
buf->result++;
dirent = buf->dirent;
if (!access_ok(VERIFY_WRITE, dirent,
@@ -215,8 +204,6 @@ static int filldir(struct dir_context *ctx, const char *name, int namlen,
buf->error = -EOVERFLOW;
return -EOVERFLOW;
}
- if (hide_name(name, namlen) && buf->ctx.romnt)
- return 0;
dirent = buf->previous;
if (dirent) {
if (__put_user(offset, &dirent->d_off))
@@ -299,8 +286,6 @@ static int filldir64(struct dir_context *ctx, const char *name, int namlen,
buf->error = -EINVAL; /* only used if we fail.. */
if (reclen > buf->count)
return -EINVAL;
- if (hide_name(name, namlen) && buf->ctx.romnt)
- return 0;
dirent = buf->previous;
if (dirent) {
if (__put_user(offset, &dirent->d_off))