Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 154308 - Kernel: s390 user readable uninitialised kernel memory (CVE-2006-5174)
Summary: Kernel: s390 user readable uninitialised kernel memory (CVE-2006-5174)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Kernel (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Security
URL: http://www.kernel.org/git/?p=linux/ke...
Whiteboard: [linux <2.6.16.31] [linux >=2.6.17 <2...
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-06 22:11 UTC by Sune Kloppenborg Jeppesen (RETIRED)
Modified: 2009-07-21 17:41 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-11-06 22:11:39 UTC
A user space program can read uninitialised kernel memory
 by appending to a file from a bad address and then reading
 the result back. The cause is the copy_from_user function
 that does not clear the remaining bytes of the kernel
 buffer after it got a fault on the user space address.
Comment 1 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-11-06 22:14:38 UTC
Patch in GIT might be wrong. The one below should be correct (sorry for the formatting).

--- linux-2.6.18.1/arch/s390/lib/uaccess64.S    2006-10-17 13:26:32.000000000 +0200
+++ linux-2.6.18.1-s390/arch/s390/lib/uaccess64.S       2006-10-17 13:21:20.000000000 +0200
@@ -40,7 +40,17 @@ __copy_from_user_asm:
        # move with the reduced length which is < 256
 5:     mvcp    0(%r5,%r2),0(%r4),%r0
        slgr    %r3,%r5
-6:     lgr     %r2,%r3
+       algr    %r2,%r5
+6:     lgr     %r5,%r3         # copy remaining size
+       aghi    %r5,-1          # subtract 1 for xc loop
+       bras    %r4,8f
+       xc      0(1,%r2),0(%r2)
+7:     xc      0(256,%r2),0(%r2)
+       la      %r2,256(%r2)
+8:     aghi    %r5,-256
+       jnm     7b
+       ex      %r5,0(%r4)
+9:     lgr     %r2,%r3
        br      %r14
         .section __ex_table,"a"
        .quad   0b,4b
diff -urpN linux-2.6.18.1/arch/s390/lib/uaccess.S linux-2.6.18.1-s390/arch/s390/lib/uaccess.S
--- linux-2.6.18.1/arch/s390/lib/uaccess.S      2006-10-17 13:26:32.000000000 +0200
+++ linux-2.6.18.1-s390/arch/s390/lib/uaccess.S 2006-10-17 13:21:06.000000000 +0200
@@ -40,7 +40,17 @@ __copy_from_user_asm:
        # move with the reduced length which is < 256
 5:     mvcp    0(%r5,%r2),0(%r4),%r0
        slr     %r3,%r5
-6:     lr      %r2,%r3
+       alr     %r2,%r5
+6:     lr      %r5,%r3         # copy remaining size
+       ahi     %r5,-1          # subtract 1 for xc loop
+       bras    %r4,8f
+       xc      0(1,%r2),0(%r2)
+7:     xc      0(256,%r2),0(%r2)
+       la      %r2,256(%r2)
+8:     ahi     %r5,-256
+       jnm     7b
+       ex      %r5,0(%r4)
+9:     lr      %r2,%r3
        br      %r14
         .section __ex_table,"a"
        .long   0b,4b
Comment 2 Harlan Lieberman-Berg (RETIRED) gentoo-dev 2006-12-15 12:32:46 UTC
s390 is unsupported.