Release 4.15 include/linux/device_cgroup.h
/* SPDX-License-Identifier: GPL-2.0 */
#include <linux/fs.h>
#include <linux/bpf-cgroup.h>
#define DEVCG_ACC_MKNOD 1
#define DEVCG_ACC_READ 2
#define DEVCG_ACC_WRITE 4
#define DEVCG_ACC_MASK (DEVCG_ACC_MKNOD | DEVCG_ACC_READ | DEVCG_ACC_WRITE)
#define DEVCG_DEV_BLOCK 1
#define DEVCG_DEV_CHAR 2
#define DEVCG_DEV_ALL 4
/* this represents all devices */
#ifdef CONFIG_CGROUP_DEVICE
extern int __devcgroup_check_permission(short type, u32 major, u32 minor,
short access);
#else
static inline int __devcgroup_check_permission(short type, u32 major, u32 minor,
short access)
{ return 0; }
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Roman Gushchin | 20 | 90.91% | 1 | 50.00% |
Serge E. Hallyn | 2 | 9.09% | 1 | 50.00% |
Total | 22 | 100.00% | 2 | 100.00% |
#endif
#if defined(CONFIG_CGROUP_DEVICE) || defined(CONFIG_CGROUP_BPF)
static inline int devcgroup_check_permission(short type, u32 major, u32 minor,
short access)
{
int rc = BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type, major, minor, access);
if (rc)
return -EPERM;
return __devcgroup_check_permission(type, major, minor, access);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Roman Gushchin | 50 | 94.34% | 2 | 66.67% |
Serge E. Hallyn | 3 | 5.66% | 1 | 33.33% |
Total | 53 | 100.00% | 3 | 100.00% |
static inline int devcgroup_inode_permission(struct inode *inode, int mask)
{
short type, access = 0;
if (likely(!inode->i_rdev))
return 0;
if (S_ISBLK(inode->i_mode))
type = DEVCG_DEV_BLOCK;
else if (S_ISCHR(inode->i_mode))
type = DEVCG_DEV_CHAR;
else
return 0;
if (mask & MAY_WRITE)
access |= DEVCG_ACC_WRITE;
if (mask & MAY_READ)
access |= DEVCG_ACC_READ;
return devcgroup_check_permission(type, imajor(inode), iminor(inode),
access);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Roman Gushchin | 55 | 52.88% | 1 | 50.00% |
Al Viro | 49 | 47.12% | 1 | 50.00% |
Total | 104 | 100.00% | 2 | 100.00% |
static inline int devcgroup_inode_mknod(int mode, dev_t dev)
{
short type;
if (!S_ISBLK(mode) && !S_ISCHR(mode))
return 0;
if (S_ISBLK(mode))
type = DEVCG_DEV_BLOCK;
else
type = DEVCG_DEV_CHAR;
return devcgroup_check_permission(type, MAJOR(dev), MINOR(dev),
DEVCG_ACC_MKNOD);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Roman Gushchin | 64 | 95.52% | 1 | 50.00% |
Al Viro | 3 | 4.48% | 1 | 50.00% |
Total | 67 | 100.00% | 2 | 100.00% |
#else
static inline int devcgroup_inode_permission(struct inode *inode, int mask)
{ return 0; }
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Serge E. Hallyn | 18 | 100.00% | 1 | 100.00% |
Total | 18 | 100.00% | 1 | 100.00% |
static inline int devcgroup_inode_mknod(int mode, dev_t dev)
{ return 0; }
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Serge E. Hallyn | 16 | 100.00% | 1 | 100.00% |
Total | 16 | 100.00% | 1 | 100.00% |
#endif
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Roman Gushchin | 247 | 69.58% | 2 | 40.00% |
Serge E. Hallyn | 55 | 15.49% | 1 | 20.00% |
Al Viro | 52 | 14.65% | 1 | 20.00% |
Greg Kroah-Hartman | 1 | 0.28% | 1 | 20.00% |
Total | 355 | 100.00% | 5 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.