linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Anomalous output from getpcaps(1) for process with all capabilities
@ 2019-12-15 15:43 Michael Kerrisk (man-pages)
       [not found] ` <CALQRfL7i5r1d1K3fOuwyJ0BtmrsVMC8zzdd0Z7=14n3X8QNw5g@mail.gmail.com>
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Kerrisk (man-pages) @ 2019-12-15 15:43 UTC (permalink / raw)
  To: Andrew Morgan
  Cc: Serge E. Hallyn, Andy Lutomirski, linux-security-module,
	Michael Kerrisk, ksrot

Hello Andrew,

Once upon a time (I don't remember exactly when things changed but let
us say 5 years ago), when one examined the capabilities of a process
with all capabilities, one saw something like the following nicely
compact output:

$ getpcaps 1
Capabilities for `1': =ep

Nowadays, one rather sees this (as also noticed by others [1]):

$ getpcaps 1
Capabilities for `1': =
cap_chown,cap_dac_override,cap_dac_read_search,cap_fowner,
cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,
cap_linux_immutable,cap_net_bind_service,cap_net_broadcast,
cap_net_admin,cap_net_raw,cap_ipc_lock,cap_ipc_owner,
cap_sys_module,cap_sys_rawio,cap_sys_chroot,cap_sys_ptrace,
cap_sys_pacct,cap_sys_admin,cap_sys_boot,cap_sys_nice,
cap_sys_resource,cap_sys_time,cap_sys_tty_config,cap_mknod,
cap_lease,cap_audit_write,cap_audit_control,cap_setfcap,
cap_mac_override,cap_mac_admin,cap_syslog,cap_wake_alarm,
cap_block_suspend,cap_audit_read+ep

The latter of course is much harder to read.

This all the more perplexing when compared to the folowing:

$ setcap =ep myprog
$ getcap myprog
prog =ep

Looking more closely, there is a difference in the respective
capability sets. For the process show above, the effective and
permitted capability have precisely the 38 current capabilities
available. By contrast, inspecting the security.capability attribute
of 'myprog' show a permitted set that has all 64 bits sets. So this
explains why there is a difference in the output of getpcaps and
getcap above.

I'm not sure where the behavior change originated. cap_to_text() has
seen no change between 2008 and 2017, AFAIK, but surely it is there
that some bit parsing logic needs to be fixed. Do you have any
thoughts?

Thanks,

Michael

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1432878
-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

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

end of thread, other threads:[~2019-12-23 19:20 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-15 15:43 Anomalous output from getpcaps(1) for process with all capabilities Michael Kerrisk (man-pages)
     [not found] ` <CALQRfL7i5r1d1K3fOuwyJ0BtmrsVMC8zzdd0Z7=14n3X8QNw5g@mail.gmail.com>
2019-12-15 18:35   ` Andrew G. Morgan
2019-12-15 19:17   ` Michael Kerrisk (man-pages)
2019-12-15 23:26     ` Andrew G. Morgan
2019-12-16  4:52       ` Michael Kerrisk (man-pages)
2019-12-16  5:10         ` Michael Kerrisk (man-pages)
     [not found]         ` <CALQRfL4_kVKX=qJ0nDnEGgVeUHtQG5BDTCX72KfZr0toc-Mpuw@mail.gmail.com>
2019-12-21  3:08           ` Serge E. Hallyn
2019-12-21  3:27             ` Andrew G. Morgan
2019-12-21  4:36               ` Serge E. Hallyn
2019-12-22 18:00                 ` Andrew G. Morgan
2019-12-22 23:36                   ` Andrew G. Morgan
2019-12-23 18:05                     ` Serge E. Hallyn
     [not found]                       ` <CALQRfL6yKpXmpnuapJhBxso7ZyXxpw6uiAMu4S4m_DBkwv3FXA@mail.gmail.com>
2019-12-23 19:20                         ` Serge E. Hallyn
2019-12-23 19:14                   ` Serge E. Hallyn

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).