Bug 2004942
Summary: | Prevent executed .so files with e_entry == 0 from attempting to become a process. | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | devthomp |
Component: | kernel | Assignee: | Kernel Maintainer List <kernel-maint> |
Status: | CLOSED EOL | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 34 | CC: | acaringi, airlied, bskeggs, fweimer, gsuckevi, hdegoede, jforbes, kernel-maint, lgoncalv, linville, ptalbert, sipoyare, steved |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2022-06-07 22:46:19 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: | |
Embargoed: |
Description
devthomp
2021-09-16 13:30:34 UTC
of interest: https://bugzilla.redhat.com/show_bug.cgi?id=2004952 Some more context on this: the ELF spec states that the e_entry ELF header member, when 0, signifies that the object does not have an entry point: https://refspecs.linuxbase.org/elf/gabi4+/ch4.eheader.html What's happening currently is that the kernel relocates the entry point and then attempts to start executing at e_entry. At the moment this means the start of .text (since that's what binutils sets e_entry as if there's no _start), which ends up executing arbitrary code and crashing. However even if the object is well formed as per the spec, i.e. with "-e 0" (as in comment 0) linker option to set e_entry to 0, the kernel still relocates it and ends up trying to execute at the top of the first LOAD segment. In the general case this typically is a non-executable segment and the program crashes right away. For some DSOs (such as vdso64.so for example) however, the first LOAD segment may be executable, resulting in execution of some code before crashing. The request here is to make this case more predictable by treating e_entry == 0 as a special case like it is in the ELF spec and terminate the program right away, perhaps with a Segmentation Fault or another appropriate error. (In reply to Siddhesh Poyarekar from comment #2) > The request here is to make this case more predictable by treating e_entry > == 0 as a special case like it is in the ELF spec and terminate the program > right away, perhaps with a Segmentation Fault or another appropriate error. We have the fault today, so that wouldn't be much of an improvement. We actually have a precise error code for this defined, ELIBEXEC. (In reply to Florian Weimer from comment #4) > (In reply to Siddhesh Poyarekar from comment #2) > > The request here is to make this case more predictable by treating e_entry > > == 0 as a special case like it is in the ELF spec and terminate the program > > right away, perhaps with a Segmentation Fault or another appropriate error. > > We have the fault today, so that wouldn't be much of an improvement. We > actually have a precise error code for this defined, ELIBEXEC. Yeah, I agree a failed execve might be better. This message is a reminder that Fedora Linux 34 is nearing its end of life. Fedora will stop maintaining and issuing updates for Fedora Linux 34 on 2022-06-07. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a 'version' of '34'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, change the 'version' to a later Fedora Linux version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora Linux 34 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora Linux, you are encouraged to change the 'version' to a later version prior to this bug being closed. Fedora Linux 34 entered end-of-life (EOL) status on 2022-06-07. Fedora Linux 34 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. Thank you for reporting this bug and we are sorry it could not be fixed. |