.. | .. |
---|
716 | 716 | struct block_device *i_bdev; |
---|
717 | 717 | struct cdev *i_cdev; |
---|
718 | 718 | char *i_link; |
---|
719 | | - unsigned __i_dir_seq; |
---|
| 719 | + unsigned i_dir_seq; |
---|
720 | 720 | }; |
---|
721 | 721 | |
---|
722 | 722 | __u32 i_generation; |
---|
.. | .. |
---|
1179 | 1179 | extern int vfs_test_lock(struct file *, struct file_lock *); |
---|
1180 | 1180 | extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); |
---|
1181 | 1181 | extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); |
---|
| 1182 | +bool vfs_inode_has_locks(struct inode *inode); |
---|
1182 | 1183 | extern int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl); |
---|
1183 | 1184 | extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type); |
---|
1184 | 1185 | extern void lease_get_mtime(struct inode *, struct timespec64 *time); |
---|
.. | .. |
---|
1291 | 1292 | return 0; |
---|
1292 | 1293 | } |
---|
1293 | 1294 | |
---|
| 1295 | +static inline bool vfs_inode_has_locks(struct inode *inode) |
---|
| 1296 | +{ |
---|
| 1297 | + return false; |
---|
| 1298 | +} |
---|
| 1299 | + |
---|
1294 | 1300 | static inline int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl) |
---|
1295 | 1301 | { |
---|
1296 | 1302 | return -ENOLCK; |
---|
.. | .. |
---|
1376 | 1382 | * sb->s_flags. Note that these mirror the equivalent MS_* flags where |
---|
1377 | 1383 | * represented in both. |
---|
1378 | 1384 | */ |
---|
1379 | | -#define SB_RDONLY 1 /* Mount read-only */ |
---|
1380 | | -#define SB_NOSUID 2 /* Ignore suid and sgid bits */ |
---|
1381 | | -#define SB_NODEV 4 /* Disallow access to device special files */ |
---|
1382 | | -#define SB_NOEXEC 8 /* Disallow program execution */ |
---|
1383 | | -#define SB_SYNCHRONOUS 16 /* Writes are synced at once */ |
---|
1384 | | -#define SB_MANDLOCK 64 /* Allow mandatory locks on an FS */ |
---|
1385 | | -#define SB_DIRSYNC 128 /* Directory modifications are synchronous */ |
---|
1386 | | -#define SB_NOATIME 1024 /* Do not update access times. */ |
---|
1387 | | -#define SB_NODIRATIME 2048 /* Do not update directory access times */ |
---|
1388 | | -#define SB_SILENT 32768 |
---|
1389 | | -#define SB_POSIXACL (1<<16) /* VFS does not apply the umask */ |
---|
1390 | | -#define SB_INLINECRYPT (1<<17) /* Use blk-crypto for encrypted files */ |
---|
1391 | | -#define SB_KERNMOUNT (1<<22) /* this is a kern_mount call */ |
---|
1392 | | -#define SB_I_VERSION (1<<23) /* Update inode I_version field */ |
---|
1393 | | -#define SB_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */ |
---|
| 1385 | +#define SB_RDONLY BIT(0) /* Mount read-only */ |
---|
| 1386 | +#define SB_NOSUID BIT(1) /* Ignore suid and sgid bits */ |
---|
| 1387 | +#define SB_NODEV BIT(2) /* Disallow access to device special files */ |
---|
| 1388 | +#define SB_NOEXEC BIT(3) /* Disallow program execution */ |
---|
| 1389 | +#define SB_SYNCHRONOUS BIT(4) /* Writes are synced at once */ |
---|
| 1390 | +#define SB_MANDLOCK BIT(6) /* Allow mandatory locks on an FS */ |
---|
| 1391 | +#define SB_DIRSYNC BIT(7) /* Directory modifications are synchronous */ |
---|
| 1392 | +#define SB_NOATIME BIT(10) /* Do not update access times. */ |
---|
| 1393 | +#define SB_NODIRATIME BIT(11) /* Do not update directory access times */ |
---|
| 1394 | +#define SB_SILENT BIT(15) |
---|
| 1395 | +#define SB_POSIXACL BIT(16) /* VFS does not apply the umask */ |
---|
| 1396 | +#define SB_INLINECRYPT BIT(17) /* Use blk-crypto for encrypted files */ |
---|
| 1397 | +#define SB_KERNMOUNT BIT(22) /* this is a kern_mount call */ |
---|
| 1398 | +#define SB_I_VERSION BIT(23) /* Update inode I_version field */ |
---|
| 1399 | +#define SB_LAZYTIME BIT(25) /* Update the on-disk [acm]times lazily */ |
---|
1394 | 1400 | |
---|
1395 | 1401 | /* These sb flags are internal to the kernel */ |
---|
1396 | | -#define SB_SUBMOUNT (1<<26) |
---|
1397 | | -#define SB_FORCE (1<<27) |
---|
1398 | | -#define SB_NOSEC (1<<28) |
---|
1399 | | -#define SB_BORN (1<<29) |
---|
1400 | | -#define SB_ACTIVE (1<<30) |
---|
1401 | | -#define SB_NOUSER (1<<31) |
---|
| 1402 | +#define SB_SUBMOUNT BIT(26) |
---|
| 1403 | +#define SB_FORCE BIT(27) |
---|
| 1404 | +#define SB_NOSEC BIT(28) |
---|
| 1405 | +#define SB_BORN BIT(29) |
---|
| 1406 | +#define SB_ACTIVE BIT(30) |
---|
| 1407 | +#define SB_NOUSER BIT(31) |
---|
1402 | 1408 | |
---|
1403 | 1409 | /* These flags relate to encoding and casefolding */ |
---|
1404 | 1410 | #define SB_ENC_STRICT_MODE_FL (1 << 0) |
---|
.. | .. |
---|
1810 | 1816 | extern void inode_init_owner(struct inode *inode, const struct inode *dir, |
---|
1811 | 1817 | umode_t mode); |
---|
1812 | 1818 | extern bool may_open_dev(const struct path *path); |
---|
| 1819 | +umode_t mode_strip_sgid(const struct inode *dir, umode_t mode); |
---|
1813 | 1820 | |
---|
1814 | 1821 | /* |
---|
1815 | 1822 | * This is the "filldir" function type, used by readdir() to let |
---|
.. | .. |
---|
3021 | 3028 | extern struct inode *new_inode_pseudo(struct super_block *sb); |
---|
3022 | 3029 | extern struct inode *new_inode(struct super_block *sb); |
---|
3023 | 3030 | extern void free_inode_nonrcu(struct inode *inode); |
---|
3024 | | -extern int should_remove_suid(struct dentry *); |
---|
| 3031 | +extern int setattr_should_drop_suidgid(struct inode *); |
---|
3025 | 3032 | extern int file_remove_privs(struct file *); |
---|
3026 | 3033 | |
---|
3027 | 3034 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); |
---|
.. | .. |
---|
3414 | 3421 | * All attributes contain a text representation of a numeric value |
---|
3415 | 3422 | * that are accessed with the get() and set() functions. |
---|
3416 | 3423 | */ |
---|
3417 | | -#define DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt) \ |
---|
| 3424 | +#define DEFINE_SIMPLE_ATTRIBUTE_XSIGNED(__fops, __get, __set, __fmt, __is_signed) \ |
---|
3418 | 3425 | static int __fops ## _open(struct inode *inode, struct file *file) \ |
---|
3419 | 3426 | { \ |
---|
3420 | 3427 | __simple_attr_check_format(__fmt, 0ull); \ |
---|
.. | .. |
---|
3425 | 3432 | .open = __fops ## _open, \ |
---|
3426 | 3433 | .release = simple_attr_release, \ |
---|
3427 | 3434 | .read = simple_attr_read, \ |
---|
3428 | | - .write = simple_attr_write, \ |
---|
| 3435 | + .write = (__is_signed) ? simple_attr_write_signed : simple_attr_write, \ |
---|
3429 | 3436 | .llseek = generic_file_llseek, \ |
---|
3430 | 3437 | } |
---|
| 3438 | + |
---|
| 3439 | +#define DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt) \ |
---|
| 3440 | + DEFINE_SIMPLE_ATTRIBUTE_XSIGNED(__fops, __get, __set, __fmt, false) |
---|
| 3441 | + |
---|
| 3442 | +#define DEFINE_SIMPLE_ATTRIBUTE_SIGNED(__fops, __get, __set, __fmt) \ |
---|
| 3443 | + DEFINE_SIMPLE_ATTRIBUTE_XSIGNED(__fops, __get, __set, __fmt, true) |
---|
3431 | 3444 | |
---|
3432 | 3445 | static inline __printf(1, 2) |
---|
3433 | 3446 | void __simple_attr_check_format(const char *fmt, ...) |
---|
.. | .. |
---|
3443 | 3456 | size_t len, loff_t *ppos); |
---|
3444 | 3457 | ssize_t simple_attr_write(struct file *file, const char __user *buf, |
---|
3445 | 3458 | size_t len, loff_t *ppos); |
---|
| 3459 | +ssize_t simple_attr_write_signed(struct file *file, const char __user *buf, |
---|
| 3460 | + size_t len, loff_t *ppos); |
---|
3446 | 3461 | |
---|
3447 | 3462 | struct ctl_table; |
---|
3448 | 3463 | int proc_nr_files(struct ctl_table *table, int write, |
---|
.. | .. |
---|
3462 | 3477 | |
---|
3463 | 3478 | static inline bool is_sxid(umode_t mode) |
---|
3464 | 3479 | { |
---|
3465 | | - return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); |
---|
| 3480 | + return mode & (S_ISUID | S_ISGID); |
---|
3466 | 3481 | } |
---|
3467 | 3482 | |
---|
3468 | 3483 | static inline int check_sticky(struct inode *dir, struct inode *inode) |
---|