Message ID | 20210421093453.6904-1-david@redhat.com (mailing list archive) |
---|---|
Headers | show |
Series | perf/binfmt/mm: remove in-tree usage of MAP_EXECUTABLE | expand |
David Hildenbrand <david@redhat.com> writes: > Stumbling over the history of MAP_EXECUTABLE, I noticed that we still > have some in-tree users that we can get rid of. > > A good fit for the whole series could be Andrew's tree. In general this looks like a good cleanup. Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> As far as I can see we can go after MAP_DENYWRITE the same way. Today deny_write_access in open_exec is what causes -ETXTBSY when attempting to write to file that is current executing. Do you have any plans to look at that? Eric > Cc: Thomas Gleixner <tglx@linutronix.de> > Cc: Ingo Molnar <mingo@redhat.com> > Cc: Borislav Petkov <bp@alien8.de> > Cc: "H. Peter Anvin" <hpa@zytor.com> > Cc: Alexander Viro <viro@zeniv.linux.org.uk> > Cc: Peter Zijlstra <peterz@infradead.org> > Cc: Arnaldo Carvalho de Melo <acme@kernel.org> > Cc: Mark Rutland <mark.rutland@arm.com> > Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> > Cc: Jiri Olsa <jolsa@redhat.com> > Cc: Namhyung Kim <namhyung@kernel.org> > Cc: Andrew Morton <akpm@linux-foundation.org> > Cc: Kees Cook <keescook@chromium.org> > Cc: "Eric W. Biederman" <ebiederm@xmission.com> > Cc: Greg Ungerer <gerg@linux-m68k.org> > Cc: Mike Rapoport <rppt@kernel.org> > Cc: Catalin Marinas <catalin.marinas@arm.com> > Cc: Kevin Brodsky <Kevin.Brodsky@arm.com> > Cc: Michal Hocko <mhocko@suse.com> > Cc: Feng Tang <feng.tang@intel.com> > Cc: Don Zickus <dzickus@redhat.com> > Cc: x86@kernel.org > Cc: linux-fsdevel@vger.kernel.org > Cc: linux-mm@kvack.org > > David Hildenbrand (3): > perf: MAP_EXECUTABLE does not indicate VM_MAYEXEC > binfmt: remove in-tree usage of MAP_EXECUTABLE > mm: ignore MAP_EXECUTABLE in ksys_mmap_pgoff() > > arch/x86/ia32/ia32_aout.c | 4 ++-- > fs/binfmt_aout.c | 4 ++-- > fs/binfmt_elf.c | 2 +- > fs/binfmt_elf_fdpic.c | 11 ++--------- > fs/binfmt_flat.c | 2 +- > include/linux/mman.h | 2 ++ > kernel/events/core.c | 2 -- > mm/mmap.c | 2 +- > mm/nommu.c | 2 +- > 9 files changed, 12 insertions(+), 19 deletions(-)
On Wed, Apr 21, 2021 at 02:03:49PM -0500, Eric W. Biederman wrote: > David Hildenbrand <david@redhat.com> writes: > > > Stumbling over the history of MAP_EXECUTABLE, I noticed that we still > > have some in-tree users that we can get rid of. > > > > A good fit for the whole series could be Andrew's tree. > > In general this looks like a good cleanup. > > Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Yeah, the PROT_EXEC parts are the only piece with meaning in the exec allocations. Reviewed-by: Kees Cook <keescook@chromium.org> > As far as I can see we can go after MAP_DENYWRITE the same way. > Today deny_write_access in open_exec is what causes -ETXTBSY > when attempting to write to file that is current executing. Oh, interesting point. I didn't realize MAP_DENYWRITE was separate from deny_write_access(). -Kees
On 21.04.21 21:03, Eric W. Biederman wrote: > David Hildenbrand <david@redhat.com> writes: > >> Stumbling over the history of MAP_EXECUTABLE, I noticed that we still >> have some in-tree users that we can get rid of. >> >> A good fit for the whole series could be Andrew's tree. > > In general this looks like a good cleanup. > > Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> > > As far as I can see we can go after MAP_DENYWRITE the same way. > Today deny_write_access in open_exec is what causes -ETXTBSY > when attempting to write to file that is current executing. > > Do you have any plans to look at that? I did have a look and thought about ripping out MAP_DENYWRITE; I'm still in the process of connecting the pieces. Some VM_DENYWRITE e.g., in mm/khugepaged.c still gives me a headache , and I'll have to double-check whether it would be okay to just fallback on checking the actual vm->file.