linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: mtk.manpages@gmail.com, Andrew Morgan <morgan@kernel.org>
Cc: linux-security-module@vger.kernel.org
Subject: [PATCH 13/15] Manual pages: cap_get_proc.3: Update description of capsetp()
Date: Mon, 20 Jul 2020 11:13:26 +0200	[thread overview]
Message-ID: <20200720091328.290336-14-mtk.manpages@gmail.com> (raw)
In-Reply-To: <20200720091328.290336-1-mtk.manpages@gmail.com>

The details currently provided for capsetp() were current before 2008,
but ceased to be accurate with the 2008 addition of VFS file
capabilities in 2008. Update the text accordingly.

At the same time, add a subheading, a few paragraph breaks, and a few
other wording tweaks to make the description of capgetp() and capsetp()
more readable.

Signed-off-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
---
 doc/cap_get_proc.3 | 40 +++++++++++++++++++++++++++-------------
 1 file changed, 27 insertions(+), 13 deletions(-)

diff --git a/doc/cap_get_proc.3 b/doc/cap_get_proc.3
index fce8f59..40475fd 100644
--- a/doc/cap_get_proc.3
+++ b/doc/cap_get_proc.3
@@ -251,7 +251,7 @@ or,
 When linked this way, due to linker magic, libcap uses
 .BR psx_syscall "(3) and " psx_syscall6 (3)
 to perform state setting system calls.
-.PP
+.SS capgetp() and capsetp()
 The library also supports the deprecated functions:
 .PP
 .BI "int capgetp(pid_t " pid ", cap_t " cap_d );
@@ -264,14 +264,20 @@ capabilities in a pre-allocated
 .IR cap_d .
 See
 .BR cap_init ()
-for information on allocating an empty capability set. This function,
-.BR capgetp (),
-is deprecated, you should use
+for information on allocating an empty capability set. This function
+is deprecated; you should use
 .BR cap_get_pid ().
 .PP
 .BR capsetp ()
-attempts to set the capabilities of some other process(es),
-.IR pid . 
+attempts to set the capabilities of the calling porcess or of
+some other process(es),
+.IR pid .
+Note that setting capabilities of another process is only possible on older
+kernels that do not provide VFS support for setting file capabilities.
+See
+.BR capset (2)
+for information on which kernels provide such support.
+.PP
 If
 .I pid
 is positive it refers to a specific process;  if it is zero, it refers
@@ -280,29 +286,37 @@ calling process and process '1' (typically
 .BR init (8));
 other negative values refer to the
 .I \-pid
-process group.  In order to use this function, the kernel must support
+process group.
+.PP
+In order to use this function, the kernel must support
 it and the calling process must have
 .B CAP_SETPCAP
 raised in its Effective capability set. The capabilities set in the
 target process(es) are those contained in
 .IR cap_d .
+.PP
 Kernels that support filesystem capabilities redefine the semantics of
 .B CAP_SETPCAP
-and on such systems this function will always fail for any target not
+and on such systems,
+.BR capsetp ()
+will always fail for any target not
 equal to the calling process.
 .BR capsetp ()
 returns zero for success, and \-1 on failure.
-
-Where supported by the kernel, the function
+.PP
+On kernels where it is (was) supported,
 .BR capsetp ()
 should be used with care.  It existed, primarily, to overcome an early
 lack of support for capabilities in the filesystems supported by
-Linux.  Note that, by default, the only processes that have
+Linux.  Note that on older kernels where
+.BR capsetp ()
+could be used to set the capabilities of another process,
+the only processes that had
 .B CAP_SETPCAP
-available to them are processes started as a kernel thread.
+available to them by default were processes started as kernel threads.
 (Typically this includes
 .BR init (8),
-kflushd and kswapd.) You will need to recompile the kernel to modify
+kflushd and kswapd.) A kernel recompilation was needed to modify
 this default.
 .SH EXAMPLE
 The code segment below raises the
-- 
2.26.2


  parent reply	other threads:[~2020-07-20  9:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20  9:13 [PATCH 00/15] [libcap] Manual pages: various fixes Michael Kerrisk (man-pages)
2020-07-20  9:13 ` [PATCH 01/15] Manual pages: various pages: Use "\-" for real minus signs Michael Kerrisk (man-pages)
2020-07-20  9:13 ` [PATCH 02/15] Manual pages: cap_init.3: Formatting fix Michael Kerrisk (man-pages)
2020-07-20  9:13 ` [PATCH 03/15] Manual pages: capsh.1: Various minor wording and formatting fixes Michael Kerrisk (man-pages)
2020-07-20  9:13 ` [PATCH 04/15] Manual pages: cap_copy_ext.3: Typo fix Michael Kerrisk (man-pages)
2020-07-20  9:13 ` [PATCH 05/15] Manual pages; cap_get_file.3: Fix some clumsily worded text Michael Kerrisk (man-pages)
2020-07-20  9:13 ` [PATCH 06/15] Manual pages: getcap.8: Add missing word Michael Kerrisk (man-pages)
2020-07-20  9:13 ` [PATCH 07/15] Manual pages: getcap.8: Fix a clumsily worded sentence Michael Kerrisk (man-pages)
2020-07-20  9:13 ` [PATCH 08/15] Manual pages: getpcaps.8: Format options as a hanging list Michael Kerrisk (man-pages)
2020-07-20  9:13 ` [PATCH 09/15] Manual pages: getpcaps.8: Remove a stray .br macro Michael Kerrisk (man-pages)
2020-07-20  9:13 ` [PATCH 10/15] Manual pages: getpcaps.8: SEE ALSO: fix section number for capsh Michael Kerrisk (man-pages)
2020-07-20  9:13 ` [PATCH 11/15] Manual pages: setcap.8: Typo fix Michael Kerrisk (man-pages)
2020-07-20  9:13 ` [PATCH 12/15] Manual pages: cap_get_file.3: NOTES: note the effect of the Ambient set Michael Kerrisk (man-pages)
2020-07-20 15:36   ` Andrew G. Morgan
2020-07-20 20:21     ` Michael Kerrisk (man-pages)
2020-07-20  9:13 ` Michael Kerrisk (man-pages) [this message]
2020-07-20  9:13 ` [PATCH 14/15] Manual pages: cap_get_proc.3, capsh.1: Use "UID" and "GID" consistently Michael Kerrisk (man-pages)
2020-07-20  9:13 ` [PATCH 15/15] Manual pages: capsh.1: Change .TP indent to the default Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200720091328.290336-14-mtk.manpages@gmail.com \
    --to=mtk.manpages@gmail.com \
    --cc=linux-security-module@vger.kernel.org \
    --cc=morgan@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).