[Devel] [PATCH RHEL9 COMMIT] oracle/mm: do not assume only the stack vma exists in setup_arg_pages()

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jan 23 23:35:46 MSK 2025


The commit is pushed to "branch-rh9-5.14.0-427.44.1.vz9.80.x-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh9-5.14.0-427.44.1.vz9.80.5
------>
commit 89890776e27a0234cdf455a9b792ab6c084f1824
Author: Anthony Yznaga <anthony.yznaga at oracle.com>
Date:   Tue Dec 1 11:53:59 2020 -0800

    oracle/mm: do not assume only the stack vma exists in setup_arg_pages()
    
    In preparation for allowing vmas to be preserved across exec do not
    assume that there is no prev vma to pass to mprotect_fixup() in
    setup_arg_pages().  mprotect_fixup() calls vma_merge() which expects
    a prev vma to be passed to it if one exists otherwise a VM_WARN_ON
    is triggered.
    
    Orabug: 32387875
    Signed-off-by: Anthony Yznaga <anthony.yznaga at oracle.com>
    Reviewed-by: Mike Kravetz <mike.kravetz at oracle.com>
    Reviewed-by: Liam R. Howlett <Liam.Howlett at Oracle.com>
    
    https://virtuozzo.atlassian.net/browse/VSTOR-96305
    
    (cherry picked from Oracle commit cd7f61a98a7f817236fc3d1186e54c2aa3e4f6e7)
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
    
    Feature: oracle/mm: MADV_DOEXEC madvise() flag
---
 fs/exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/exec.c b/fs/exec.c
index 0b3e0eef70a6..f109cdc4aa37 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -770,7 +770,7 @@ int setup_arg_pages(struct linux_binprm *bprm,
 	unsigned long stack_shift;
 	struct mm_struct *mm = current->mm;
 	struct vm_area_struct *vma = bprm->vma;
-	struct vm_area_struct *prev = NULL;
+	struct vm_area_struct *prev = vma->vm_prev;
 	unsigned long vm_flags;
 	unsigned long stack_base;
 	unsigned long stack_size;


More information about the Devel mailing list