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,  6 May 2019 14:36:59 +0200
From:   Christian Brauner <christian@...uner.io>
To:     torvalds@...ux-foundation.org, jannh@...gle.com,
        dhowells@...hat.com, linux-kernel@...r.kernel.org
Cc:     Christian Brauner <christian@...uner.io>
Subject: [GIT PULL] pidfd patches for v5.2-rc1

Hi Linus,

This is the promised pull request for the CLONE_PIDFD flag to the clone()
syscall in its agreed upon form:

The following changes since commit 15ade5d2e7775667cf191cf2f94327a4889f8b9d:

  Linux 5.1-rc4 (2019-04-07 14:09:59 -1000)

are available in the Git repository at:

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

for you to fetch changes up to 0786de75cbc560f779378c862b8bac16bee74d10:

  samples: show race-free pidfd metadata access (2019-05-06 13:26:37 +0200)

/* Testing */
The patches have been sitting in linux-next for quite a while.
The recent change date on two of the commits is caused by a necessary
update to Jann's mail address for the co-developed and signed-off-by lines.
No semantic changes were done!

/* Conflicts with other trees */
Please note, that the pidfd branch has two minor conflicts.  The first with
akpm-current/current. The conflict and fix for it can be found under [1].
The second with the kbuild tree. The conflict and fix for it can be found
under [2].
I'm happy to provide a fixed up tree but was told you usually prefer to do
it yourself when reasonably small.

/* Summary */
This patchset makes it possible to retrieve pidfds at process creation time
by introducing the new flag CLONE_PIDFD to the clone() system call.  Linus
originally suggested to implement this as a new flag to clone() instead of
making it a separate system call.

After a thorough review from Oleg CLONE_PIDFD returns pidfds in the
parent_tidptr argument. This means we can give back the associated pid and
the pidfd at the same time. Access to process metadata information thus
becomes rather trivial.

As has been agreed, CLONE_PIDFD creates file descriptors based on anonymous
inodes similar to the new mount api.  They are made unconditional by this
patchset as they are now needed by core kernel code (vfs, pidfd) even more
than they already were before (timerfd, signalfd, io_uring, epoll etc.).
The core patchset is rather small.  The bulky looking changelist is caused
by David's very simple changes to Kconfig to make anon inodes unconditional.

A pidfd comes with additional information in fdinfo if the kernel supports
procfs.  The fdinfo file contains the pid of the process in the callers pid
namespace in the same format as the procfs status file, i.e. "Pid:\t%d".

To remove worries about missing metadata access this patchset comes with a
sample/test program that illustrates how a combination of CLONE_PIDFD and
pidfd_send_signal() can be used to gain race-free access to process
metadata through /proc/<pid>.

Further work based on this patchset has been done by Joel.  His work makes
pidfds pollable.  It finished too late for this merge window.  I would
prefer to have it sitting in linux-next for a while and send it for
inclusion during the 5.3 merge window.

Please consider pulling these changes from the signed pidfd-v5.2-rc1 tag.

Thanks!
Christian

[1]: https://lore.kernel.org/lkml/20190423184657.3d16ba97@canb.auug.org.au/
[2]: https://lore.kernel.org/lkml/20190502183125.3b53300e@canb.auug.org.au/

----------------------------------------------------------------
pidfd patches for v5.2-rc1

----------------------------------------------------------------
Christian Brauner (3):
      clone: add CLONE_PIDFD
      signal: support CLONE_PIDFD with pidfd_send_signal
      samples: show race-free pidfd metadata access

David Howells (1):
      Make anon_inodes unconditional

 arch/arm/kvm/Kconfig           |   1 -
 arch/arm64/kvm/Kconfig         |   1 -
 arch/mips/kvm/Kconfig          |   1 -
 arch/powerpc/kvm/Kconfig       |   1 -
 arch/s390/kvm/Kconfig          |   1 -
 arch/x86/Kconfig               |   1 -
 arch/x86/kvm/Kconfig           |   1 -
 drivers/base/Kconfig           |   1 -
 drivers/char/tpm/Kconfig       |   1 -
 drivers/dma-buf/Kconfig        |   1 -
 drivers/gpio/Kconfig           |   1 -
 drivers/iio/Kconfig            |   1 -
 drivers/infiniband/Kconfig     |   1 -
 drivers/vfio/Kconfig           |   1 -
 fs/Makefile                    |   2 +-
 fs/notify/fanotify/Kconfig     |   1 -
 fs/notify/inotify/Kconfig      |   1 -
 include/linux/pid.h            |   2 +
 include/uapi/linux/sched.h     |   1 +
 init/Kconfig                   |  10 ----
 kernel/fork.c                  | 108 +++++++++++++++++++++++++++++++++++++--
 kernel/signal.c                |  12 +++--
 kernel/sys_ni.c                |   3 --
 samples/Makefile               |   2 +-
 samples/pidfd/Makefile         |   6 +++
 samples/pidfd/pidfd-metadata.c | 112 +++++++++++++++++++++++++++++++++++++++++
 26 files changed, 236 insertions(+), 38 deletions(-)
 create mode 100644 samples/pidfd/Makefile
 create mode 100644 samples/pidfd/pidfd-metadata.c

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ