Skip to contentSkip to conversation

i386 / Add some descriptor convenience functions

PATCH Chuck Ebbert 4 participants 4 messages Aug 16, 2005

lore
Share & tools
lore
#0 lore raw
Quoted 8 lines · On Wed, 10 Aug 2005 at 21:56:20 -0700, [email protected] wrote:

Patch-base: 2.6.13-rc5-mm1
Patch-keys: i386 desc cleanup

Index: linux-2.6.13/include/asm-i386/desc.h
===================================================================

include/asm-i386/desc.h 2005-08-10 20:42:03.000000000 -0700 line 19

Quoted 6 lines
include/asm-i386/desc.h 2005-08-10 20:42:03.000000000 -0700 renamed from include/asm-i386/desc.h 2005-08-09 19:43:38.000000000 -0700 +3 -0
@@ -14,6 +14,28 @@
 
 #include <asm/mmu.h>
 
+#define desc_empty(desc) \
+             (!((desc)->a + (desc)->b))
+

I think that should be "|" instead of "+".

__
Chuck

#1 lore raw
Quoted 15 lines · Chuck Ebbert
Quoted 11 lines · On Wed, 10 Aug 2005 at 21:56:20 -0700, [email protected] wrote:

Patch-base: 2.6.13-rc5-mm1
Patch-keys: i386 desc cleanup

Index: linux-2.6.13/include/asm-i386/desc.h
===================================================================

include/asm-i386/desc.h 2005-08-10 20:42:03.000000000 -0700 renamed from include/asm-i386/desc.h 2005-08-09 19:43:38.000000000 -0700 +0 -0
@@ -14,6 +14,28 @@
 
 #include <asm/mmu.h>
 
Quoted 9 lines

include/asm-i386/desc.h 2005-08-10 20:42:03.000000000 -0700 line 21

Quoted 5 lines
include/asm-i386/desc.h 2005-08-10 20:42:03.000000000 -0700 renamed from include/asm-i386/desc.h 2005-08-09 19:43:38.000000000 -0700 +3 -0
+#define desc_empty(desc) \
+             (!((desc)->a + (desc)->b))
+
 
 

I think that should be "|" instead of "+".

I think so too. I merely moved the code here and didn't notice it in all this excitement.

0x00cf9a000xff306600 =>

Present CPL-0 32-bit code segment, base 0x0000ff30, limit 0xf6601 pages, for which desc_empty(desc) is true.

Thankfully, this is not used as a security check, but it can falsely overwrite TLS segments with carefully chosen base / limits. I do not believe this is an issue in practice, but it is a kernel bug.

Nice catch. Looks like it affects all 2.6.X kernels.

Zach

Chuck Ebbert noticed that the desc_empty macro is incorrect. Fix it.

include/asm-i386/desc.h +1 -1
Index: linux-2.6.13/include/asm-i386/desc.h
===================================================================
@@ -18,7 +18,7 @@
 #include <asm/mmu.h>
 
 #define desc_empty(desc) \
-		(!((desc)->a + (desc)->b))
+		(!((desc)->a | (desc)->b))
 
 #define desc_equal(desc1, desc2) \
 		(((desc1)->a == (desc2)->a) && ((desc1)->b == (desc2)->b))
#2 lore raw

x86-64 is buggy too. I fixed it in my tree.
-Andi

#3 lore raw
In reply to Zachary Amsden
Quoted 5 lines · * Zachary Amsden ([email protected]) wrote:

I think so too. I merely moved the code here and didn't notice it in all this excitement.

0x00cf9a000xff306600 =>

Quoted 8 lines

Present CPL-0 32-bit code segment, base 0x0000ff30, limit 0xf6601 pages, for which desc_empty(desc) is true.

Thankfully, this is not used as a security check, but it can falsely overwrite TLS segments with carefully chosen base / limits. I do not believe this is an issue in practice, but it is a kernel bug.

Nice catch. Looks like it affects all 2.6.X kernels.

Thanks, I added this to virt tree, and will push baseline fix up.

thanks,
-chris