Commit 190bf7b1 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'mm-hotfixes-stable-2023-08-11-13-44' of...

Merge tag 'mm-hotfixes-stable-2023-08-11-13-44' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull misc fixes from Andrew Morton:
 "14 hotfixes. 11 of these are cc:stable and the remainder address
  post-6.4 issues, or are not considered suitable for -stable
  backporting"

* tag 'mm-hotfixes-stable-2023-08-11-13-44' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
  mm/damon/core: initialize damo_filter->list from damos_new_filter()
  nilfs2: fix use-after-free of nilfs_root in dirtying inodes via iput
  selftests: cgroup: fix test_kmem_basic false positives
  fs/proc/kcore: reinstate bounce buffer for KCORE_TEXT regions
  MAINTAINERS: add maple tree mailing list
  mm: compaction: fix endless looping over same migrate block
  selftests: mm: ksm: fix incorrect evaluation of parameter
  hugetlb: do not clear hugetlb dtor until allocating vmemmap
  mm: memory-failure: avoid false hwpoison page mapped error info
  mm: memory-failure: fix potential unexpected return value from unpoison_memory()
  mm/swapfile: fix wrong swap entry type for hwpoisoned swapcache page
  radix tree test suite: fix incorrect allocation size for pthreads
  crypto, cifs: fix error handling in extract_iter_to_sg()
  zsmalloc: fix races between modifications of fullness and isolated
parents 29d99aae 5f1fc67f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -12480,6 +12480,7 @@ F: net/mctp/
MAPLE TREE
M:	Liam R. Howlett <Liam.Howlett@oracle.com>
L:	maple-tree@lists.infradead.org
L:	linux-mm@kvack.org
S:	Supported
F:	Documentation/core-api/maple_tree.rst
+8 −0
Original line number Diff line number Diff line
@@ -1101,9 +1101,17 @@ int nilfs_set_file_dirty(struct inode *inode, unsigned int nr_dirty)

int __nilfs_mark_inode_dirty(struct inode *inode, int flags)
{
	struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
	struct buffer_head *ibh;
	int err;

	/*
	 * Do not dirty inodes after the log writer has been detached
	 * and its nilfs_root struct has been freed.
	 */
	if (unlikely(nilfs_purging(nilfs)))
		return 0;

	err = nilfs_load_inode_block(inode, &ibh);
	if (unlikely(err)) {
		nilfs_warn(inode->i_sb,
+2 −0
Original line number Diff line number Diff line
@@ -2845,6 +2845,7 @@ void nilfs_detach_log_writer(struct super_block *sb)
		nilfs_segctor_destroy(nilfs->ns_writer);
		nilfs->ns_writer = NULL;
	}
	set_nilfs_purging(nilfs);

	/* Force to free the list of dirty files */
	spin_lock(&nilfs->ns_inode_lock);
@@ -2857,4 +2858,5 @@ void nilfs_detach_log_writer(struct super_block *sb)
	up_write(&nilfs->ns_segctor_sem);

	nilfs_dispose_list(nilfs, &garbage_list, 1);
	clear_nilfs_purging(nilfs);
}
+2 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ enum {
	THE_NILFS_DISCONTINUED,	/* 'next' pointer chain has broken */
	THE_NILFS_GC_RUNNING,	/* gc process is running */
	THE_NILFS_SB_DIRTY,	/* super block is dirty */
	THE_NILFS_PURGING,	/* disposing dirty files for cleanup */
};

/**
@@ -208,6 +209,7 @@ THE_NILFS_FNS(INIT, init)
THE_NILFS_FNS(DISCONTINUED, discontinued)
THE_NILFS_FNS(GC_RUNNING, gc_running)
THE_NILFS_FNS(SB_DIRTY, sb_dirty)
THE_NILFS_FNS(PURGING, purging)

/*
 * Mount option operations
+27 −3
Original line number Diff line number Diff line
@@ -309,6 +309,8 @@ static void append_kcore_note(char *notes, size_t *i, const char *name,

static ssize_t read_kcore_iter(struct kiocb *iocb, struct iov_iter *iter)
{
	struct file *file = iocb->ki_filp;
	char *buf = file->private_data;
	loff_t *fpos = &iocb->ki_pos;
	size_t phdrs_offset, notes_offset, data_offset;
	size_t page_offline_frozen = 1;
@@ -555,10 +557,21 @@ static ssize_t read_kcore_iter(struct kiocb *iocb, struct iov_iter *iter)
		case KCORE_VMEMMAP:
		case KCORE_TEXT:
			/*
			 * We use _copy_to_iter() to bypass usermode hardening
			 * which would otherwise prevent this operation.
			 * Sadly we must use a bounce buffer here to be able to
			 * make use of copy_from_kernel_nofault(), as these
			 * memory regions might not always be mapped on all
			 * architectures.
			 */
			if (_copy_to_iter((char *)start, tsz, iter) != tsz) {
			if (copy_from_kernel_nofault(buf, (void *)start, tsz)) {
				if (iov_iter_zero(tsz, iter) != tsz) {
					ret = -EFAULT;
					goto out;
				}
			/*
			 * We know the bounce buffer is safe to copy from, so
			 * use _copy_to_iter() directly.
			 */
			} else if (_copy_to_iter(buf, tsz, iter) != tsz) {
				ret = -EFAULT;
				goto out;
			}
@@ -595,6 +608,10 @@ static int open_kcore(struct inode *inode, struct file *filp)
	if (ret)
		return ret;

	filp->private_data = kmalloc(PAGE_SIZE, GFP_KERNEL);
	if (!filp->private_data)
		return -ENOMEM;

	if (kcore_need_update)
		kcore_update_ram();
	if (i_size_read(inode) != proc_root_kcore->size) {
@@ -605,9 +622,16 @@ static int open_kcore(struct inode *inode, struct file *filp)
	return 0;
}

static int release_kcore(struct inode *inode, struct file *file)
{
	kfree(file->private_data);
	return 0;
}

static const struct proc_ops kcore_proc_ops = {
	.proc_read_iter	= read_kcore_iter,
	.proc_open	= open_kcore,
	.proc_release	= release_kcore,
	.proc_lseek	= default_llseek,
};

Loading