Skip to contentSkip to conversation

New: execve(2) omits EACCES due to capabilities

Bug 214705 [email protected] 1 participant 3 messages Oct 13, 2021 – Oct 16, 2021 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=214705

Bug ID: 214705
Summary: execve(2) omits EACCES due to capabilities
Product: Documentation
Version: unspecified
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: man-pages
Assignee: [email protected]
Reporter: [email protected]
Regression: No

The man page for execve lists only 4 reasons the syscall can fail with errno==EACCES. In fact, there is at least one more. If the binary being executed has a setfattr'ed capability such as CAP_IPC_LOCK which is not supported in the caller's kernel namespace (docker container), execve will fail with this error.

I just spent a great deal of frustrating effort searching for a non-existent elf interpreter or mount-noexec issue because I trusted this man page.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#1 lore raw

[Bug 214705] execve(2) omits EACCES due to capabilities

https://bugzilla.kernel.org/show_bug.cgi?id=214705

Alejandro Colomar (man-pages) ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]

--- Comment #1 from Alejandro Colomar (man-pages) ([email protected]) --- Hello Daniel,

Tracking the paths that can lead to an error is difficult. Could you share the results of your investigation? I'd like to check it in the source code.

Thanks,

Alex

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#2 lore raw

[Bug 214705] execve(2) omits EACCES due to capabilities

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=214705

--- Comment #2 from Daniel Speyer ([email protected]) ---

dspeyer@dspeyerheim:~$ sudo docker run -it ubuntu /bin/bash
root@8b839371814b:/# apt-get update > /dev/null
root@8b839371814b:/# apt-get install libcap2-bin -y >/dev/null
debconf: delaying package configuration, since apt-utils is not installed
root@8b839371814b:/# setcap cap_ipc_lock=+eip  /usr/bin/ls
root@8b839371814b:/# ls
bash: /usr/bin/ls: Operation not permitted

I've confirmed with a small c program that bash is passing on execve's error message correctly, but copy pasting the c program would be inconvenient right now.

Quoted 26 lines · On Fri, Oct 15, 2021 at 6:10 PM <[email protected]> wrote:

https://bugzilla.kernel.org/show_bug.cgi?id=214705

Alejandro Colomar (man-pages) ([email protected]) changed:

What |Removed |Added

----------------------------------------------------------------------------
CC| |[email protected]

--- Comment #1 from Alejandro Colomar (man-pages) ([email protected])
---
Hello Daniel,

Tracking the paths that can lead to an error is difficult. Could you share the
results of your investigation? I'd like to check it in the source code.

Thanks,

Alex

--
You may reply to this email to add a comment.

You are receiving this mail because:
You reported the bug.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.