Bug 202881

Summary: Double set "current->mm->start_stack = bprm->p;"?
Product: Memory Management Reporter: zoujc
Component: OtherAssignee: Andrew Morton (akpm)
Status: NEW ---    
Severity: low    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.19 Subsystem:
Regression: No Bisected commit-id:
Attachments: fs-binfmt_elfc-remove-unneeded-initialization-of-mm-start_stack

Description zoujc 2019-03-12 03:07:26 UTC
Hello, Everyone,
     "setup_arg_pages" will set "current->mm->start_stack = bprm->p;",
the code:
        ....,,
     	current->mm->start_stack = bprm->p;
	ret = expand_stack(vma, stack_base);
	if (ret)
		ret = -EFAULT;

out_unlock:
	up_write(&mm->mmap_sem);
	return ret;
        ......

In "load_elf_binary", it's double set,
        ......
	retval = setup_arg_pages(bprm, randomize_stack_top(STACK_TOP),
				 executable_stack);
	if (retval < 0)
		goto out_free_dentry;
	
	current->mm->start_stack = bprm->p;
        ......

I'm not sure if this's right. Do we have to double set start_stack?
Comment 1 Andrew Morton 2019-03-12 21:58:50 UTC
Thanks.  I agree.  I queued the below patch.
Comment 2 Andrew Morton 2019-03-12 22:00:43 UTC
Created attachment 281773 [details]
fs-binfmt_elfc-remove-unneeded-initialization-of-mm-start_stack