Skip to content

Commit 1c6aa11

Browse files
committed
Merge tag 'vfs-6.16-rc7.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull vfs fixes from Christian Brauner: - Fix a memory leak in fcntl_dirnotify() - Raise SB_I_NOEXEC on secrement superblock instead of messing with flags on the mount - Add fsdevel and block mailing lists to uio entry. We had a few instances were very questionable stuff was added without either block or the VFS being aware of it - Fix netfs copy-to-cache so that it performs collection with ceph+fscache - Fix netfs race between cache write completion and ALL_QUEUED being set - Verify the inode mode when loading entries from disk in isofs - Avoid state_lock in iomap_set_range_uptodate() - Fix PIDFD_INFO_COREDUMP check in PIDFD_GET_INFO ioctl - Fix the incorrect return value in __cachefiles_write() * tag 'vfs-6.16-rc7.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: MAINTAINERS: add block and fsdevel lists to iov_iter netfs: Fix race between cache write completion and ALL_QUEUED being set netfs: Fix copy-to-cache so that it performs collection with ceph+fscache fix a leak in fcntl_dirnotify() iomap: avoid unnecessary ifs_set_range_uptodate() with locks isofs: Verify inode mode when loading from disk cachefiles: Fix the incorrect return value in __cachefiles_write() secretmem: use SB_I_NOEXEC coredump: fix PIDFD_INFO_COREDUMP ioctl check
2 parents 4871b7c + a88cdda commit 1c6aa11

File tree

10 files changed

+63
-15
lines changed

10 files changed

+63
-15
lines changed

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25902,6 +25902,8 @@ F: fs/hostfs/
2590225902

2590325903
USERSPACE COPYIN/COPYOUT (UIOVEC)
2590425904
M: Alexander Viro <[email protected]>
25905+
25906+
2590525907
S: Maintained
2590625908
F: include/linux/uio.h
2590725909
F: lib/iov_iter.c

fs/cachefiles/io.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,6 @@ int __cachefiles_write(struct cachefiles_object *object,
347347
default:
348348
ki->was_async = false;
349349
cachefiles_write_complete(&ki->iocb, ret);
350-
if (ret > 0)
351-
ret = 0;
352350
break;
353351
}
354352

fs/cachefiles/ondemand.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,8 @@ static ssize_t cachefiles_ondemand_fd_write_iter(struct kiocb *kiocb,
8383

8484
trace_cachefiles_ondemand_fd_write(object, file_inode(file), pos, len);
8585
ret = __cachefiles_write(object, file, pos, iter, NULL, NULL);
86-
if (!ret) {
87-
ret = len;
86+
if (ret > 0)
8887
kiocb->ki_pos += ret;
89-
}
9088

9189
out:
9290
fput(file);

fs/iomap/buffered-io.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ static void iomap_set_range_uptodate(struct folio *folio, size_t off,
7171
unsigned long flags;
7272
bool uptodate = true;
7373

74+
if (folio_test_uptodate(folio))
75+
return;
76+
7477
if (ifs) {
7578
spin_lock_irqsave(&ifs->state_lock, flags);
7679
uptodate = ifs_set_range_uptodate(folio, ifs, off, len);

fs/isofs/inode.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1440,9 +1440,16 @@ static int isofs_read_inode(struct inode *inode, int relocated)
14401440
inode->i_op = &page_symlink_inode_operations;
14411441
inode_nohighmem(inode);
14421442
inode->i_data.a_ops = &isofs_symlink_aops;
1443-
} else
1443+
} else if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) ||
1444+
S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) {
14441445
/* XXX - parse_rock_ridge_inode() had already set i_rdev. */
14451446
init_special_inode(inode, inode->i_mode, inode->i_rdev);
1447+
} else {
1448+
printk(KERN_DEBUG "ISOFS: Invalid file type 0%04o for inode %lu.\n",
1449+
inode->i_mode, inode->i_ino);
1450+
ret = -EIO;
1451+
goto fail;
1452+
}
14461453

14471454
ret = 0;
14481455
out:

fs/netfs/read_pgpriv2.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ static struct netfs_io_request *netfs_pgpriv2_begin_copy_to_cache(
110110
if (!creq->io_streams[1].avail)
111111
goto cancel_put;
112112

113+
__set_bit(NETFS_RREQ_OFFLOAD_COLLECTION, &creq->flags);
114+
trace_netfs_copy2cache(rreq, creq);
113115
trace_netfs_write(creq, netfs_write_trace_copy_to_cache);
114116
netfs_stat(&netfs_n_wh_copy_to_cache);
115117
rreq->copy_to_cache = creq;
@@ -154,6 +156,9 @@ void netfs_pgpriv2_end_copy_to_cache(struct netfs_io_request *rreq)
154156
netfs_issue_write(creq, &creq->io_streams[1]);
155157
smp_wmb(); /* Write lists before ALL_QUEUED. */
156158
set_bit(NETFS_RREQ_ALL_QUEUED, &creq->flags);
159+
trace_netfs_rreq(rreq, netfs_rreq_trace_end_copy_to_cache);
160+
if (list_empty_careful(&creq->io_streams[1].subrequests))
161+
netfs_wake_collector(creq);
157162

158163
netfs_put_request(creq, netfs_rreq_trace_put_return);
159164
creq->copy_to_cache = NULL;

fs/notify/dnotify/dnotify.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,17 +308,17 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned int arg)
308308
goto out_err;
309309
}
310310

311+
error = file_f_owner_allocate(filp);
312+
if (error)
313+
goto out_err;
314+
311315
/* new fsnotify mark, we expect most fcntl calls to add a new mark */
312316
new_dn_mark = kmem_cache_alloc(dnotify_mark_cache, GFP_KERNEL);
313317
if (!new_dn_mark) {
314318
error = -ENOMEM;
315319
goto out_err;
316320
}
317321

318-
error = file_f_owner_allocate(filp);
319-
if (error)
320-
goto out_err;
321-
322322
/* set up the new_fsn_mark and new_dn_mark */
323323
new_fsn_mark = &new_dn_mark->fsn_mark;
324324
fsnotify_init_mark(new_fsn_mark, dnotify_group);

fs/pidfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static long pidfd_info(struct file *file, unsigned int cmd, unsigned long arg)
319319
if (!c)
320320
return -ESRCH;
321321

322-
if (!(kinfo.mask & PIDFD_INFO_COREDUMP)) {
322+
if ((kinfo.mask & PIDFD_INFO_COREDUMP) && !(kinfo.coredump_mask)) {
323323
task_lock(task);
324324
if (task->mm)
325325
kinfo.coredump_mask = pidfs_coredump_mask(task->mm->flags);

include/trace/events/netfs.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
EM(netfs_rreq_trace_copy, "COPY ") \
5656
EM(netfs_rreq_trace_dirty, "DIRTY ") \
5757
EM(netfs_rreq_trace_done, "DONE ") \
58+
EM(netfs_rreq_trace_end_copy_to_cache, "END-C2C") \
5859
EM(netfs_rreq_trace_free, "FREE ") \
5960
EM(netfs_rreq_trace_ki_complete, "KI-CMPL") \
6061
EM(netfs_rreq_trace_recollect, "RECLLCT") \
@@ -559,6 +560,35 @@ TRACE_EVENT(netfs_write,
559560
__entry->start, __entry->start + __entry->len - 1)
560561
);
561562

563+
TRACE_EVENT(netfs_copy2cache,
564+
TP_PROTO(const struct netfs_io_request *rreq,
565+
const struct netfs_io_request *creq),
566+
567+
TP_ARGS(rreq, creq),
568+
569+
TP_STRUCT__entry(
570+
__field(unsigned int, rreq)
571+
__field(unsigned int, creq)
572+
__field(unsigned int, cookie)
573+
__field(unsigned int, ino)
574+
),
575+
576+
TP_fast_assign(
577+
struct netfs_inode *__ctx = netfs_inode(rreq->inode);
578+
struct fscache_cookie *__cookie = netfs_i_cookie(__ctx);
579+
__entry->rreq = rreq->debug_id;
580+
__entry->creq = creq->debug_id;
581+
__entry->cookie = __cookie ? __cookie->debug_id : 0;
582+
__entry->ino = rreq->inode->i_ino;
583+
),
584+
585+
TP_printk("R=%08x CR=%08x c=%08x i=%x ",
586+
__entry->rreq,
587+
__entry->creq,
588+
__entry->cookie,
589+
__entry->ino)
590+
);
591+
562592
TRACE_EVENT(netfs_collect,
563593
TP_PROTO(const struct netfs_io_request *wreq),
564594

mm/secretmem.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,15 @@ SYSCALL_DEFINE1(memfd_secret, unsigned int, flags)
261261

262262
static int secretmem_init_fs_context(struct fs_context *fc)
263263
{
264-
return init_pseudo(fc, SECRETMEM_MAGIC) ? 0 : -ENOMEM;
264+
struct pseudo_fs_context *ctx;
265+
266+
ctx = init_pseudo(fc, SECRETMEM_MAGIC);
267+
if (!ctx)
268+
return -ENOMEM;
269+
270+
fc->s_iflags |= SB_I_NOEXEC;
271+
fc->s_iflags |= SB_I_NODEV;
272+
return 0;
265273
}
266274

267275
static struct file_system_type secretmem_fs = {
@@ -279,9 +287,6 @@ static int __init secretmem_init(void)
279287
if (IS_ERR(secretmem_mnt))
280288
return PTR_ERR(secretmem_mnt);
281289

282-
/* prevent secretmem mappings from ever getting PROT_EXEC */
283-
secretmem_mnt->mnt_flags |= MNT_NOEXEC;
284-
285290
return 0;
286291
}
287292
fs_initcall(secretmem_init);

0 commit comments

Comments
 (0)