Commit 311e1c83 authored by Maciej Żenczykowski's avatar Maciej Żenczykowski
Browse files

FROMLIST: configfs: make directories inherit uid/gid from creator

Currently a non-root user may have the rights to create directories
in configfs, but they default to being owned by root, so you can't
create anything inside of the directories you yourself created.

phone:/config/usb_gadget/g1/configs $ id; mkdir b.2; ls -lZ; chown system:system b.2
uid=1000(system) gid=1000(system) groups=1000(system),1004(input),1007(log),1011(adb),...
drwxr-xr-x 3 system  system u:object_r:configfs:s0  0 2020-12-28 06:03 b.1
drwxr-xr-x 3 root    root   u:object_r:configfs:s0  0 2020-12-28 06:51 b.2
chown: 'b.2' to 'system:system': Operation not permitted

phone:/config/usb_gadget/g1/configs $ ln -s ../../../../usb_gadget/g1/functions/ffs.adb b.2/function0
ln: cannot create symbolic link from '../../../../usb_gadget/g1/functions/ffs.adb' to 'b.2/function0': Permission denied

Test: With this change b.2 is owned by system:system and the ln succeeds.
Link: https://lore.kernel.org/lkml/20210123205516.2738060-1-zenczykowski@gmail.com/


Bug: 172793258
Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
Change-Id: Ia907b2def940197b44aa87b337d37c5dde9c5b91
parent 59762fe6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment