Bug 202881 - Double set "current->mm->start_stack = bprm->p;"?
Summary: Double set "current->mm->start_stack = bprm->p;"?
Status: NEW
Alias: None
Product: Memory Management
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 low
Assignee: Andrew Morton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-12 03:07 UTC by zoujc
Modified: 2019-03-12 22:00 UTC (History)
0 users

See Also:
Kernel Version: 4.19
Subsystem:
Regression: No
Bisected commit-id:


Attachments
fs-binfmt_elfc-remove-unneeded-initialization-of-mm-start_stack (837 bytes, patch)
2019-03-12 22:00 UTC, Andrew Morton
Details | Diff

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

Note You need to log in before you can comment on or make changes to this bug.