Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'vfs-6.15-rc3.fixes.2' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs fixes from Christian Brauner:

- Revert the hfs{plus} deprecation warning that's also included in this
pull request. The commit introducing the deprecation warning resides
rather early in this branch. So simply dropping it would've rebased
all other commits which I decided to avoid. Hence the revert in the
same branch

[ Background - the deprecation warning discussion resulted in people
stepping up, and so hfs{plus} will have a maintainer taking care of
it after all.. - Linus ]

- Switch CONFIG_SYSFS_SYCALL default to n and decouple from
CONFIG_EXPERT

- Fix an audit bug caused by changes to our kernel path lookup helpers
this cycle. Audit needs the parent path even if the dentry it tried
to look up is negative

- Ensure that the kernel path lookup helpers leave the passed in path
argument clean when they return an error. This is consistent with all
our other helpers

- Ensure that vfs_getattr_nosec() calls bdev_statx() so the relevant
information is available to kernel consumers as well

- Don't set a timer and call schedule() if the timer will expire
immediately in epoll

- Make netfs lookup tables with __nonstring

* tag 'vfs-6.15-rc3.fixes.2' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
Revert "hfs{plus}: add deprecation warning"
fs: move the bdex_statx call to vfs_getattr_nosec
netfs: Mark __nonstring lookup tables
eventpoll: Set epoll timeout if it's in the future
fs: ensure that *path_locked*() helpers leave passed path pristine
fs: add kern_path_locked_negative()
hfs{plus}: add deprecation warning
Kconfig: switch CONFIG_SYSFS_SYCALL default to n

+113 -62
+1 -2
block/bdev.c
··· 1272 1272 /* 1273 1273 * Handle STATX_{DIOALIGN, WRITE_ATOMIC} for block devices. 1274 1274 */ 1275 - void bdev_statx(struct path *path, struct kstat *stat, 1276 - u32 request_mask) 1275 + void bdev_statx(const struct path *path, struct kstat *stat, u32 request_mask) 1277 1276 { 1278 1277 struct inode *backing_inode; 1279 1278 struct block_device *bdev;
+9 -1
fs/eventpoll.c
··· 1996 1996 return res; 1997 1997 } 1998 1998 1999 + static int ep_schedule_timeout(ktime_t *to) 2000 + { 2001 + if (to) 2002 + return ktime_after(*to, ktime_get()); 2003 + else 2004 + return 1; 2005 + } 2006 + 1999 2007 /** 2000 2008 * ep_poll - Retrieves ready events, and delivers them to the caller-supplied 2001 2009 * event buffer. ··· 2111 2103 2112 2104 write_unlock_irq(&ep->lock); 2113 2105 2114 - if (!eavail) 2106 + if (!eavail && ep_schedule_timeout(to)) 2115 2107 timed_out = !schedule_hrtimeout_range(to, slack, 2116 2108 HRTIMER_MODE_ABS); 2117 2109 __set_current_state(TASK_RUNNING);
+59 -24
fs/namei.c
··· 1665 1665 return dentry; 1666 1666 } 1667 1667 1668 - /* 1669 - * Parent directory has inode locked exclusive. This is one 1670 - * and only case when ->lookup() gets called on non in-lookup 1671 - * dentries - as the matter of fact, this only gets called 1672 - * when directory is guaranteed to have no in-lookup children 1673 - * at all. 1674 - * Will return -ENOENT if name isn't found and LOOKUP_CREATE wasn't passed. 1675 - * Will return -EEXIST if name is found and LOOKUP_EXCL was passed. 1676 - */ 1677 - struct dentry *lookup_one_qstr_excl(const struct qstr *name, 1678 - struct dentry *base, 1679 - unsigned int flags) 1668 + static struct dentry *lookup_one_qstr_excl_raw(const struct qstr *name, 1669 + struct dentry *base, 1670 + unsigned int flags) 1680 1671 { 1681 - struct dentry *dentry = lookup_dcache(name, base, flags); 1672 + struct dentry *dentry; 1682 1673 struct dentry *old; 1683 - struct inode *dir = base->d_inode; 1674 + struct inode *dir; 1684 1675 1676 + dentry = lookup_dcache(name, base, flags); 1685 1677 if (dentry) 1686 - goto found; 1678 + return dentry; 1687 1679 1688 1680 /* Don't create child dentry for a dead directory. */ 1681 + dir = base->d_inode; 1689 1682 if (unlikely(IS_DEADDIR(dir))) 1690 1683 return ERR_PTR(-ENOENT); 1691 1684 ··· 1691 1698 dput(dentry); 1692 1699 dentry = old; 1693 1700 } 1694 - found: 1701 + return dentry; 1702 + } 1703 + 1704 + /* 1705 + * Parent directory has inode locked exclusive. This is one 1706 + * and only case when ->lookup() gets called on non in-lookup 1707 + * dentries - as the matter of fact, this only gets called 1708 + * when directory is guaranteed to have no in-lookup children 1709 + * at all. 1710 + * Will return -ENOENT if name isn't found and LOOKUP_CREATE wasn't passed. 1711 + * Will return -EEXIST if name is found and LOOKUP_EXCL was passed. 1712 + */ 1713 + struct dentry *lookup_one_qstr_excl(const struct qstr *name, 1714 + struct dentry *base, unsigned int flags) 1715 + { 1716 + struct dentry *dentry; 1717 + 1718 + dentry = lookup_one_qstr_excl_raw(name, base, flags); 1695 1719 if (IS_ERR(dentry)) 1696 1720 return dentry; 1697 1721 if (d_is_negative(dentry) && !(flags & LOOKUP_CREATE)) { ··· 2752 2742 /* does lookup, returns the object with parent locked */ 2753 2743 static struct dentry *__kern_path_locked(int dfd, struct filename *name, struct path *path) 2754 2744 { 2745 + struct path parent_path __free(path_put) = {}; 2755 2746 struct dentry *d; 2756 2747 struct qstr last; 2757 2748 int type, error; 2758 2749 2759 - error = filename_parentat(dfd, name, 0, path, &last, &type); 2750 + error = filename_parentat(dfd, name, 0, &parent_path, &last, &type); 2760 2751 if (error) 2761 2752 return ERR_PTR(error); 2762 - if (unlikely(type != LAST_NORM)) { 2763 - path_put(path); 2753 + if (unlikely(type != LAST_NORM)) 2764 2754 return ERR_PTR(-EINVAL); 2765 - } 2766 - inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); 2767 - d = lookup_one_qstr_excl(&last, path->dentry, 0); 2755 + inode_lock_nested(parent_path.dentry->d_inode, I_MUTEX_PARENT); 2756 + d = lookup_one_qstr_excl(&last, parent_path.dentry, 0); 2768 2757 if (IS_ERR(d)) { 2769 - inode_unlock(path->dentry->d_inode); 2770 - path_put(path); 2758 + inode_unlock(parent_path.dentry->d_inode); 2759 + return d; 2771 2760 } 2761 + path->dentry = no_free_ptr(parent_path.dentry); 2762 + path->mnt = no_free_ptr(parent_path.mnt); 2763 + return d; 2764 + } 2765 + 2766 + struct dentry *kern_path_locked_negative(const char *name, struct path *path) 2767 + { 2768 + struct path parent_path __free(path_put) = {}; 2769 + struct filename *filename __free(putname) = getname_kernel(name); 2770 + struct dentry *d; 2771 + struct qstr last; 2772 + int type, error; 2773 + 2774 + error = filename_parentat(AT_FDCWD, filename, 0, &parent_path, &last, &type); 2775 + if (error) 2776 + return ERR_PTR(error); 2777 + if (unlikely(type != LAST_NORM)) 2778 + return ERR_PTR(-EINVAL); 2779 + inode_lock_nested(parent_path.dentry->d_inode, I_MUTEX_PARENT); 2780 + d = lookup_one_qstr_excl_raw(&last, parent_path.dentry, 0); 2781 + if (IS_ERR(d)) { 2782 + inode_unlock(parent_path.dentry->d_inode); 2783 + return d; 2784 + } 2785 + path->dentry = no_free_ptr(parent_path.dentry); 2786 + path->mnt = no_free_ptr(parent_path.mnt); 2772 2787 return d; 2773 2788 } 2774 2789
+1 -1
fs/netfs/fscache_cache.c
··· 372 372 EXPORT_SYMBOL(fscache_withdraw_cache); 373 373 374 374 #ifdef CONFIG_PROC_FS 375 - static const char fscache_cache_states[NR__FSCACHE_CACHE_STATE] = "-PAEW"; 375 + static const char fscache_cache_states[NR__FSCACHE_CACHE_STATE] __nonstring = "-PAEW"; 376 376 377 377 /* 378 378 * Generate a list of caches in /proc/fs/fscache/caches
+1 -1
fs/netfs/fscache_cookie.c
··· 29 29 static DEFINE_SPINLOCK(fscache_cookie_lru_lock); 30 30 DEFINE_TIMER(fscache_cookie_lru_timer, fscache_cookie_lru_timed_out); 31 31 static DECLARE_WORK(fscache_cookie_lru_work, fscache_cookie_lru_worker); 32 - static const char fscache_cookie_states[FSCACHE_COOKIE_STATE__NR] = "-LCAIFUWRD"; 32 + static const char fscache_cookie_states[FSCACHE_COOKIE_STATE__NR] __nonstring = "-LCAIFUWRD"; 33 33 static unsigned int fscache_lru_cookie_timeout = 10 * HZ; 34 34 35 35 void fscache_print_cookie(struct fscache_cookie *cookie, char prefix)
+18 -14
fs/stat.c
··· 204 204 STATX_ATTR_DAX); 205 205 206 206 idmap = mnt_idmap(path->mnt); 207 - if (inode->i_op->getattr) 208 - return inode->i_op->getattr(idmap, path, stat, 209 - request_mask, 210 - query_flags); 207 + if (inode->i_op->getattr) { 208 + int ret; 211 209 212 - generic_fillattr(idmap, request_mask, inode, stat); 210 + ret = inode->i_op->getattr(idmap, path, stat, request_mask, 211 + query_flags); 212 + if (ret) 213 + return ret; 214 + } else { 215 + generic_fillattr(idmap, request_mask, inode, stat); 216 + } 217 + 218 + /* 219 + * If this is a block device inode, override the filesystem attributes 220 + * with the block device specific parameters that need to be obtained 221 + * from the bdev backing inode. 222 + */ 223 + if (S_ISBLK(stat->mode)) 224 + bdev_statx(path, stat, request_mask); 225 + 213 226 return 0; 214 227 } 215 228 EXPORT_SYMBOL(vfs_getattr_nosec); ··· 308 295 if (path_mounted(path)) 309 296 stat->attributes |= STATX_ATTR_MOUNT_ROOT; 310 297 stat->attributes_mask |= STATX_ATTR_MOUNT_ROOT; 311 - 312 - /* 313 - * If this is a block device inode, override the filesystem 314 - * attributes with the block device specific parameters that need to be 315 - * obtained from the bdev backing inode. 316 - */ 317 - if (S_ISBLK(stat->mode)) 318 - bdev_statx(path, stat, request_mask); 319 - 320 298 return 0; 321 299 } 322 300
+3 -3
include/linux/blkdev.h
··· 1685 1685 int sync_blockdev_range(struct block_device *bdev, loff_t lstart, loff_t lend); 1686 1686 int sync_blockdev_nowait(struct block_device *bdev); 1687 1687 void sync_bdevs(bool wait); 1688 - void bdev_statx(struct path *, struct kstat *, u32); 1688 + void bdev_statx(const struct path *path, struct kstat *stat, u32 request_mask); 1689 1689 void printk_all_partitions(void); 1690 1690 int __init early_lookup_bdev(const char *pathname, dev_t *dev); 1691 1691 #else ··· 1703 1703 static inline void sync_bdevs(bool wait) 1704 1704 { 1705 1705 } 1706 - static inline void bdev_statx(struct path *path, struct kstat *stat, 1707 - u32 request_mask) 1706 + static inline void bdev_statx(const struct path *path, struct kstat *stat, 1707 + u32 request_mask) 1708 1708 { 1709 1709 } 1710 1710 static inline void printk_all_partitions(void)
+1
include/linux/namei.h
··· 62 62 extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int); 63 63 extern void done_path_create(struct path *, struct dentry *); 64 64 extern struct dentry *kern_path_locked(const char *, struct path *); 65 + extern struct dentry *kern_path_locked_negative(const char *, struct path *); 65 66 extern struct dentry *user_path_locked_at(int , const char __user *, struct path *); 66 67 int vfs_path_parent_lookup(struct filename *filename, unsigned int flags, 67 68 struct path *parent, struct qstr *last, int *type,
+10 -10
init/Kconfig
··· 1555 1555 the unaligned access emulation. 1556 1556 see arch/parisc/kernel/unaligned.c for reference 1557 1557 1558 + config SYSFS_SYSCALL 1559 + bool "Sysfs syscall support" 1560 + default n 1561 + help 1562 + sys_sysfs is an obsolete system call no longer supported in libc. 1563 + Note that disabling this option is more secure but might break 1564 + compatibility with some systems. 1565 + 1566 + If unsure say N here. 1567 + 1558 1568 config HAVE_PCSPKR_PLATFORM 1559 1569 bool 1560 1570 ··· 1608 1598 architectures. 1609 1599 1610 1600 If unsure, leave the default option here. 1611 - 1612 - config SYSFS_SYSCALL 1613 - bool "Sysfs syscall support" if EXPERT 1614 - default y 1615 - help 1616 - sys_sysfs is an obsolete system call no longer supported in libc. 1617 - Note that disabling this option is more secure but might break 1618 - compatibility with some systems. 1619 - 1620 - If unsure say Y here. 1621 1601 1622 1602 config FHANDLE 1623 1603 bool "open by fhandle syscalls" if EXPERT
+10 -6
kernel/audit_watch.c
··· 347 347 /* Get path information necessary for adding watches. */ 348 348 static int audit_get_nd(struct audit_watch *watch, struct path *parent) 349 349 { 350 - struct dentry *d = kern_path_locked(watch->path, parent); 350 + struct dentry *d; 351 + 352 + d = kern_path_locked_negative(watch->path, parent); 351 353 if (IS_ERR(d)) 352 354 return PTR_ERR(d); 353 - /* update watch filter fields */ 354 - watch->dev = d->d_sb->s_dev; 355 - watch->ino = d_backing_inode(d)->i_ino; 355 + 356 + if (d_is_positive(d)) { 357 + /* update watch filter fields */ 358 + watch->dev = d->d_sb->s_dev; 359 + watch->ino = d_backing_inode(d)->i_ino; 360 + } 356 361 357 362 inode_unlock(d_backing_inode(parent->dentry)); 358 363 dput(d); ··· 423 418 /* caller expects mutex locked */ 424 419 mutex_lock(&audit_filter_mutex); 425 420 426 - if (ret && ret != -ENOENT) { 421 + if (ret) { 427 422 audit_put_watch(watch); 428 423 return ret; 429 424 } 430 - ret = 0; 431 425 432 426 /* either find an old parent or attach a new one */ 433 427 parent = audit_find_parent(d_backing_inode(parent_path.dentry));