alistair23-linux/arch/mips
Linus Torvalds 4f30a60aa7 close-range-v5.9
-----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCXygcpgAKCRCRxhvAZXjc
 ogPeAQDv1ncqtNroFAC4pJ4tQhH7JSjW0OltiMk/AocY/J2SdQD9GJ15luYJ0/om
 697q/Z68sndRynhdoZlMuf3oYuBlHQw=
 =3ZhE
 -----END PGP SIGNATURE-----

Merge tag 'close-range-v5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux

Pull close_range() implementation from Christian Brauner:
 "This adds the close_range() syscall. It allows to efficiently close a
  range of file descriptors up to all file descriptors of a calling
  task.

  This is coordinated with the FreeBSD folks which have copied our
  version of this syscall and in the meantime have already merged it in
  April 2019:

    https://reviews.freebsd.org/D21627
    https://svnweb.freebsd.org/base?view=revision&revision=359836

  The syscall originally came up in a discussion around the new mount
  API and making new file descriptor types cloexec by default. During
  this discussion, Al suggested the close_range() syscall.

  First, it helps to close all file descriptors of an exec()ing task.
  This can be done safely via (quoting Al's example from [1] verbatim):

        /* that exec is sensitive */
        unshare(CLONE_FILES);
        /* we don't want anything past stderr here */
        close_range(3, ~0U);
        execve(....);

  The code snippet above is one way of working around the problem that
  file descriptors are not cloexec by default. This is aggravated by the
  fact that we can't just switch them over without massively regressing
  userspace. For a whole class of programs having an in-kernel method of
  closing all file descriptors is very helpful (e.g. demons, service
  managers, programming language standard libraries, container managers
  etc.).

  Second, it allows userspace to avoid implementing closing all file
  descriptors by parsing through /proc/<pid>/fd/* and calling close() on
  each file descriptor and other hacks. From looking at various
  large(ish) userspace code bases this or similar patterns are very
  common in service managers, container runtimes, and programming
  language runtimes/standard libraries such as Python or Rust.

  In addition, the syscall will also work for tasks that do not have
  procfs mounted and on kernels that do not have procfs support compiled
  in. In such situations the only way to make sure that all file
  descriptors are closed is to call close() on each file descriptor up
  to UINT_MAX or RLIMIT_NOFILE, OPEN_MAX trickery.

  Based on Linus' suggestion close_range() also comes with a new flag
  CLOSE_RANGE_UNSHARE to more elegantly handle file descriptor dropping
  right before exec. This would usually be expressed in the sequence:

        unshare(CLONE_FILES);
        close_range(3, ~0U);

  as pointed out by Linus it might be desirable to have this be a part
  of close_range() itself under a new flag CLOSE_RANGE_UNSHARE which
  gets especially handy when we're closing all file descriptors above a
  certain threshold.

  Test-suite as always included"

* tag 'close-range-v5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux:
  tests: add CLOSE_RANGE_UNSHARE tests
  close_range: add CLOSE_RANGE_UNSHARE
  tests: add close_range() tests
  arch: wire-up close_range()
  open: add close_range()
2020-08-04 15:12:02 -07:00
..
alchemy
ar7
ath25
ath79
bcm47xx
bcm63xx
bmips
boot MIPS: ingenic: gcw0: Fix HP detection GPIO. 2020-06-25 10:18:22 +02:00
cavium-octeon
cobalt
configs
crypto
dec
fw mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
generic
include seccomp updates for v5.9-rc1 2020-08-04 14:11:08 -07:00
jazz mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
jz4740
kernel close-range-v5.9 2020-08-04 15:12:02 -07:00
kvm KVM: MIPS: Fix build errors for 32bit kernel 2020-07-10 06:15:38 -04:00
lantiq MIPS: lantiq: xway: sysctrl: fix the GPHY clock alias names 2020-06-15 13:14:51 +02:00
lib treewide: Remove uninitialized_var() usage 2020-07-16 12:35:15 -07:00
loongson2ef
loongson32
loongson64 Merge branch 'akpm' (patches from Andrew) 2020-06-03 20:24:15 -07:00
math-emu
mm treewide: Remove uninitialized_var() usage 2020-07-16 12:35:15 -07:00
mti-malta
net
netlogic
oprofile
paravirt
pci irqdomain/treewide: Free firmware node after domain removal 2020-07-23 00:08:52 +02:00
pic32
pistachio
pnx833x
power
ralink This time around we have 4 lines of diff in the core framework, removing a 2020-06-10 11:42:19 -07:00
rb532
sgi-ip22
sgi-ip27 mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
sgi-ip30
sgi-ip32 mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
sibyte
sni
tools
txx9
vdso
vr41xx
Kbuild
Kbuild.platforms
Kconfig arch: remove HAVE_COPY_THREAD_TLS 2020-07-04 23:41:37 +02:00
Kconfig.debug
Makefile
Makefile.postlink