Messages in this thread | | | Date | Tue, 12 Jul 2016 19:01:45 +0200 | From | Oleg Nesterov <> | Subject | Re: [PATCH] prctl: remove one-shot limitation for changing exe link |
| |
On 07/12, Stanislav Kinsburskiy wrote: > > 12.07.2016 18:42, Oleg Nesterov пишет: >> But I would like to ack it in any case. I never understood why do we >> want/need this MMF_EXE_FILE_CHANGED check, I suggested to remove it >> many times. >> >> And can't resist, please note the xchg() below. Currently (before this >> patch) we do not need it. I was specially added to ensure that we can >> just remove this test_and_set_bit(MMF_EXE_FILE_CHANGED) without adding >> a race. > > Thanks, Oleg. I'll take a look. > But should this be addressed in this patch? Especially if it's not > needed even now (before this patch)?
Sorry for confusion...
Yes, it is not needed now (before this patch). Because only one caller of prctl_set_mm_exe_file() can succced and update mm->exe_file. So we could just do
fput(mm->exe_file); mm->exe_file = get_file(exe.file);
But after this patch we do need this xchg(), otherwise 2 callers of prctl_set_mm_exe_file() can race with each other. And this was the actual reason for xchg: simplify the MMF_EXE_FILE_CHANGED removal in future.
Oleg.
| |