Patch "gup: avoid stack expansion warning for known-good case" has been added to the 6.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    gup: avoid stack expansion warning for known-good case

to the 6.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     gup-avoid-stack-expansion-warning-for-known-good-case.patch
and it can be found in the queue-6.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From eee9c708cc89b4600c6e6cdda5bc2b8b4dad96cb Mon Sep 17 00:00:00 2001
From: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 29 Jun 2023 12:36:47 -0700
Subject: gup: avoid stack expansion warning for known-good case

From: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

commit eee9c708cc89b4600c6e6cdda5bc2b8b4dad96cb upstream.

In commit a425ac5365f6 ("gup: add warning if some caller would seem to
want stack expansion") I added a temporary warning to catch any strange
GUP users that would be impacted by the fact that GUP no longer extends
the stack.

But it turns out that the warning is most easily triggered through
__access_remote_vm(), that already knows to expand the stack - it just
does it *after* calling GUP.  So the warning is easy to trigger by just
running gdb (or similar) and accessing things remotely under the stack.

This just adds a temporary extra "expand stack early" to avoid the
warning for the already converted case - not because the warning is bad,
but because getting the warning for this known good case would then hide
any subsequent warnings for any actually interesting cases.

Let's try to remember to revert this change when we remove the warnings.

Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 mm/memory.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/mm/memory.c
+++ b/mm/memory.c
@@ -5721,6 +5721,10 @@ int __access_remote_vm(struct mm_struct
 			return 0;
 	}
 
+	/* Avoid triggering the temporary warning in __get_user_pages */
+	if (!vma_lookup(mm, addr) && !expand_stack(mm, addr))
+		return 0;
+
 	/* ignore errors, just check how much was successfully transferred */
 	while (len) {
 		int bytes, ret, offset;


Patches currently in stable-queue which might be from torvalds@xxxxxxxxxxxxxxxxxxxx are

queue-6.4/xtensa-fix-lock_mm_and_find_vma-in-case-vma-not-found.patch
queue-6.4/arch-arm64-mm-fault-fix-undeclared-variable-error-in-do_page_fault.patch
queue-6.4/execve-always-mark-stack-as-growing-down-during-early-stack-setup.patch
queue-6.4/gup-avoid-stack-expansion-warning-for-known-good-case.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux