lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon,  8 Jul 2019 15:54:23 +0200
From:   Christian Brauner <christian@...uner.io>
To:     torvalds@...ux-foundation.org
Cc:     joel@...lfernandes.org, linux-kernel@...r.kernel.org,
        kernel-team@...roid.com
Subject: [GIT PULL] pidfd updates for v5.3

Hi Linus,

This pull request adds support for pidfd polling and the pidfd_open()
syscall to support retrieving pidfds for processes created without
CLONE_PIDFD.

The following changes since commit a188339ca5a396acc588e5851ed7e19f66b0ebd9:

  Linux 5.2-rc1 (2019-05-19 15:47:09 -0700)

are available in the Git repository at:

  git@...olite.kernel.org:pub/scm/linux/kernel/git/brauner/linux tags/pidfd-updates-v5.3

for you to fetch changes up to 172bb24a4f480c180bee646f6616f714ac4bcab2:

  tests: add pidfd_open() tests (2019-06-28 12:17:55 +0200)

/* Summary */
With this tag come two main features.

First, it adds polling support for pidfds. This allows process managers to
know when a (non-parent) process dies in a race-free way. The nofitication
mechanism used follows the same logic that is currently used when the
parent of a task is notified of a child's death.
With this patchset it is possible to put pidfds in an {e}poll loop and get
reliable notifications for process (i.e. thread-group) exit.

The second feature compliments the first one by making it possible to
retrieve pollable pidfds for processes that were not created using
CLONE_PIDFD.
A lot of processes get created with traditional PID-based calls such as
fork() or clone() (without CLONE_PIDFD). For these processes a caller can
currently not create a pollable pidfd. This is a problem for Android's low
memory killer (LMK) and service managers such as systemd.

Both patchsets are accompanied by selftests.

/* Testing */
All patches are based on v5.2-rc1 and have been sitting in linux-next since
then and have not caused any failures or warnings.

/* Conflicts with v5.2 */
A test-merge of my tree into pristine v5.2 revealed conflicts in the
following two files:
- tools/testing/selftests/pidfd/Makefile
- tools/testing/selftests/pidfd/pidfd_test.c
Fwiw, both conflicts should be trivially resolveable by just accepting all
changes introduced by this tag but I am also happy to provide a
fixed-up/rebased tree.

Note, following Al's changes in
6fd2fe494b17 (" copy_process(): don't use ksys_close() on cleanups")
the function pidfd_create() that pidfd_open() relied on got removed. I
fixed this up *without* rebasing in-tree to not break linux-next and
minimize merge conflicts with other branches. I hope that was ok to do
(The original branch does still exist at [2] for comparison.).

/* Conflicts with other trees */
Based on linux-next, I am only aware of a single trivial conflict with
Andrew's tree where a change to switch struct pid to use refcount_t
has included a new header.

/* Syscall number 434 */
pidfd_open() uses syscall number 434. I'm not aware of any other syscall
targeted for 5.3 that has chosen the same number.
The syscall required no arch-specific massaging and has hence been added to
all architectures at the same time.

/* Adoption in userspace */
Good news is that the work done so far and the work done in this branch for
pidfd_open() and polling support do already see some adoption:
- Android is in the process of backporting this work to all their LTS
  kernels (cf. [3]).
- Service managers make use of pidfd_send_signal but will need to wait
  until we enable waiting on pidfds for full adoption.
- And projects I maintain make use of both pidfd_send_signal and
  CLONE_PIDFD (cf. [4]) and will use polling support and pidfd_open() too.

/* New signing subkey */
So that there are no suprises, please note that I signed-off the tag with a
new signing key: 0x91C61BC06578DCA2
It's an ed25519 signing subkey that I moved to a Nitrokey and that's
available from the new, safer keys.openpgp.org keyserver.
Given the SKS churn I figured it might be a good idea to use a new,
dedicated kernel-only subkey instead of my general signing subkey.

Please consider pulling these changes from the signed pidfd-updates-v5.3 tag.

Thanks!
Christian

[1]: 6fd2fe494b17bf2dec37b610d23a43a72b16923a
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/log/?h=pidfd_open
[3]: https://android-review.googlesource.com/q/topic:%22pidfd+polling+support+4.9+backport%22
     https://android-review.googlesource.com/q/topic:%22pidfd+polling+support+4.14+backport%22
     https://android-review.googlesource.com/q/topic:%22pidfd+polling+support+4.19+backport%22
[4]: https://github.com/lxc/lxc/blob/aab6e3eb73c343231cdde775db938994fc6f2803/src/lxc/start.c#L1753

----------------------------------------------------------------
pidfd-updates-v5.3

----------------------------------------------------------------
Christian Brauner (3):
      pid: add pidfd_open()
      arch: wire-up pidfd_open()
      tests: add pidfd_open() tests

Joel Fernandes (Google) (2):
      pidfd: add polling support
      pidfd: add polling selftests

 arch/alpha/kernel/syscalls/syscall.tbl          |   1 +
 arch/arm/tools/syscall.tbl                      |   1 +
 arch/arm64/include/asm/unistd.h                 |   2 +-
 arch/arm64/include/asm/unistd32.h               |   2 +
 arch/ia64/kernel/syscalls/syscall.tbl           |   1 +
 arch/m68k/kernel/syscalls/syscall.tbl           |   1 +
 arch/microblaze/kernel/syscalls/syscall.tbl     |   1 +
 arch/mips/kernel/syscalls/syscall_n32.tbl       |   1 +
 arch/mips/kernel/syscalls/syscall_n64.tbl       |   1 +
 arch/mips/kernel/syscalls/syscall_o32.tbl       |   1 +
 arch/parisc/kernel/syscalls/syscall.tbl         |   1 +
 arch/powerpc/kernel/syscalls/syscall.tbl        |   1 +
 arch/s390/kernel/syscalls/syscall.tbl           |   1 +
 arch/sh/kernel/syscalls/syscall.tbl             |   1 +
 arch/sparc/kernel/syscalls/syscall.tbl          |   1 +
 arch/x86/entry/syscalls/syscall_32.tbl          |   1 +
 arch/x86/entry/syscalls/syscall_64.tbl          |   1 +
 arch/xtensa/kernel/syscalls/syscall.tbl         |   1 +
 include/linux/pid.h                             |   3 +
 include/linux/syscalls.h                        |   1 +
 include/uapi/asm-generic/unistd.h               |   4 +-
 kernel/fork.c                                   |  26 +++
 kernel/pid.c                                    |  71 +++++++
 kernel/signal.c                                 |  11 ++
 tools/testing/selftests/pidfd/.gitignore        |   1 +
 tools/testing/selftests/pidfd/Makefile          |   5 +-
 tools/testing/selftests/pidfd/pidfd.h           |  57 ++++++
 tools/testing/selftests/pidfd/pidfd_open_test.c | 169 ++++++++++++++++
 tools/testing/selftests/pidfd/pidfd_test.c      | 252 ++++++++++++++++++++----
 29 files changed, 576 insertions(+), 44 deletions(-)
 create mode 100644 tools/testing/selftests/pidfd/pidfd.h
 create mode 100644 tools/testing/selftests/pidfd/pidfd_open_test.c

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ