-
-
Notifications
You must be signed in to change notification settings - Fork 3k
kernel: expose umount list to ioctl interface #2950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
811cbd1 to
2250b26
Compare
|
one command for each? or add another struct member? in response to ee42d6f#comments |
This idea is borrowed from simonpink's susfs4ksu. What we see here is that, yeah well, lets just have userspace send us what it wants unmounted, this is better than hardcoding everything. This also solves that issue on upstream where MNT_DETACH fails, as long as we send unmountables in proper order. A small anti-duplicate mechanism is also added. While in-kernel umount is a bit worse than zygisk-provider-based ones, this can still serve as a healthy alternative. Signed-off-by: backslashxx <[email protected]>
2250b26 to
501459f
Compare
|
I prefer to add another member in struct |
|
Maybe we can pass the flags to umount too. |
|
how about something like this? https://godbolt.org/z/xPe6WKscM come to think of it, we can use smaller width for mount flags and then just cast it. |
38e5555 to
92b56db
Compare
|
First, use |
|
Haven't check the code, does kernel do umount in reversed order of mount is informed? |
reference for others: backslashxx/mountify@483ddc6
order is kept, last in is first to unmount. I also recommend a way for users maybe to control iso service umount, maybe thats for you @aviraxp |
This idea is borrowed from simonpunk's susfs4ksu. What we see here is that, yeah well, lets just have userspace send us what it wants unmounted, this is better than hardcoding everything. This also solves that issue where MNT_DETACH fails, as long as we send unmountables in proper order. A small anti-duplicate mechanism is also added. While in-kernel umount is a bit worse than zygisk-provider-based ones, this can still serve as a healthy alternative. --------- Signed-off-by: backslashxx <[email protected]> Co-authored-by: weishu <[email protected]> Signed-off-by: fc5b87cf <[email protected]>
This idea is borrowed from simonpunk's susfs4ksu. What we see here is that, yeah well, lets just have userspace send us what it wants unmounted, this is better than hardcoding everything. This also solves that issue where MNT_DETACH fails, as long as we send unmountables in proper order. A small anti-duplicate mechanism is also added. While in-kernel umount is a bit worse than zygisk-provider-based ones, this can still serve as a healthy alternative. --------- - Remove duplicate checks Signed-off-by: backslashxx <[email protected]> Co-authored-by: weishu <[email protected]> Co-authored-by: ShirkNeko <[email protected]>
|
As kernel uses path_umount, it only takes path as argument. Take following scernio into consideration:
This way system is broken. I have thought of managing mounts and force disable kernel umount if zygisk is enabled, but that may not fit everyone's need. Ideal way is to use fs type and source to identify mounts. |
disable kernel umount and flag that you provide the feature via managedFeature. without this yeah double umount can happen, but this decision is left to metamodule and zygisk providers otherwise we can include another flag and restore check_mnt for overlayfs but its just more stuff to track. the list by default is also empty. this becomes a userspace problem if somebody really added something on the list. proper priorities are also kept KernelSU/kernel/kernel_umount.c Lines 103 to 111 in 88fe949
|
|
What if user want to use kernel umount and not zygisk's umount? I think managedFeatures should be dynamic. |
|
yeah, I guess this is an issue. so for example on ZN the real reason on why I removed that check_mnt there is to free it up of overlayfs, so other mountypes/filesystems can also be unmounted (magic mount metamodule, customized overlayfs etc etc) so yeah 🤔 |
What if the |
|
we can strcmp path->mnt->mnt_sb->s_type and path->mnt->mnt_devname so two more char * ? if user sends 0 on both we don't check, keeping old behavior but if user sends overlayfs and KSU, it will have to be strcmp'd. migth be easier to just use devname. -- if arg3 == 4 on try_umount, check for devname this might be easier then static void try_umount(const char *mnt, int flags, int mode)
{
struct path path;
int err = kern_path(mnt, 0, &path);
if (err) {
return;
}
if (path.dentry != path.mnt->mnt_root) {
// it is not root mountpoint, maybe umounted by others already.
path_put(&path);
return;
}
if (mode == 3 && !!strcmp(path.mnt->mnt_devname, "KSU") {
path_put(&path);
return;
}
ksu_umount_mnt(&path, flags);
}a bit hacky but atleast we avoid re-struct |
|
EDIT: cleaned up a little but I'm not sure if this is usable on LKM but when adding as "mode 3" it will check for KSU devname first
I'm also not sure on real_mount |
|
This will likely break build for ddk |
|
it does build, but you have to confirm if it works |
|
Actually that should be fine. Gki devices doesn't really enable randomized layout. |
so for bind mounts, a metamodule has to use cmd.mode 1. on magic mount folders where you create new files for should be devname'd KSU and added via mode 3 |
|
@aviraxp so is everything working ok? |
This idea is borrowed from simonpunk's susfs4ksu. What we see here is that, yeah well, lets just have userspace send us what it wants unmounted, this is better than hardcoding everything. This also solves that issue where MNT_DETACH fails, as long as we send unmountables in proper order. A small anti-duplicate mechanism is also added. While in-kernel umount is a bit worse than zygisk-provider-based ones, this can still serve as a healthy alternative. --------- - Remove duplicate checks Signed-off-by: backslashxx <[email protected]> Co-authored-by: weishu <[email protected]> Co-authored-by: ShirkNeko <[email protected]>
This idea is borrowed from simonpunk's susfs4ksu. What we see here is that, yeah well, lets just have userspace send us what it wants unmounted, this is better than hardcoding everything. This also solves that issue where MNT_DETACH fails, as long as we send unmountables in proper order. A small anti-duplicate mechanism is also added. While in-kernel umount is a bit worse than zygisk-provider-based ones, this can still serve as a healthy alternative. --------- - Remove duplicate checks Signed-off-by: backslashxx <[email protected]> Co-authored-by: weishu <[email protected]> Co-authored-by: ShirkNeko <[email protected]>
this way userspace can pull up kernel's umount list and deduce by itself. this is a bit of a pointerwalking mess but this allows us to 1. avoid a kmalloc kernel side 2. avoid potential crashes kernel side 3. maintain api backwards compatibility 4. userspace can deduce that the feature is there (get list size first) 5. userspace can get the list of entries this can also help denylist handlers to deduce stuff and for advanced users to do shit. This should help on concerns brought up by tiann#2950 (comment) Signed-off-by: backslashxx <[email protected]>
this way userspace can pull up kernel's umount list and deduce by itself. this is a bit of a pointerwalking mess but this allows us to 1. avoid a kmalloc kernel side 2. avoid potential crashes kernel side 3. maintain api backwards compatibility 4. userspace can deduce that the feature is there (get list size first) 5. userspace can get the list of entries this can also help denylist handlers to deduce stuff and for advanced users to do shit. This should help on concerns brought up by tiann#2950 (comment) Signed-off-by: backslashxx <[email protected]>
this way userspace can pull up kernel's umount list and deduce by itself. this is a bit of a pointerwalking mess but this allows us to 1. avoid a kmalloc kernel side 2. avoid potential crashes kernel side 3. maintain api backwards compatibility 4. userspace can deduce that the feature is there (get list size first) 5. userspace can get the list of entries this can also help denylist handlers to deduce stuff and for advanced users to do shit. This should help on concerns brought up by tiann#2950 (comment) Signed-off-by: backslashxx <[email protected]> Signed-off-by: rsuntk <[email protected]>
this way userspace can pull up kernel's umount list and deduce by itself. this is a bit of a pointerwalking mess but this allows us to 1. avoid a kmalloc kernel side 2. avoid potential crashes kernel side 3. maintain api backwards compatibility 4. userspace can deduce that the feature is there (get list size first) 5. userspace can get the list of entries this can also help denylist handlers to deduce stuff and for advanced users to do shit. This should help on concerns brought up by tiann#2950 (comment) [ rsuntk: Expose kernel_umount variable ] Signed-off-by: backslashxx <[email protected]> Signed-off-by: rsuntk <[email protected]>
this way userspace can pull up kernel's umount list and deduce by itself. this is a bit of a pointerwalking mess but this allows us to 1. avoid a kmalloc kernel side 2. avoid potential crashes kernel side 3. maintain api backwards compatibility 4. userspace can deduce that the feature is there (get list size first) 5. userspace can get the list of entries this can also help denylist handlers to deduce stuff and for advanced users to do shit. This should help on concerns brought up by tiann#2950 (comment) [ rsuntk: Expose kernel_umount variable ] Signed-off-by: backslashxx <[email protected]> Signed-off-by: rsuntk <[email protected]>
this way userspace can pull up kernel's umount list and deduce by itself. this is a bit of a pointerwalking mess but this allows us to 1. avoid a kmalloc kernel side 2. avoid potential crashes kernel side 3. maintain api backwards compatibility 4. userspace can deduce that the feature is there (get list size first) 5. userspace can get the list of entries this can also help denylist handlers to deduce stuff and for advanced users to do shit. This should help on concerns brought up by tiann#2950 (comment) [ rsuntk: Expose kernel_umount variable ] Signed-off-by: backslashxx <[email protected]> Signed-off-by: rsuntk <[email protected]>
This idea is borrowed from simonpunk's susfs4ksu. What we see here is that, yeah well, lets just have userspace send us what it wants unmounted, this is better than hardcoding everything. This also solves that issue where MNT_DETACH fails, as long as we send unmountables in proper order. A small anti-duplicate mechanism is also added. While in-kernel umount is a bit worse than zygisk-provider-based ones, this can still serve as a healthy alternative. --------- Signed-off-by: backslashxx <[email protected]> Co-authored-by: weishu <[email protected]>
This idea is borrowed from simonpunk's susfs4ksu. What we see here is that, yeah well, lets just have userspace send us what it wants unmounted, this is better than hardcoding everything. This also solves that issue where MNT_DETACH fails, as long as we send unmountables in proper order. A small anti-duplicate mechanism is also added. While in-kernel umount is a bit worse than zygisk-provider-based ones, this can still serve as a healthy alternative. --------- Signed-off-by: backslashxx <[email protected]> Co-authored-by: weishu <[email protected]>
This idea is borrowed from simonpunk's susfs4ksu. What we see here is that, yeah well, lets just have userspace send us what it wants unmounted, this is better than hardcoding everything. This also solves that issue where MNT_DETACH fails, as long as we send unmountables in proper order. A small anti-duplicate mechanism is also added. While in-kernel umount is a bit worse than zygisk-provider-based ones, this can still serve as a healthy alternative. --------- Signed-off-by: backslashxx <[email protected]> Co-authored-by: weishu <[email protected]>


This idea is borrowed from simonpunk's susfs4ksu.
What we see here is that, yeah well, lets just have userspace send us what it
wants unmounted, this is better than hardcoding everything.
This also solves that issue where MNT_DETACH fails, as long as we send
unmountables in proper order.
A small anti-duplicate mechanism is also added.
While in-kernel umount is a bit worse than zygisk-provider-based ones, this can still
serve as a healthy alternative.