| Summary: | seccomp: SECCOMP_RET_ERRNO returns max 12bit errno, instead of documented 16bit | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Miroslav Vadkerti <mvadkert> | ||||
| Component: | kernel | Assignee: | Kernel Maintainer List <kernel-maint> | ||||
| Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | 23 | CC: | gansalmon, itamar, jjaburek, jonathan, kernel-maint, madhu.chinakonda, mchehab, mvadkert, pmoore | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | All | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2016-07-12 09:44:15 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Bug Depends On: | |||||||
| Bug Blocks: | 1281852 | ||||||
| Attachments: |
|
||||||
|
Description
Miroslav Vadkerti
2015-12-23 15:15:45 UTC
For reference, the kernel sets the maximum errno value (MAX_ERRNO) to 4095, see include/linux/err.h.
Up until Linux 4.0 there was a bug where seccomp would allow setting a errno value beyond MAX_ERRNO. It was fixed with the following patch:
commit 580c57f1076872ebc2427f898b927944ce170f2d
Author: Kees Cook <keescook>
Date: Tue Feb 17 13:48:00 2015 -0800
seccomp: cap SECCOMP_RET_ERRNO data to MAX_ERRNO
The value resulting from the SECCOMP_RET_DATA mask could exceed MAX_ERRNO
when setting errno during a SECCOMP_RET_ERRNO filter action. This makes
sure we have a reliable value being set, so that an invalid errno will not
be ignored by userspace.
Signed-off-by: Kees Cook <keescook>
Reported-by: Dmitry V. Levin <ldv>
Cc: Andy Lutomirski <luto>
Cc: Will Drewry <wad>
Signed-off-by: Andrew Morton <akpm>
Signed-off-by: Linus Torvalds <torvalds>
The kernel patch does not appear to be in RHEL7 as I am writing this comment.
The libseccomp library has also added an errno check with the following patch:
commit 0d287caf43792239b107ee3215b32b8bc901f9c3
Author: Paul Moore <pmoore>
Date: Sat Aug 29 20:05:19 2015 -0400
api: limit errno values to MAX_ERRNO
It turns out that userspace behaves oddly when given an errno value
greater than MAX_ERRNO, so much so that the kernel seccomp mechanism
has started blocking filters with bad errno values. Let's try to
catch the problem at rule addition time to make things easier to
spot and fix.
Signed-off-by: Paul Moore <pmoore>
The libseccomp patch is not present in any released versions of the library but will be included in the next release.
As this seems like a end-user issue and was fixed in our test suite (using errno of <12bits), is there anything to be done on the kernel or libseccomp side? Or can we close this as NOTABUG? I do not think so .. thanks .. CLOSING AS NOTABUG (In reply to Jiri Jaburek from comment #5) > As this seems like a end-user issue and was fixed in our test suite (using > errno of <12bits), is there anything to be done on the kernel or libseccomp > side? Or can we close this as NOTABUG? |