• R/O
  • HTTP
  • SSH
  • HTTPS

linux-2.4.36: コミット

2.4.36-stable kernel tree


コミットメタ情報

リビジョン5f81c2baacdb36638446d1356beb4ce4e13baedb (tree)
日時2006-09-29 07:07:16
作者PaX Team <pageexec@free...>
コミッターWilly Tarreau

ログメッセージ

[PATCH] MIPS: fix long long cast in pte macro

From PaX Team :
the current idiom used for initializing a structure of two unsigned longs
from unsigned long long is wrong, it effectively loses the upper 32 bits
which in this particular case could turn a non-executable PTE into an
executable one on NX capable i386 (i.e., it's a potential security bug).
fortunately the in-tree users in 2.4 (drivers/char/drm-4.0/ffb_drv.c
and arch/mips/baget/baget.c) are not affected.

From Ralf Baechle :
I need a slight change to get this to build without warning for MIPS.
The argument passed to pte() might be just a 32-bit int, so >> 32 will
upset gcc big time. I believe the same problem exists for i386, so
here's the patch with the necessary cast for both architectures.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

変更サマリ

差分

--- a/include/asm-i386/page.h
+++ b/include/asm-i386/page.h
@@ -41,11 +41,13 @@ typedef struct { unsigned long pte_low, pte_high; } pte_t;
4141 typedef struct { unsigned long long pmd; } pmd_t;
4242 typedef struct { unsigned long long pgd; } pgd_t;
4343 #define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
44+#define __pte(x) ({ pte_t __pte = {(x), ((unsigned long long)(x)) >> 32}; __pte; })
4445 #else
4546 typedef struct { unsigned long pte_low; } pte_t;
4647 typedef struct { unsigned long pmd; } pmd_t;
4748 typedef struct { unsigned long pgd; } pgd_t;
4849 #define pte_val(x) ((x).pte_low)
50+#define __pte(x) ((pte_t) { (x) } )
4951 #endif
5052 #define PTE_MASK PAGE_MASK
5153
@@ -55,7 +57,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
5557 #define pgd_val(x) ((x).pgd)
5658 #define pgprot_val(x) ((x).pgprot)
5759
58-#define __pte(x) ((pte_t) { (x) } )
5960 #define __pmd(x) ((pmd_t) { (x) } )
6061 #define __pgd(x) ((pgd_t) { (x) } )
6162 #define __pgprot(x) ((pgprot_t) { (x) } )
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -77,13 +77,16 @@ static inline void copy_user_page(void * to, void * from, unsigned long vaddr)
7777 #ifdef CONFIG_CPU_MIPS32
7878 typedef struct { unsigned long pte_low, pte_high; } pte_t;
7979 #define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
80+ #define __pte(x) ({ pte_t __pte = {(x), ((unsigned long long)(x)) >> 32}; __pte; })
8081 #else
8182 typedef struct { unsigned long long pte_low; } pte_t;
8283 #define pte_val(x) ((x).pte_low)
84+ #define __pte(x) ((pte_t) { (x) } )
8385 #endif
8486 #else
8587 typedef struct { unsigned long pte_low; } pte_t;
8688 #define pte_val(x) ((x).pte_low)
89+#define __pte(x) ((pte_t) { (x) } )
8790 #endif
8891
8992 typedef struct { unsigned long pmd; } pmd_t;
@@ -96,7 +99,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
9699
97100 #define ptep_buddy(x) ((pte_t *)((unsigned long)(x) ^ sizeof(pte_t)))
98101
99-#define __pte(x) ((pte_t) { (x) } )
100102 #define __pmd(x) ((pmd_t) { (x) } )
101103 #define __pgd(x) ((pgd_t) { (x) } )
102104 #define __pgprot(x) ((pgprot_t) { (x) } )
旧リポジトリブラウザで表示