Skip to content

RFC exec: Moving unshare_files_struct

Eric W. Biederman linux-fsdevel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3exec: Move unshare_files down to avoid locks being dropped on exec.fs/exec.c+8 -111 reply
2/3exec: Simplify unshare_filesfs/coredump.c fs/exec.c include/linux/fdtable.h +1 more+9 -152 replies
3/3exec: Remove reset_files_structfs/file.c include/linux/fdtable.h+0 -130 replies

Reviews trailers per patch

None of the 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchOleg NesterovJeff Layton
SeriesR-b R-b
1/3
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC][PATCH 0/3] exec: Moving unshare_files_struct

Paired with Oleg's patch to reduce the number of callers of get_files_struct it looks like we can simplify the basic idea of moving unshare_files in exec by quite a bit so that in net we have fewer lines of code.

The big simplification from Jeff's verion is that we take advantage of calling unshare_files past the point of no return. Which removes the need for cleanup, and restoring ->files. Which removes the need for blocking clone and unshare.

Oleg's patch to remove get_files_struct from proc means we don't need two counts in files_struct.

Which leaves us with the question of what are the races in fs/exec.c with respect to accessing files. Semantically I don't think we care but we do need to be certain the implementation of exec is still robust.

These patches are still rough and ready and only compile tested but I believe they demonstrate what is possible.

Eric W. Biederman (3):
exec: Move unshare_files down to avoid locks being dropped on exec.
exec: Simplify unshare_files
exec: Remove reset_files_struct

 fs/coredump.c           |  5 +----
 fs/exec.c               | 16 +++++-----------
 fs/file.c               | 12 ------------
 include/linux/fdtable.h |  3 +--
 kernel/fork.c           | 12 ++++++------
 5 files changed, 13 insertions(+), 35 deletions(-)

Eric