projects/linux·commit 122e7943

Merge tag 'mm-hotfixes-stable-2023-07-28-15-52' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

122e7943 · Linus Torvalds <[email protected]> · 2023-07-28 17:19:52 -07:00

Pull hotfixes from Andrew Morton:
 "11 hotfixes. Five are cc:stable and the remainder address post-6.4
  issues or aren't considered serious enough to justify backporting"

* tag 'mm-hotfixes-stable-2023-07-28-15-52' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
  mm/memory-failure: fix hardware poison check in unpoison_memory()
  proc/vmcore: fix signedness bug in read_from_oldmem()
  mailmap: update remaining active codeaurora.org email addresses
  mm: lock VMA in dup_anon_vma() before setting ->anon_vma
  mm: fix memory ordering for mm_lock_seq and vm_lock_seq
  scripts/spelling.txt: remove 'thead' as a typo
  mm/pagewalk: fix EFI_PGT_DUMP of espfix area
  shmem: minor fixes to splice-read implementation
  tmpfs: fix Documentation of noswap and huge mount options
  Revert "um: Use swap() to make code cleaner"
  mm/damon/core-test: initialise context before test in damon_test_set_attrs()
Commit
122e7943b252fcf48b4d085dec084e24fc8bec45
Parents
20d3f241 · 6c54312f

Merge commit. Changes below are compared with the first parent: 20d3f241.

Changes

13 files changed · +197 −51

Only the first 600 diff lines are shown. Download the complete patch.

.mailmap

View file
diff --git a/.mailmap b/.mailmap
index a33b9f5..5dd3181 100644
--- a/.mailmap
+++ b/.mailmap
@@ -13,7 +13,9 @@
Aaron Durbin <[email protected]>
+Abhijeet Dharmapurikar <[email protected]> <[email protected]>
Adam Oldham <[email protected]>
Adam Radford <[email protected]>
@@ -30,6 +32,7 @@ Alexander Mikhalitsyn <[email protected]> <alexander.mikhalitsyn@virtuozzo
Alexander Mikhalitsyn <[email protected]> <[email protected]>
Alexandre Belloni <[email protected]> <[email protected]>
+Alexei Avshalom Lazar <[email protected]> <[email protected]>
Alexei Starovoitov <[email protected]> <[email protected]>
Alexei Starovoitov <[email protected]> <[email protected]>
Alexei Starovoitov <[email protected]> <[email protected]>
@@ -37,8 +40,11 @@ Alex Hung <[email protected]> <[email protected]>
Andreas Herrmann <[email protected]>
@@ -54,6 +60,8 @@ Andrey Ryabinin <[email protected]> <[email protected]>
Andy Adamson <[email protected]>
@@ -62,9 +70,17 @@ Archit Taneja <[email protected]>
Arnaud Patard <[email protected]>
Arnd Bergmann <[email protected]>
+Arun Kumar Neelakantam <[email protected]> <[email protected]>
+Ashok Raj Nagarajan <[email protected]> <[email protected]>
+Avaneesh Kumar Dwivedi <[email protected]> <[email protected]>
Axel Dyks <[email protected]>
Axel Lin <[email protected]>
+Balakrishna Godavarthi <[email protected]> <[email protected]>
@@ -93,12 +109,15 @@ Brian Avery <[email protected]>
Brian King <[email protected]>
Christian Borntraeger <[email protected]> <[email protected]>
Christian Borntraeger <[email protected]> <[email protected]>
Christian Borntraeger <[email protected]> <[email protected]>
@@ -119,7 +138,10 @@ Daniel Borkmann <[email protected]> <[email protected]>
David Brownell <[email protected]>
David Woodhouse <[email protected]>
+Deepak Kumar Singh <[email protected]> <[email protected]>
@@ -136,6 +158,7 @@ Dmitry Safonov <[email protected]> <[email protected]>
Domen Puncer <[email protected]>
Douglas Gilbert <[email protected]>
Ed L. Cashin <[email protected]>
Enric Balletbo i Serra <[email protected]> <[email protected]>
Enric Balletbo i Serra <[email protected]> <[email protected]>
@@ -148,6 +171,7 @@ Faith Ekstrand <[email protected]> <[email protected]>
Felipe W Damasio <[email protected]>
Felix Kuhling <[email protected]>
Felix Moeller <[email protected]>
Filipe Lautert <[email protected]>
Franck Bui-Huu <[email protected]>
@@ -171,8 +195,11 @@ Greg Kurz <[email protected]> <[email protected]>
Guilherme G. Piccoli <[email protected]> <[email protected]>
Guilherme G. Piccoli <[email protected]> <[email protected]>
+Gokul Sriram Palanisamy <[email protected]> <[email protected]>
+Govindaraj Saminathan <[email protected]> <[email protected]>
+Guru Das Srinagesh <[email protected]> <[email protected]>
Gustavo Padovan <[email protected]>
Gustavo Padovan <[email protected]>
@@ -190,6 +217,7 @@ Huacai Chen <[email protected]> <[email protected]>
Jacob Shin <[email protected]>
@@ -217,10 +245,12 @@ Jayachandran C <[email protected]> <[email protected]>
Jean Tourrilhes <[email protected]>
Jeff Garzik <[email protected]>
@@ -228,6 +258,7 @@ Jens Axboe <[email protected]> <[email protected]>
Jens Osterkamp <[email protected]>
@@ -238,6 +269,7 @@ Jiri Slaby <[email protected]> <[email protected]>
@@ -256,6 +288,7 @@ Jordan Crouse <[email protected]> <[email protected]>
Juha Yrjola <at solidboot.com>
Juha Yrjola <[email protected]>
Juha Yrjola <[email protected]>
@@ -263,6 +296,8 @@ Julien Thierry <[email protected]> <[email protected]>
+Karthikeyan Periyasamy <[email protected]> <[email protected]>
Kay Sievers <[email protected]>
@@ -271,6 +306,8 @@ Kees Cook <[email protected]> <[email protected]>
Kenneth W Chen <[email protected]>
+Kenneth Westfield <[email protected]> <[email protected]>
Konstantin Khlebnikov <[email protected]> <[email protected]>
Konstantin Khlebnikov <[email protected]> <[email protected]>
@@ -279,6 +316,7 @@ Krishna Manikandan <[email protected]> <[email protected]>
Krzysztof Kozlowski <[email protected]> <[email protected]>
Krzysztof Kozlowski <[email protected]> <[email protected]>
Krzysztof Kozlowski <[email protected]> <[email protected]>
Kuninori Morimoto <[email protected]>
@@ -292,19 +330,27 @@ Leonid I Ananiev <[email protected]>
Linas Vepstas <[email protected]>
Lorenzo Pieralisi <[email protected]> <[email protected]>
Maciej W. Rozycki <[email protected]> <[email protected]>
Maciej W. Rozycki <[email protected]> <[email protected]>
+Maharaja Kennadyrajan <[email protected]> <[email protected]>
+Manikanta Pubbisetty <[email protected]> <[email protected]>
Manivannan Sadhasivam <[email protected]> <[email protected]>
Manivannan Sadhasivam <[email protected]> <[email protected]>
Marcin Nowakowski <[email protected]> <[email protected]>
@@ -334,6 +380,7 @@ Matt Ranostay <[email protected]> <[email protected]>
Matt Ranostay <[email protected]> Matthew Ranostay <[email protected]>
Mauro Carvalho Chehab <[email protected]> <[email protected]>
Mauro Carvalho Chehab <[email protected]> <[email protected]>
Mauro Carvalho Chehab <[email protected]> <[email protected]>
@@ -346,7 +393,10 @@ Maxim Mikityanskiy <[email protected]> <[email protected]>
Mayuresh Janorkar <[email protected]>
Michael Buesch <[email protected]>
Michel Dänzer <[email protected]>
@@ -357,6 +407,7 @@ Miguel Ojeda <[email protected]> <[email protected]>
Mitesh shah <[email protected]>
@@ -365,9 +416,13 @@ Morten Welinder <[email protected]>
Morten Welinder <[email protected]>
Morten Welinder <[email protected]>
Morten Welinder <[email protected]>
Mythri P K <[email protected]>
Nadia Yvette Chambers <[email protected]> William Lee Irwin III <[email protected]>
Nathan Chancellor <[email protected]> <[email protected]>
Nguyen Anh Quynh <[email protected]>
@@ -386,6 +441,7 @@ Nikolay Aleksandrov <[email protected]> <[email protected]>
Nikolay Aleksandrov <[email protected]> <[email protected]>
Nikolay Aleksandrov <[email protected]> <[email protected]>
Nikolay Aleksandrov <[email protected]> <[email protected]>
Oleksandr Natalenko <[email protected]> <[email protected]>
@@ -393,6 +449,7 @@ Oleksij Rempel <[email protected]> <[email protected]>
Paolo 'Blaisorblade' Giarrusso <[email protected]>
Patrick Mochel <[email protected]>
@@ -404,11 +461,14 @@ Paul E. McKenney <[email protected]> <[email protected]>
+Pavankumar Kondeti <[email protected]> <[email protected]>
Peter A Jonsson <[email protected]>
Peter Oruba <[email protected]>
Peter Oruba <[email protected]>
Praveen BP <[email protected]>
+Pradeep Kumar Chitrapu <[email protected]> <[email protected]>
@@ -417,10 +477,16 @@ Quentin Perret <[email protected]> <[email protected]>
Rafael J. Wysocki <[email protected]> <[email protected]>
+Rajeshwari Ravindra Kamble <[email protected]> <[email protected]>
Rajesh Shah <[email protected]>
Ralf Baechle <[email protected]>
Ralf Wildenhues <[email protected]>
+Ram Chandra Jangir <[email protected]> <[email protected]>
+Ravi Kumar Siddojigari <[email protected]> <[email protected]>
Rémi Denis-Courmont <[email protected]>
Ricardo Ribalda <[email protected]> Ricardo Ribalda Delgado <[email protected]>
@@ -429,6 +495,7 @@ Richard Leitner <[email protected]> <[email protected]>
@@ -446,24 +513,35 @@ Santosh Shilimkar <[email protected]>
Santosh Shilimkar <[email protected]>
Sarangdhar Joshi <[email protected]>
Sascha Hauer <[email protected]>
+Sathishkumar Muruganandam <[email protected]> <[email protected]>
S.Çağlar Onur <[email protected]>
Sean Christopherson <[email protected]> <[email protected]>
Sebastian Reichel <[email protected]> <[email protected]>
Sebastian Reichel <[email protected]> <[email protected]>
+Sharath Chandra Vurukala <[email protected]> <[email protected]>
Simon Kelley <[email protected]>
+Sricharan Ramabadhran <[email protected]> <[email protected]>
Stéphane Witzmann <[email protected]>
Stephen Hemminger <[email protected]> <[email protected]>
Stephen Hemminger <[email protected]> <[email protected]>
@@ -471,22 +549,30 @@ Stephen Hemminger <[email protected]> <[email protected]>
Stephen Hemminger <[email protected]> <[email protected]>
-Subash Abhinov Kasiviswanathan <[email protected]>
+Subash Abhinov Kasiviswanathan <[email protected]> <[email protected]>
+Subbaraman Narayanamurthy <[email protected]> <[email protected]>
Subhash Jadavani <[email protected]>
+Sudarshan Rajagopalan <[email protected]> <[email protected]>
Sudeep Holla <[email protected]> Sudeep KarkadaNagesha <[email protected]>
Sumit Semwal <[email protected]>
Takashi YOSHII <[email protected]>
+Tamizh Chelvam Raja <[email protected]> <[email protected]>
Tejun Heo <[email protected]>
Thomas Graf <[email protected]>
Thomas Pedersen <[email protected]>
Tony Luck <[email protected]>
Tsuneo Yoshioka <[email protected]>
@@ -499,11 +585,17 @@ Uwe Kleine-König <[email protected]>
Uwe Kleine-König <[email protected]>
Uwe Kleine-König <[email protected]>
Valdis Kletnieks <[email protected]>
+Varadarajan Narayanan <[email protected]> <[email protected]>
+Vasanthakumar Thiagarajan <[email protected]> <[email protected]>
Valentin Schneider <[email protected]> <[email protected]>
+Veera Sundaram Sankaran <[email protected]> <[email protected]>
+Veerabhadrarao Badiganti <[email protected]> <[email protected]>
+Venkateswara Naralasetty <[email protected]> <[email protected]>
@@ -513,11 +605,14 @@ Viresh Kumar <[email protected]> <[email protected]>

Documentation/filesystems/tmpfs.rst

View file
diff --git a/Documentation/filesystems/tmpfs.rst b/Documentation/filesystems/tmpfs.rst
index f18f46b..2cd8fa3 100644
--- a/Documentation/filesystems/tmpfs.rst
+++ b/Documentation/filesystems/tmpfs.rst
@@ -84,8 +84,6 @@ nr_inodes The maximum number of inodes for this instance. The default
is half of the number of your physical RAM pages, or (on a
machine with highmem) the number of lowmem RAM pages,
whichever is the lower.
-noswap Disables swap. Remounts must respect the original settings.
- By default swap is enabled.
========= ============================================================
These parameters accept a suffix k, m or g for kilo, mega and giga and
@@ -99,36 +97,31 @@ mount with such options, since it allows any user with write access to
use up all the memory on the machine; but enhances the scalability of
that instance in a system with many CPUs making intensive use of it.
+tmpfs blocks may be swapped out, when there is a shortage of memory.
+tmpfs has a mount option to disable its use of swap:
+
+====== ===========================================================
+noswap Disables swap. Remounts must respect the original settings.
+ By default swap is enabled.
+====== ===========================================================
+
tmpfs also supports Transparent Huge Pages which requires a kernel
configured with CONFIG_TRANSPARENT_HUGEPAGE and with huge supported for
your system (has_transparent_hugepage(), which is architecture specific).
The mount options for this are:
-====== ============================================================
-huge=0 never: disables huge pages for the mount
-huge=1 always: enables huge pages for the mount
-huge=2 within_size: only allocate huge pages if the page will be
- fully within i_size, also respect fadvise()/madvise() hints.
-huge=3 advise: only allocate huge pages if requested with
- fadvise()/madvise()
-====== ============================================================
-
-There is a sysfs file which you can also use to control system wide THP
-configuration for all tmpfs mounts, the file is:
-
-/sys/kernel/mm/transparent_hugepage/shmem_enabled
-
-This sysfs file is placed on top of THP sysfs directory and so is registered
-by THP code. It is however only used to control all tmpfs mounts with one
-single knob. Since it controls all tmpfs mounts it should only be used either
-for emergency or testing purposes. The values you can set for shmem_enabled are:
-
-== ============================================================
--1 deny: disables huge on shm_mnt and all mounts, for
- emergency use
--2 force: enables huge on shm_mnt and all mounts, w/o needing
- option, for testing
-== ============================================================
+================ ==============================================================
+huge=never Do not allocate huge pages. This is the default.
+huge=always Attempt to allocate huge page every time a new page is needed.
+huge=within_size Only allocate huge page if it will be fully within i_size.
+ Also respect madvise(2) hints.
+huge=advise Only allocate huge page if requested with madvise(2).
+================ ==============================================================
+
+See also Documentation/admin-guide/mm/transhuge.rst, which describes the
+sysfs file /sys/kernel/mm/transparent_hugepage/shmem_enabled: which can
+be used to deny huge pages on all tmpfs mounts in an emergency, or to
+force huge pages on all tmpfs mounts for testing.
tmpfs has a mount option to set the NUMA memory allocation policy for
all files in that instance (if CONFIG_NUMA is enabled) - which can be

arch/um/os-Linux/sigio.c

View file
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
index 37d60e7..9e71794 100644
--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -3,7 +3,6 @@
* Copyright (C) 2002 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com)
*/
-#include <linux/minmax.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
@@ -51,7 +50,7 @@ static struct pollfds all_sigio_fds;
static int write_sigio_thread(void *unused)
{
- struct pollfds *fds;
+ struct pollfds *fds, tmp;
struct pollfd *p;
int i, n, respond_fd;
char c;
@@ -78,7 +77,9 @@ static int write_sigio_thread(void *unused)
"write_sigio_thread : "
"read on socket failed, "
"err = %d\n", errno);
- swap(current_poll, next_poll);
+ tmp = current_poll;
+ current_poll = next_poll;
+ next_poll = tmp;
respond_fd = sigio_private[1];
}
else {

fs/proc/vmcore.c

View file
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c
index cb80a77..1fb213f 100644
--- a/fs/proc/vmcore.c
+++ b/fs/proc/vmcore.c
@@ -132,7 +132,7 @@ ssize_t read_from_oldmem(struct iov_iter *iter, size_t count,
u64 *ppos, bool encrypted)
{
unsigned long pfn, offset;
- size_t nr_bytes;
+ ssize_t nr_bytes;
ssize_t read = 0, tmp;
int idx;

include/linux/mm.h

View file
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 2dd73e4..406ab9e 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -641,8 +641,14 @@ static inline void vma_numab_state_free(struct vm_area_struct *vma) {}
*/
static inline bool vma_start_read(struct vm_area_struct *vma)
{
- /* Check before locking. A race might cause false locked result. */
- if (vma->vm_lock_seq == READ_ONCE(vma->vm_mm->mm_lock_seq))
+ /*
+ * Check before locking. A race might cause false locked result.
+ * We can use READ_ONCE() for the mm_lock_seq here, and don't need
+ * ACQUIRE semantics, because this is just a lockless check whose result
+ * we don't rely on for anything - the mm_lock_seq read against which we
+ * need ordering is below.
+ */
+ if (READ_ONCE(vma->vm_lock_seq) == READ_ONCE(vma->vm_mm->mm_lock_seq))
return false;
if (unlikely(down_read_trylock(&vma->vm_lock->lock) == 0))
@@ -653,8 +659,13 @@ static inline bool vma_start_read(struct vm_area_struct *vma)
* False unlocked result is impossible because we modify and check
* vma->vm_lock_seq under vma->vm_lock protection and mm->mm_lock_seq
* modification invalidates all existing locks.
+ *
+ * We must use ACQUIRE semantics for the mm_lock_seq so that if we are
+ * racing with vma_end_write_all(), we only start reading from the VMA
+ * after it has been unlocked.
+ * This pairs with RELEASE semantics in vma_end_write_all().
*/
- if (unlikely(vma->vm_lock_seq == READ_ONCE(vma->vm_mm->mm_lock_seq))) {
+ if (unlikely(vma->vm_lock_seq == smp_load_acquire(&vma->vm_mm->mm_lock_seq))) {
up_read(&vma->vm_lock->lock);
return false;
}
@@ -676,7 +687,7 @@ static bool __is_vma_write_locked(struct vm_area_struct *vma, int *mm_lock_seq)
* current task is holding mmap_write_lock, both vma->vm_lock_seq and
* mm->mm_lock_seq can't be concurrently modified.
*/
- *mm_lock_seq = READ_ONCE(vma->vm_mm->mm_lock_seq);
+ *mm_lock_seq = vma->vm_mm->mm_lock_seq;
return (vma->vm_lock_seq == *mm_lock_seq);
}
@@ -688,7 +699,13 @@ static inline void vma_start_write(struct vm_area_struct *vma)
return;
down_write(&vma->vm_lock->lock);
- vma->vm_lock_seq = mm_lock_seq;
+ /*
+ * We should use WRITE_ONCE() here because we can have concurrent reads
+ * from the early lockless pessimistic check in vma_start_read().
+ * We don't really care about the correctness of that early check, but
+ * we should use WRITE_ONCE() for cleanliness and to keep KCSAN happy.
+ */
+ WRITE_ONCE(vma->vm_lock_seq, mm_lock_seq);
up_write(&vma->vm_lock->lock);
}
@@ -702,7 +719,7 @@ static inline bool vma_try_start_write(struct vm_area_struct *vma)
if (!down_write_trylock(&vma->vm_lock->lock))
return false;
- vma->vm_lock_seq = mm_lock_seq;
+ WRITE_ONCE(vma->vm_lock_seq, mm_lock_seq);
up_write(&vma->vm_lock->lock);
return true;
}

include/linux/mm_types.h

View file
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index de10fc7..5e74ce4 100644
--- a/include/linux/mm_types.h

This diff is incomplete. Download the complete patch.

include/linux/mmap_lock.h

View file

This diff is incomplete. Download the complete patch.

mm/damon/core-test.h

View file

This diff is incomplete. Download the complete patch.

mm/memory-failure.c

View file

This diff is incomplete. Download the complete patch.

mm/mmap.c

View file

This diff is incomplete. Download the complete patch.

mm/pagewalk.c

View file

This diff is incomplete. Download the complete patch.

mm/shmem.c

View file

This diff is incomplete. Download the complete patch.

scripts/spelling.txt

View file

This diff is incomplete. Download the complete patch.