Skip to content

Commit

Permalink
Merge branch 'mm-hotfixes-stable' into mm-stable
Browse files Browse the repository at this point in the history
  • Loading branch information
akpm00 committed Nov 30, 2022
2 parents ea0ffd0 + 1d351f1 commit a38358c
Show file tree
Hide file tree
Showing 66 changed files with 37,529 additions and 36,936 deletions.
2 changes: 2 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Alexandre Belloni <[email protected]> <alexandre.belloni@free-electr
Alexei Starovoitov <[email protected]> <[email protected]>
Alexei Starovoitov <[email protected]> <[email protected]>
Alexei Starovoitov <[email protected]> <[email protected]>
Alex Hung <[email protected]> <[email protected]>
Alex Shi <[email protected]> <[email protected]>
Alex Shi <[email protected]> <[email protected]>
Alex Shi <[email protected]> <[email protected]>
Expand Down Expand Up @@ -382,6 +383,7 @@ Santosh Shilimkar <[email protected]>
Santosh Shilimkar <[email protected]>
Sarangdhar Joshi <[email protected]>
Sascha Hauer <[email protected]>
Satya Priya <[email protected]> <[email protected]>
S.Çağlar Onur <[email protected]>
Sean Christopherson <[email protected]> <[email protected]>
Sean Nyekjaer <[email protected]> <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions Documentation/dev-tools/kmsan.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ uninitialized in the local variable, as well as the stack where the value was
copied to another memory location before use.

A use of uninitialized value ``v`` is reported by KMSAN in the following cases:

- in a condition, e.g. ``if (v) { ... }``;
- in an indexing or pointer dereferencing, e.g. ``array[v]`` or ``*v``;
- when it is copied to userspace or hardware, e.g. ``copy_to_user(..., &v, ...)``;
Expand Down
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -10288,7 +10288,7 @@ T: git https://github.com/intel/gvt-linux.git
F: drivers/gpu/drm/i915/gvt/

INTEL HID EVENT DRIVER
M: Alex Hung <alex.hung@canonical.com>
M: Alex Hung <alexhung@gmail.com>
L: [email protected]
S: Maintained
F: drivers/platform/x86/intel/hid.c
Expand Down
1 change: 1 addition & 0 deletions arch/loongarch/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ static inline pmd_t pmd_mkdirty(pmd_t pmd)
return pmd;
}

#define pmd_young pmd_young
static inline int pmd_young(pmd_t pmd)
{
return !!(pmd_val(pmd) & _PAGE_ACCESSED);
Expand Down
1 change: 1 addition & 0 deletions arch/mips/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ static inline pmd_t pmd_mkdirty(pmd_t pmd)
return pmd;
}

#define pmd_young pmd_young
static inline int pmd_young(pmd_t pmd)
{
return !!(pmd_val(pmd) & _PAGE_ACCESSED);
Expand Down
1 change: 1 addition & 0 deletions arch/riscv/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ static inline int pmd_dirty(pmd_t pmd)
return pte_dirty(pmd_pte(pmd));
}

#define pmd_young pmd_young
static inline int pmd_young(pmd_t pmd)
{
return pte_young(pmd_pte(pmd));
Expand Down
1 change: 1 addition & 0 deletions arch/s390/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,7 @@ static inline int pmd_dirty(pmd_t pmd)
return (pmd_val(pmd) & _SEGMENT_ENTRY_DIRTY) != 0;
}

#define pmd_young pmd_young
static inline int pmd_young(pmd_t pmd)
{
return (pmd_val(pmd) & _SEGMENT_ENTRY_YOUNG) != 0;
Expand Down
1 change: 1 addition & 0 deletions arch/sparc/include/asm/pgtable_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ static inline unsigned long pmd_dirty(pmd_t pmd)
return pte_dirty(pte);
}

#define pmd_young pmd_young
static inline unsigned long pmd_young(pmd_t pmd)
{
pte_t pte = __pte(pmd_val(pmd));
Expand Down
9 changes: 9 additions & 0 deletions arch/x86/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ static inline int pmd_dirty(pmd_t pmd)
return pmd_flags(pmd) & _PAGE_DIRTY;
}

#define pmd_young pmd_young
static inline int pmd_young(pmd_t pmd)
{
return pmd_flags(pmd) & _PAGE_ACCESSED;
Expand Down Expand Up @@ -1438,6 +1439,14 @@ static inline bool arch_has_hw_pte_young(void)
return true;
}

#ifdef CONFIG_XEN_PV
#define arch_has_hw_nonleaf_pmd_young arch_has_hw_nonleaf_pmd_young
static inline bool arch_has_hw_nonleaf_pmd_young(void)
{
return !cpu_feature_enabled(X86_FEATURE_XENPV);
}
#endif

#ifdef CONFIG_PAGE_TABLE_CHECK
static inline bool pte_user_accessible_page(pte_t pte)
{
Expand Down
7 changes: 7 additions & 0 deletions arch/x86/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/context_tracking.h>
#include <linux/interrupt.h>
#include <linux/kallsyms.h>
#include <linux/kmsan.h>
#include <linux/spinlock.h>
#include <linux/kprobes.h>
#include <linux/uaccess.h>
Expand Down Expand Up @@ -301,6 +302,12 @@ static noinstr bool handle_bug(struct pt_regs *regs)
{
bool handled = false;

/*
* Normally @regs are unpoisoned by irqentry_enter(), but handle_bug()
* is a rare case that uses @regs without passing them to
* irqentry_enter().
*/
kmsan_unpoison_entry_regs(regs);
if (!is_valid_bugaddr(regs->ip))
return handled;

Expand Down
3 changes: 3 additions & 0 deletions arch/x86/lib/usercopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <linux/uaccess.h>
#include <linux/export.h>
#include <linux/instrumented.h>

#include <asm/tlbflush.h>

Expand Down Expand Up @@ -44,7 +45,9 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
* called from other contexts.
*/
pagefault_disable();
instrument_copy_from_user_before(to, from, n);
ret = raw_copy_from_user(to, from, n);
instrument_copy_from_user_after(to, from, n, ret);
pagefault_enable();

return ret;
Expand Down
4 changes: 4 additions & 0 deletions arch/x86/mm/hugetlbpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ int pmd_huge(pmd_t pmd)
*/
int pud_huge(pud_t pud)
{
#if CONFIG_PGTABLE_LEVELS > 2
return !pud_none(pud) &&
(pud_val(pud) & (_PAGE_PRESENT|_PAGE_PSE)) != _PAGE_PRESENT;
#else
return 0;
#endif
}

#ifdef CONFIG_HUGETLB_PAGE
Expand Down
7 changes: 7 additions & 0 deletions drivers/gpu/drm/amd/display/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@ menu "Display Engine Configuration"
config DRM_AMD_DC
bool "AMD DC - Enable new display engine"
default y
depends on BROKEN || !CC_IS_CLANG || X86_64 || SPARC64 || ARM64
select SND_HDA_COMPONENT if SND_HDA_CORE
select DRM_AMD_DC_DCN if (X86 || PPC_LONG_DOUBLE_128)
help
Choose this option if you want to use the new display engine
support for AMDGPU. This adds required support for Vega and
Raven ASICs.

calculate_bandwidth() is presently broken on all !(X86_64 || SPARC64 || ARM64)
architectures built with Clang (all released versions), whereby the stack
frame gets blown up to well over 5k. This would cause an immediate kernel
panic on most architectures. We'll revert this when the following bug report
has been resolved: https://github.com/llvm/llvm-project/issues/41896.

config DRM_AMD_DC_DCN
def_bool n
help
Expand Down
14 changes: 8 additions & 6 deletions fs/btrfs/compression.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ static u64 bio_end_offset(struct bio *bio)
static noinline int add_ra_bio_pages(struct inode *inode,
u64 compressed_end,
struct compressed_bio *cb,
unsigned long *pflags)
int *memstall, unsigned long *pflags)
{
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
unsigned long end_index;
Expand Down Expand Up @@ -581,8 +581,10 @@ static noinline int add_ra_bio_pages(struct inode *inode,
continue;
}

if (PageWorkingset(page))
if (!*memstall && PageWorkingset(page)) {
psi_memstall_enter(pflags);
*memstall = 1;
}

ret = set_page_extent_mapped(page);
if (ret < 0) {
Expand Down Expand Up @@ -670,8 +672,8 @@ void btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
u64 em_len;
u64 em_start;
struct extent_map *em;
/* Initialize to 1 to make skip psi_memstall_leave unless needed */
unsigned long pflags = 1;
unsigned long pflags;
int memstall = 0;
blk_status_t ret;
int ret2;
int i;
Expand Down Expand Up @@ -727,7 +729,7 @@ void btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
goto fail;
}

add_ra_bio_pages(inode, em_start + em_len, cb, &pflags);
add_ra_bio_pages(inode, em_start + em_len, cb, &memstall, &pflags);

/* include any pages we added in add_ra-bio_pages */
cb->len = bio->bi_iter.bi_size;
Expand Down Expand Up @@ -807,7 +809,7 @@ void btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
}
}

if (!pflags)
if (memstall)
psi_memstall_leave(&pflags);

if (refcount_dec_and_test(&cb->pending_ios))
Expand Down
18 changes: 11 additions & 7 deletions fs/erofs/zdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1412,8 +1412,8 @@ static void z_erofs_submit_queue(struct z_erofs_decompress_frontend *f,
struct block_device *last_bdev;
unsigned int nr_bios = 0;
struct bio *bio = NULL;
/* initialize to 1 to make skip psi_memstall_leave unless needed */
unsigned long pflags = 1;
unsigned long pflags;
int memstall = 0;

bi_private = jobqueueset_init(sb, q, fgq, force_fg);
qtail[JQ_BYPASS] = &q[JQ_BYPASS]->head;
Expand Down Expand Up @@ -1463,14 +1463,18 @@ static void z_erofs_submit_queue(struct z_erofs_decompress_frontend *f,
if (bio && (cur != last_index + 1 ||
last_bdev != mdev.m_bdev)) {
submit_bio_retry:
if (!pflags)
psi_memstall_leave(&pflags);
submit_bio(bio);
if (memstall) {
psi_memstall_leave(&pflags);
memstall = 0;
}
bio = NULL;
}

if (unlikely(PageWorkingset(page)))
if (unlikely(PageWorkingset(page)) && !memstall) {
psi_memstall_enter(&pflags);
memstall = 1;
}

if (!bio) {
bio = bio_alloc(mdev.m_bdev, BIO_MAX_VECS,
Expand Down Expand Up @@ -1500,9 +1504,9 @@ static void z_erofs_submit_queue(struct z_erofs_decompress_frontend *f,
} while (owned_head != Z_EROFS_PCLUSTER_TAIL);

if (bio) {
if (!pflags)
psi_memstall_leave(&pflags);
submit_bio(bio);
if (memstall)
psi_memstall_leave(&pflags);
}

/*
Expand Down
13 changes: 6 additions & 7 deletions fs/hugetlbfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,12 @@ static ssize_t hugetlbfs_read_iter(struct kiocb *iocb, struct iov_iter *to)
} else {
unlock_page(page);

if (PageHWPoison(page)) {
put_page(page);
retval = -EIO;
break;
}

/*
* We have the page, copy it to user space buffer.
*/
Expand Down Expand Up @@ -1111,13 +1117,6 @@ static int hugetlbfs_migrate_folio(struct address_space *mapping,
static int hugetlbfs_error_remove_page(struct address_space *mapping,
struct page *page)
{
struct inode *inode = mapping->host;
pgoff_t index = page->index;

hugetlb_delete_from_page_cache(page);
if (unlikely(hugetlb_unreserve_pages(inode, index, index + 1, 1)))
hugetlb_fix_reserve_counts(inode);

return 0;
}

Expand Down
7 changes: 7 additions & 0 deletions fs/nilfs2/dat.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ static void nilfs_dat_commit_free(struct inode *dat,
kunmap_atomic(kaddr);

nilfs_dat_commit_entry(dat, req);

if (unlikely(req->pr_desc_bh == NULL || req->pr_bitmap_bh == NULL)) {
nilfs_error(dat->i_sb,
"state inconsistency probably due to duplicate use of vblocknr = %llu",
(unsigned long long)req->pr_entry_nr);
return;
}
nilfs_palloc_commit_free_entry(dat, req);
}

Expand Down
15 changes: 8 additions & 7 deletions fs/nilfs2/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ void nilfs_relax_pressure_in_lock(struct super_block *sb)
struct the_nilfs *nilfs = sb->s_fs_info;
struct nilfs_sc_info *sci = nilfs->ns_writer;

if (!sci || !sci->sc_flush_request)
if (sb_rdonly(sb) || unlikely(!sci) || !sci->sc_flush_request)
return;

set_bit(NILFS_SC_PRIOR_FLUSH, &sci->sc_flags);
Expand Down Expand Up @@ -2242,7 +2242,7 @@ int nilfs_construct_segment(struct super_block *sb)
struct nilfs_sc_info *sci = nilfs->ns_writer;
struct nilfs_transaction_info *ti;

if (!sci)
if (sb_rdonly(sb) || unlikely(!sci))
return -EROFS;

/* A call inside transactions causes a deadlock. */
Expand Down Expand Up @@ -2280,7 +2280,7 @@ int nilfs_construct_dsync_segment(struct super_block *sb, struct inode *inode,
struct nilfs_transaction_info ti;
int err = 0;

if (!sci)
if (sb_rdonly(sb) || unlikely(!sci))
return -EROFS;

nilfs_transaction_lock(sb, &ti, 0);
Expand Down Expand Up @@ -2776,11 +2776,12 @@ int nilfs_attach_log_writer(struct super_block *sb, struct nilfs_root *root)

if (nilfs->ns_writer) {
/*
* This happens if the filesystem was remounted
* read/write after nilfs_error degenerated it into a
* read-only mount.
* This happens if the filesystem is made read-only by
* __nilfs_error or nilfs_remount and then remounted
* read/write. In these cases, reuse the existing
* writer.
*/
nilfs_detach_log_writer(sb);
return 0;
}

nilfs->ns_writer = nilfs_segctor_new(sb, root);
Expand Down
8 changes: 8 additions & 0 deletions fs/nilfs2/sufile.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,14 +495,22 @@ void nilfs_sufile_do_free(struct inode *sufile, __u64 segnum,
int nilfs_sufile_mark_dirty(struct inode *sufile, __u64 segnum)
{
struct buffer_head *bh;
void *kaddr;
struct nilfs_segment_usage *su;
int ret;

down_write(&NILFS_MDT(sufile)->mi_sem);
ret = nilfs_sufile_get_segment_usage_block(sufile, segnum, 0, &bh);
if (!ret) {
mark_buffer_dirty(bh);
nilfs_mdt_mark_dirty(sufile);
kaddr = kmap_atomic(bh->b_page);
su = nilfs_sufile_block_get_segment_usage(sufile, segnum, bh, kaddr);
nilfs_segment_usage_set_dirty(su);
kunmap_atomic(kaddr);
brelse(bh);
}
up_write(&NILFS_MDT(sufile)->mi_sem);
return ret;
}

Expand Down
2 changes: 0 additions & 2 deletions fs/nilfs2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1133,8 +1133,6 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data)
if ((bool)(*flags & SB_RDONLY) == sb_rdonly(sb))
goto out;
if (*flags & SB_RDONLY) {
/* Shutting down log writer */
nilfs_detach_log_writer(sb);
sb->s_flags |= SB_RDONLY;

/*
Expand Down
2 changes: 0 additions & 2 deletions fs/nilfs2/the_nilfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,7 @@ int nilfs_count_free_blocks(struct the_nilfs *nilfs, sector_t *nblocks)
{
unsigned long ncleansegs;

down_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem);
ncleansegs = nilfs_sufile_get_ncleansegs(nilfs->ns_sufile);
up_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem);
*nblocks = (sector_t)ncleansegs * nilfs->ns_blocks_per_segment;
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion fs/proc/meminfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
#endif
show_val_kb(m, "PageTables: ",
global_node_page_state(NR_PAGETABLE));
show_val_kb(m, "SecPageTables: ",
show_val_kb(m, "SecPageTables: ",
global_node_page_state(NR_SECONDARY_PAGETABLE));

show_val_kb(m, "NFS_Unstable: ", 0);
Expand Down
Loading

0 comments on commit a38358c

Please sign in to comment.