netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next V2 0/2] send process status in SCM_PROCINFO
@ 2014-06-26 12:55 Piotr Wilczek
  2014-06-26 12:55 ` [PATCH net-next V2 1/2] lib:proc_info:add library to get process information Piotr Wilczek
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Piotr Wilczek @ 2014-06-26 12:55 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, Kyungmin Park, Juho Son, Bartlomiej Zolnierkiewicz,
	Jan Kaluza, Piotr Wilczek

Server-like processes in many cases need credentials and other
metadata of the peer, to decide if the calling process is allowed to
request a specific action, or the server just wants to log away this
type of information for auditing tasks.

The current practice to retrieve such process metadata is to look that
information up in procfs with the $PID received over SCM_CREDENTIALS.
This is sufficient for long-running tasks, but introduces a race which
cannot be worked around for short-living processes; the calling
process and all the information in /proc/$PID/ is gone before the
receiver of the socket message can look it up.

Changes introduced in this patchset can also increase performance
of such server-like processes, because current way of opening and
parsing /proc/$PID/* files is much more expensive than receiving these
metadata using SCM.

As an example, this patch set improves systemd-journald performance
by about 20%. Generally, performance improvement depends on how heavily
procfs is read the calling process.
http://comments.gmane.org/gmane.comp.sysutils.systemd.devel/19467

This patch set is split in two patches:
- the first adds library to retrive process information without
dependency on procfs.
- the second introduces a new SCM type called SCM_PROCINFO to optionally
allow the direct attaching of process status to SCM.

This patchset is reworked version of:
https://lkml.org/lkml/2014/1/13/42

Changes for v2:
 - new patch with new proc info library
 - removed extern declaration
 - removed duplication code for parsing process information

Piotr Wilczek (2):
  lib:proc_info:add library to get process information
  Send process status in SCM_PROCINFO

 arch/alpha/include/uapi/asm/socket.h   |   2 +
 arch/avr32/include/uapi/asm/socket.h   |   2 +
 arch/cris/include/uapi/asm/socket.h    |   2 +
 arch/frv/include/uapi/asm/socket.h     |   2 +
 arch/ia64/include/uapi/asm/socket.h    |   2 +
 arch/m32r/include/uapi/asm/socket.h    |   2 +
 arch/mips/include/uapi/asm/socket.h    |   2 +
 arch/mn10300/include/uapi/asm/socket.h |   2 +
 arch/parisc/include/uapi/asm/socket.h  |   2 +
 arch/powerpc/include/uapi/asm/socket.h |   2 +
 arch/s390/include/uapi/asm/socket.h    |   2 +
 arch/sparc/include/uapi/asm/socket.h   |   2 +
 fs/proc/Kconfig                        |   1 +
 fs/proc/array.c                        | 476 +----------------------
 fs/proc/task_mmu.c                     |  66 ----
 fs/proc/task_nommu.c                   | 114 ------
 include/linux/net.h                    |   1 +
 include/linux/proc_info.h              |  35 ++
 include/linux/socket.h                 |   2 +
 include/net/af_unix.h                  |   9 +
 include/net/scm.h                      |  33 ++
 include/uapi/asm-generic/socket.h      |   2 +
 lib/Kconfig                            |   5 +
 lib/Makefile                           |   2 +
 lib/proc_info.c                        | 686 +++++++++++++++++++++++++++++++++
 net/Kconfig                            |   1 +
 net/core/scm.c                         | 166 ++++++++
 net/core/sock.c                        |  11 +
 net/unix/af_unix.c                     |  70 ++++
 29 files changed, 1057 insertions(+), 647 deletions(-)
 create mode 100644 include/linux/proc_info.h
 create mode 100644 lib/proc_info.c

-- 
1.9.1

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2014-07-23 20:49 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-26 12:55 [PATCH net-next V2 0/2] send process status in SCM_PROCINFO Piotr Wilczek
2014-06-26 12:55 ` [PATCH net-next V2 1/2] lib:proc_info:add library to get process information Piotr Wilczek
2014-06-26 12:55 ` [PATCH net-next V2 2/2] Send process status in SCM_PROCINFO Piotr Wilczek
2014-07-01 23:31 ` [PATCH net-next V2 0/2] send " David Miller
2014-07-01 23:52   ` Andy Lutomirski
2014-07-03  6:00     ` Piotr Wilczek
2014-07-03 16:14       ` Andy Lutomirski
2014-07-04 13:26         ` Bartlomiej Zolnierkiewicz
2014-07-04 15:15           ` Andy Lutomirski
2014-07-04 16:55             ` Bartlomiej Zolnierkiewicz
2014-07-04 17:07               ` Andy Lutomirski
2014-07-04 17:58                 ` Bartlomiej Zolnierkiewicz
2014-07-04 19:53                   ` Andy Lutomirski
2014-07-14 16:43                     ` Bartlomiej Zolnierkiewicz
2014-07-14 17:05                       ` Andy Lutomirski
2014-07-21 12:59     ` Piotr Wilczek
2014-07-22 12:24     ` Piotr Wilczek
2014-07-23 20:49       ` Andy Lutomirski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).