lkml.org 
[lkml]   [2018]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 1/3] exec: Move unshare_files down to avoid locks being dropped on exec.
On 09/16, Eric W. Biederman wrote:
>
> @@ -1291,6 +1292,12 @@ int flush_old_exec(struct linux_binprm * bprm)
> flush_thread();
> current->personality &= ~bprm->per_clear;
>
> + retval = unshare_files(&displaced);

I was going to sugget basically the same changes, please feel free to add
my reviewed-by to 1-3.


Just for record. If we should really worry about unshare_files() failure
after de_thread() (imo we shouldn't), we can do another change:

__do_execve_file:

unshare_fd(CLONE_FILES, &bprm->unshared_copy);
...


flush_old_exec:

de_thread();

if (bprm->unshared_copy) {
// now that we killed sub-threads recheck
if (current->files->count > 1) {
put_files_struct(current->files);
current->files = bprm->unshared_copy;
} else {
put_files_struct(bprm->unshared_copy);
}

}

but again, I think your series is fine.

Oleg.

\
 
 \ /
  Last update: 2018-09-17 17:50    [W:0.256 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site