Bug 437312 (CVE-2008-1367)
Summary: | CVE-2008-1367 Kernel doesn't clear DF for signal handlers | ||||||
---|---|---|---|---|---|---|---|
Product: | [Other] Security Response | Reporter: | Jan Lieskovsky <jlieskov> | ||||
Component: | vulnerability | Assignee: | Red Hat Product Security <security-response-team> | ||||
Status: | CLOSED ERRATA | QA Contact: | |||||
Severity: | low | Docs Contact: | |||||
Priority: | low | ||||||
Version: | unspecified | CC: | anton, dhoward, jakub, jbaron, kreilly, mingo, qcai | ||||
Target Milestone: | --- | Keywords: | Security | ||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2010-12-23 16:45:19 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Bug Depends On: | 436131, 437313, 437314, 437315, 437316 | ||||||
Bug Blocks: | |||||||
Attachments: |
|
Description
Jan Lieskovsky
2008-03-13 15:03:34 UTC
Additional comment from BZ#436131: The debian folks reported that kernel doesn't ensure direction flag is cleared upon entry to signal handler, which violates both i?86 and x86_64 ABIs. Old GCCs conservatively used cld anyway before using any instructions that use that flag, but GCC 4.3 no longer does that, it relies on the ABI guarantees that on entry to a function the direction flag must be cleared. See http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00276.html Anything that uses std instruction must cld again before calling another function or before returning from function. Unfortunately, if async signal is sent while a thread has std flag set, kernel will start a signal handler with DF flag set. The fix is addition of regs->eflags &= ~X86_EFLAGS_DF; or similar in setup_frame/setup_rt_frame (i386, x86_64, x86_64 32-bit support). While only code compiled with GCC 4.3 and later will be affected by this bug, RHEL5 kernels are often used with later Fedora userland (e.g. koji buildboxes), so IMHO if at all possible to fix should be backported to RHEL5.2 and perhaps even RHEL4.7 kernels. Created attachment 297943 [details]
Testcase for finding out the value of the DF flag.
Comments from Jason Baron and reply from Jakub Jelinek describing the current behaviour and the nature of the bug: <cite jbaron> Whenever i run the test case (sending SIGUSR1 to the test process), i get: 'DF = 1'. indicating that the the df flag is set...I expected it to be unset b/c from reading this gcc clears the df flags...i've tried older distros and compat-gcc and still i get DF = 1...what am i missing? thanks. </cite> <cite jakub> If you get DF = 1, then that means the kernel is buggy. The psABI says that the DF flag must be clear upon entry to a function and also on exit from function. GCC <= 4.2.x would add cld just in case, whenever it used some string instruction (movs*/stos*/loads*/cmps* etc.), GCC 4.3.0 relies on the ABI guarantee. As GCC itself never issues std insn, it is just inline or out-of-line assembly which has to reset cld after it did std (AFAIK all such assembly I saw does that), the kernel has to start a process with cleared DF flag (also done) and the kernel signal handler needs to clear it for the signal handler (this is the bug). </cite> Valid link to upstream kernel commit: http://marc.info/?l=git-commits-head&m=120492000901739&w=2 And the following one: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e40cd10ccff3d9fbffd57b93780bee4b7b9bff51 Hi Jan, Can you post the rhel3 committed patch for clarification? I see some usage of the DF flag but it's unlike the upstream version. This was addressed via: Red Hat Enterprise Linux version 3 (RHSA-2008:0211) Red Hat Enterprise Linux version 5 (RHSA-2008:0233) Red Hat Enterprise Linux version 4 (RHSA-2008:0508) |