From: Zachary Amsden Date: Tue, 16 Aug 2005 19:05:09 +0000 (-0700) Subject: [PATCH] i386 / desc_empty macro is incorrect X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=12aaa0855b39b5464db953fedf399fa91ee365ed;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [PATCH] i386 / desc_empty macro is incorrect Chuck Ebbert noticed that the desc_empty macro is incorrect. Fix it. 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. Signed-off-by: Zachary Amsden Signed-off-by: Chris Wright [ x86-64 had the same problem, and the same fix. Linus ] Signed-off-by: Linus Torvalds --- diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 5d06e6bd6ba0..d0d8b0160090 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -29,7 +29,7 @@ struct desc_struct { }; #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)) diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h index 106f666517bb..85549e656eeb 100644 --- a/include/asm-x86_64/processor.h +++ b/include/asm-x86_64/processor.h @@ -32,7 +32,7 @@ #define ID_MASK 0x00200000 #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))