Odd interaction with file capabilities and procfs files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

(Going off get_maintainers.pl for fs/namei.c here)

I'm seeing some weird interactions with file capabilities and S_IRUSR
procfs files. Best I can tell it doesn't occur with real files on my btrfs
home partition.

Test program:

        #include <fcntl.h>
        #include <stdio.h>
        
        int main()
        {
                int fd = open("/proc/self/auxv", O_RDONLY);
                if (fd < 0) {
                        perror("open");
                        return 1;
                }
       
                printf("ok\n");
                return 0;
        }

Steps to reproduce:

        $ gcc main.c
        $ ./a.out
        ok
        $ sudo setcap "cap_net_admin,cap_sys_admin+p" a.out
        $ ./a.out
        open: Permission denied

It's not obvious why this happens, even after spending a few hours
going through the standard documentation and kernel code. It's
intuitively odd b/c you'd think adding capabilities to the permitted
set wouldn't affect functionality.

Best I could tell the -EACCES error occurs in the fallthrough codepath
inside generic_permission().

Sorry if this is something dumb or obvious.

Thanks,
Daniel



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux