SOURCES (Titanium): linux-2.6-grsecurity.patch (NEW) - from http:/...
hawk
hawk at pld-linux.org
Sat Nov 10 22:26:34 CET 2007
Author: hawk Date: Sat Nov 10 21:26:34 2007 GMT
Module: SOURCES Tag: Titanium
---- Log message:
- from http://www.grsecurity.net/~spender/grsecurity-2.1.11-2.6.23.1-200710311914.patch
with localversion killed
---- Files affected:
SOURCES:
linux-2.6-grsecurity.patch (NONE -> 1.1.2.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/linux-2.6-grsecurity.patch
diff -u /dev/null SOURCES/linux-2.6-grsecurity.patch:1.1.2.1
--- /dev/null Sat Nov 10 22:26:34 2007
+++ SOURCES/linux-2.6-grsecurity.patch Sat Nov 10 22:26:28 2007
@@ -0,0 +1,35267 @@
+diff -urNp linux-2.6.23.1/arch/alpha/kernel/module.c linux-2.6.23.1/arch/alpha/kernel/module.c
+--- linux-2.6.23.1/arch/alpha/kernel/module.c 2007-10-12 12:43:44.000000000 -0400
++++ linux-2.6.23.1/arch/alpha/kernel/module.c 2007-10-30 18:10:07.000000000 -0400
+@@ -176,7 +176,7 @@ apply_relocate_add(Elf64_Shdr *sechdrs,
+
+ /* The small sections were sorted to the end of the segment.
+ The following should definitely cover them. */
+- gp = (u64)me->module_core + me->core_size - 0x8000;
++ gp = (u64)me->module_core_rw + me->core_size_rw - 0x8000;
+ got = sechdrs[me->arch.gotsecindex].sh_addr;
+
+ for (i = 0; i < n; i++) {
+diff -urNp linux-2.6.23.1/arch/alpha/kernel/osf_sys.c linux-2.6.23.1/arch/alpha/kernel/osf_sys.c
+--- linux-2.6.23.1/arch/alpha/kernel/osf_sys.c 2007-10-12 12:43:44.000000000 -0400
++++ linux-2.6.23.1/arch/alpha/kernel/osf_sys.c 2007-10-30 18:10:07.000000000 -0400
+@@ -1288,6 +1288,10 @@ arch_get_unmapped_area(struct file *filp
+ merely specific addresses, but regions of memory -- perhaps
+ this feature should be incorporated into all ports? */
+
++#ifdef CONFIG_PAX_RANDMMAP
++ if (!(current->mm->pax_flags & MF_PAX_RANDMMAP) || !filp)
++#endif
++
+ if (addr) {
+ addr = arch_get_unmapped_area_1 (PAGE_ALIGN(addr), len, limit);
+ if (addr != (unsigned long) -ENOMEM)
+@@ -1295,8 +1299,8 @@ arch_get_unmapped_area(struct file *filp
+ }
+
+ /* Next, try allocating at TASK_UNMAPPED_BASE. */
+- addr = arch_get_unmapped_area_1 (PAGE_ALIGN(TASK_UNMAPPED_BASE),
+- len, limit);
++ addr = arch_get_unmapped_area_1 (PAGE_ALIGN(current->mm->mmap_base), len, limit);
++
+ if (addr != (unsigned long) -ENOMEM)
+ return addr;
+
+diff -urNp linux-2.6.23.1/arch/alpha/kernel/ptrace.c linux-2.6.23.1/arch/alpha/kernel/ptrace.c
+--- linux-2.6.23.1/arch/alpha/kernel/ptrace.c 2007-10-12 12:43:44.000000000 -0400
++++ linux-2.6.23.1/arch/alpha/kernel/ptrace.c 2007-10-30 18:10:07.000000000 -0400
+@@ -15,6 +15,7 @@
+ #include <linux/slab.h>
+ #include <linux/security.h>
+ #include <linux/signal.h>
++#include <linux/grsecurity.h>
+
+ #include <asm/uaccess.h>
+ #include <asm/pgtable.h>
+@@ -283,6 +284,11 @@ do_sys_ptrace(long request, long pid, lo
+ goto out_notsk;
+ }
+
++ if (gr_handle_ptrace(child, request)) {
++ ret = -EPERM;
++ goto out;
++ }
++
+ if (request == PTRACE_ATTACH) {
+ ret = ptrace_attach(child);
+ goto out;
+diff -urNp linux-2.6.23.1/arch/alpha/mm/fault.c linux-2.6.23.1/arch/alpha/mm/fault.c
+--- linux-2.6.23.1/arch/alpha/mm/fault.c 2007-10-12 12:43:44.000000000 -0400
++++ linux-2.6.23.1/arch/alpha/mm/fault.c 2007-10-30 18:10:07.000000000 -0400
+@@ -23,6 +23,7 @@
+ #include <linux/smp.h>
+ #include <linux/interrupt.h>
+ #include <linux/module.h>
++#include <linux/binfmts.h>
+
+ #include <asm/system.h>
+ #include <asm/uaccess.h>
+@@ -54,6 +55,124 @@ __load_new_mm_context(struct mm_struct *
+ __reload_thread(pcb);
+ }
+
++#ifdef CONFIG_PAX_PAGEEXEC
++/*
++ * PaX: decide what to do with offenders (regs->pc = fault address)
++ *
++ * returns 1 when task should be killed
++ * 2 when patched PLT trampoline was detected
++ * 3 when unpatched PLT trampoline was detected
++ */
++static int pax_handle_fetch_fault(struct pt_regs *regs)
++{
++
++#ifdef CONFIG_PAX_EMUPLT
++ int err;
++
++ do { /* PaX: patched PLT emulation #1 */
++ unsigned int ldah, ldq, jmp;
++
++ err = get_user(ldah, (unsigned int *)regs->pc);
++ err |= get_user(ldq, (unsigned int *)(regs->pc+4));
++ err |= get_user(jmp, (unsigned int *)(regs->pc+8));
++
++ if (err)
++ break;
++
++ if ((ldah & 0xFFFF0000U) == 0x277B0000U &&
++ (ldq & 0xFFFF0000U) == 0xA77B0000U &&
++ jmp == 0x6BFB0000U)
++ {
++ unsigned long r27, addr;
++ unsigned long addrh = (ldah | 0xFFFFFFFFFFFF0000UL) << 16;
++ unsigned long addrl = ldq | 0xFFFFFFFFFFFF0000UL;
++
++ addr = regs->r27 + ((addrh ^ 0x80000000UL) + 0x80000000UL) + ((addrl ^ 0x8000UL) + 0x8000UL);
++ err = get_user(r27, (unsigned long *)addr);
++ if (err)
++ break;
++
++ regs->r27 = r27;
++ regs->pc = r27;
++ return 2;
++ }
++ } while (0);
++
++ do { /* PaX: patched PLT emulation #2 */
++ unsigned int ldah, lda, br;
++
++ err = get_user(ldah, (unsigned int *)regs->pc);
++ err |= get_user(lda, (unsigned int *)(regs->pc+4));
++ err |= get_user(br, (unsigned int *)(regs->pc+8));
++
++ if (err)
++ break;
++
++ if ((ldah & 0xFFFF0000U) == 0x277B0000U &&
++ (lda & 0xFFFF0000U) == 0xA77B0000U &&
++ (br & 0xFFE00000U) == 0xC3E00000U)
++ {
++ unsigned long addr = br | 0xFFFFFFFFFFE00000UL;
++ unsigned long addrh = (ldah | 0xFFFFFFFFFFFF0000UL) << 16;
++ unsigned long addrl = lda | 0xFFFFFFFFFFFF0000UL;
++
++ regs->r27 += ((addrh ^ 0x80000000UL) + 0x80000000UL) + ((addrl ^ 0x8000UL) + 0x8000UL);
++ regs->pc += 12 + (((addr ^ 0x00100000UL) + 0x00100000UL) << 2);
++ return 2;
++ }
++ } while (0);
++
++ do { /* PaX: unpatched PLT emulation */
++ unsigned int br;
++
++ err = get_user(br, (unsigned int *)regs->pc);
++
++ if (!err && (br & 0xFFE00000U) == 0xC3800000U) {
++ unsigned int br2, ldq, nop, jmp;
++ unsigned long addr = br | 0xFFFFFFFFFFE00000UL, resolver;
++
++ addr = regs->pc + 4 + (((addr ^ 0x00100000UL) + 0x00100000UL) << 2);
++ err = get_user(br2, (unsigned int *)addr);
++ err |= get_user(ldq, (unsigned int *)(addr+4));
++ err |= get_user(nop, (unsigned int *)(addr+8));
++ err |= get_user(jmp, (unsigned int *)(addr+12));
++ err |= get_user(resolver, (unsigned long *)(addr+16));
++
++ if (err)
++ break;
++
++ if (br2 == 0xC3600000U &&
++ ldq == 0xA77B000CU &&
++ nop == 0x47FF041FU &&
++ jmp == 0x6B7B0000U)
++ {
++ regs->r28 = regs->pc+4;
++ regs->r27 = addr+16;
++ regs->pc = resolver;
++ return 3;
++ }
++ }
++ } while (0);
++#endif
++
++ return 1;
++}
++
++void pax_report_insns(void *pc, void *sp)
++{
++ unsigned long i;
++
++ printk(KERN_ERR "PAX: bytes at PC: ");
++ for (i = 0; i < 5; i++) {
++ unsigned int c;
++ if (get_user(c, (unsigned int *)pc+i))
++ printk("???????? ");
++ else
++ printk("%08x ", c);
++ }
++ printk("\n");
++}
++#endif
+
+ /*
+ * This routine handles page faults. It determines the address,
+@@ -131,8 +250,29 @@ do_page_fault(unsigned long address, uns
+ good_area:
+ si_code = SEGV_ACCERR;
+ if (cause < 0) {
+- if (!(vma->vm_flags & VM_EXEC))
++ if (!(vma->vm_flags & VM_EXEC)) {
++
++#ifdef CONFIG_PAX_PAGEEXEC
++ if (!(mm->pax_flags & MF_PAX_PAGEEXEC) || address != regs->pc)
++ goto bad_area;
++
++ up_read(&mm->mmap_sem);
++ switch (pax_handle_fetch_fault(regs)) {
++
++#ifdef CONFIG_PAX_EMUPLT
++ case 2:
++ case 3:
++ return;
++#endif
++
++ }
++ pax_report_fault(regs, (void *)regs->pc, (void *)rdusp());
++ do_exit(SIGKILL);
++#else
+ goto bad_area;
++#endif
++
++ }
+ } else if (!cause) {
+ /* Allow reads even for write-only mappings */
+ if (!(vma->vm_flags & (VM_READ | VM_WRITE)))
+diff -urNp linux-2.6.23.1/arch/arm/mm/mmap.c linux-2.6.23.1/arch/arm/mm/mmap.c
+--- linux-2.6.23.1/arch/arm/mm/mmap.c 2007-10-12 12:43:44.000000000 -0400
++++ linux-2.6.23.1/arch/arm/mm/mmap.c 2007-10-30 18:10:07.000000000 -0400
+@@ -60,6 +60,10 @@ arch_get_unmapped_area(struct file *filp
+ if (len > TASK_SIZE)
+ return -ENOMEM;
+
++#ifdef CONFIG_PAX_RANDMMAP
++ if (!(mm->pax_flags & MF_PAX_RANDMMAP) || !filp)
++#endif
++
+ if (addr) {
+ if (do_align)
+ addr = COLOUR_ALIGN(addr, pgoff);
+@@ -72,10 +76,10 @@ arch_get_unmapped_area(struct file *filp
+ return addr;
+ }
+ if (len > mm->cached_hole_size) {
+- start_addr = addr = mm->free_area_cache;
++ start_addr = addr = mm->free_area_cache;
+ } else {
+- start_addr = addr = TASK_UNMAPPED_BASE;
+- mm->cached_hole_size = 0;
++ start_addr = addr = mm->mmap_base;
++ mm->cached_hole_size = 0;
+ }
+
+ full_search:
+@@ -91,8 +95,8 @@ full_search:
+ * Start a new search - just in case we missed
+ * some holes.
+ */
+- if (start_addr != TASK_UNMAPPED_BASE) {
+- start_addr = addr = TASK_UNMAPPED_BASE;
++ if (start_addr != mm->mmap_base) {
++ start_addr = addr = mm->mmap_base;
+ mm->cached_hole_size = 0;
+ goto full_search;
+ }
+diff -urNp linux-2.6.23.1/arch/avr32/mm/fault.c linux-2.6.23.1/arch/avr32/mm/fault.c
+--- linux-2.6.23.1/arch/avr32/mm/fault.c 2007-10-12 12:43:44.000000000 -0400
++++ linux-2.6.23.1/arch/avr32/mm/fault.c 2007-10-30 18:10:07.000000000 -0400
+@@ -41,6 +41,23 @@ static inline int notify_page_fault(stru
+
+ int exception_trace = 1;
+
++#ifdef CONFIG_PAX_PAGEEXEC
++void pax_report_insns(void *pc, void *sp)
++{
++ unsigned long i;
++
++ printk(KERN_ERR "PAX: bytes at PC: ");
++ for (i = 0; i < 20; i++) {
++ unsigned char c;
++ if (get_user(c, (unsigned char *)pc+i))
++ printk("???????? ");
++ else
++ printk("%02x ", c);
++ }
++ printk("\n");
++}
++#endif
++
+ /*
+ * This routine handles page faults. It determines the address and the
+ * problem, and then passes it off to one of the appropriate routines.
+@@ -157,6 +174,16 @@ bad_area:
+ up_read(&mm->mmap_sem);
+
+ if (user_mode(regs)) {
++
++#ifdef CONFIG_PAX_PAGEEXEC
++ if (mm->pax_flags & MF_PAX_PAGEEXEC) {
++ if (ecr == ECR_PROTECTION_X || ecr == ECR_TLB_MISS_X) {
++ pax_report_fault(regs, (void *)regs->pc, (void *)regs->sp);
++ do_exit(SIGKILL);
++ }
++ }
++#endif
++
+ if (exception_trace && printk_ratelimit())
+ printk("%s%s[%d]: segfault at %08lx pc %08lx "
+ "sp %08lx ecr %lu\n",
+diff -urNp linux-2.6.23.1/arch/i386/boot/bitops.h linux-2.6.23.1/arch/i386/boot/bitops.h
+--- linux-2.6.23.1/arch/i386/boot/bitops.h 2007-10-12 12:43:44.000000000 -0400
++++ linux-2.6.23.1/arch/i386/boot/bitops.h 2007-10-30 18:10:07.000000000 -0400
+@@ -28,7 +28,7 @@ static inline int variable_test_bit(int
+ u8 v;
+ const u32 *p = (const u32 *)addr;
+
+- asm("btl %2,%1; setc %0" : "=qm" (v) : "m" (*p), "Ir" (nr));
++ asm volatile("btl %2,%1; setc %0" : "=qm" (v) : "m" (*p), "Ir" (nr));
+ return v;
+ }
+
+@@ -39,7 +39,7 @@ static inline int variable_test_bit(int
+
+ static inline void set_bit(int nr, void *addr)
+ {
+- asm("btsl %1,%0" : "+m" (*(u32 *)addr) : "Ir" (nr));
++ asm volatile("btsl %1,%0" : "+m" (*(u32 *)addr) : "Ir" (nr));
+ }
+
+ #endif /* BOOT_BITOPS_H */
+diff -urNp linux-2.6.23.1/arch/i386/boot/boot.h linux-2.6.23.1/arch/i386/boot/boot.h
+--- linux-2.6.23.1/arch/i386/boot/boot.h 2007-10-12 12:43:44.000000000 -0400
++++ linux-2.6.23.1/arch/i386/boot/boot.h 2007-10-30 18:10:07.000000000 -0400
+@@ -76,7 +76,7 @@ static inline void io_delay(void)
+ static inline u16 ds(void)
+ {
+ u16 seg;
+- asm("movw %%ds,%0" : "=rm" (seg));
++ asm volatile("movw %%ds,%0" : "=rm" (seg));
+ return seg;
+ }
+
+@@ -172,7 +172,7 @@ static inline void wrgs32(u32 v, addr_t
+ static inline int memcmp(const void *s1, const void *s2, size_t len)
+ {
+ u8 diff;
+- asm("repe; cmpsb; setnz %0"
++ asm volatile("repe; cmpsb; setnz %0"
+ : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len));
+ return diff;
+ }
+diff -urNp linux-2.6.23.1/arch/i386/boot/cpucheck.c linux-2.6.23.1/arch/i386/boot/cpucheck.c
+--- linux-2.6.23.1/arch/i386/boot/cpucheck.c 2007-10-12 12:43:44.000000000 -0400
++++ linux-2.6.23.1/arch/i386/boot/cpucheck.c 2007-10-30 18:10:07.000000000 -0400
+@@ -90,7 +90,7 @@ static int has_fpu(void)
+ u16 fcw = -1, fsw = -1;
+ u32 cr0;
+
+- asm("movl %%cr0,%0" : "=r" (cr0));
++ asm volatile("movl %%cr0,%0" : "=r" (cr0));
+ if (cr0 & (X86_CR0_EM|X86_CR0_TS)) {
+ cr0 &= ~(X86_CR0_EM|X86_CR0_TS);
+ asm volatile("movl %0,%%cr0" : : "r" (cr0));
+@@ -106,7 +106,7 @@ static int has_eflag(u32 mask)
+ {
+ u32 f0, f1;
+
+- asm("pushfl ; "
++ asm volatile("pushfl ; "
+ "pushfl ; "
+ "popl %0 ; "
+ "movl %0,%1 ; "
+@@ -131,7 +131,7 @@ static void get_flags(void)
+ set_bit(X86_FEATURE_FPU, cpu.flags);
+
+ if (has_eflag(X86_EFLAGS_ID)) {
+- asm("cpuid"
++ asm volatile("cpuid"
+ : "=a" (max_intel_level),
+ "=b" (cpu_vendor[0]),
+ "=d" (cpu_vendor[1]),
+@@ -140,7 +140,7 @@ static void get_flags(void)
+
+ if (max_intel_level >= 0x00000001 &&
+ max_intel_level <= 0x0000ffff) {
+- asm("cpuid"
++ asm volatile("cpuid"
+ : "=a" (tfms),
+ "=c" (cpu.flags[4]),
+ "=d" (cpu.flags[0])
+@@ -152,7 +152,7 @@ static void get_flags(void)
+ cpu.model += ((tfms >> 16) & 0xf) << 4;
+ }
+
+- asm("cpuid"
++ asm volatile("cpuid"
+ : "=a" (max_amd_level)
+ : "a" (0x80000000)
+ : "ebx", "ecx", "edx");
+@@ -160,7 +160,7 @@ static void get_flags(void)
+ if (max_amd_level >= 0x80000001 &&
+ max_amd_level <= 0x8000ffff) {
+ u32 eax = 0x80000001;
+- asm("cpuid"
++ asm volatile("cpuid"
+ : "+a" (eax),
+ "=c" (cpu.flags[6]),
+ "=d" (cpu.flags[1])
+@@ -219,9 +219,9 @@ int check_cpu(int *cpu_level_ptr, int *r
+ u32 ecx = MSR_K7_HWCR;
+ u32 eax, edx;
+
+- asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
++ asm volatile("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
+ eax &= ~(1 << 15);
+- asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
++ asm volatile("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
+
+ get_flags(); /* Make sure it really did something */
+ err = check_flags();
+@@ -234,9 +234,9 @@ int check_cpu(int *cpu_level_ptr, int *r
+ u32 ecx = MSR_VIA_FCR;
+ u32 eax, edx;
+
+- asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
++ asm volatile("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
+ eax |= (1<<1)|(1<<7);
+- asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
++ asm volatile("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
+
+ set_bit(X86_FEATURE_CX8, cpu.flags);
+ err = check_flags();
+@@ -247,12 +247,12 @@ int check_cpu(int *cpu_level_ptr, int *r
+ u32 eax, edx;
+ u32 level = 1;
+
+- asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
+- asm("wrmsr" : : "a" (~0), "d" (edx), "c" (ecx));
+- asm("cpuid"
++ asm volatile("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
++ asm volatile("wrmsr" : : "a" (~0), "d" (edx), "c" (ecx));
++ asm volatile("cpuid"
+ : "+a" (level), "=d" (cpu.flags[0])
+ : : "ecx", "ebx");
+- asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
++ asm volatile("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
+
+ err = check_flags();
+ }
+diff -urNp linux-2.6.23.1/arch/i386/boot/edd.c linux-2.6.23.1/arch/i386/boot/edd.c
+--- linux-2.6.23.1/arch/i386/boot/edd.c 2007-10-12 12:43:44.000000000 -0400
++++ linux-2.6.23.1/arch/i386/boot/edd.c 2007-10-30 18:10:07.000000000 -0400
+@@ -78,7 +78,7 @@ static int get_edd_info(u8 devno, struct
+ ax = 0x4100;
+ bx = EDDMAGIC1;
+ dx = devno;
+- asm("pushfl; stc; int $0x13; setc %%al; popfl"
++ asm volatile("pushfl; stc; int $0x13; setc %%al; popfl"
+ : "+a" (ax), "+b" (bx), "=c" (cx), "+d" (dx)
+ : : "esi", "edi");
+
+@@ -97,7 +97,7 @@ static int get_edd_info(u8 devno, struct
+ ei->params.length = sizeof(ei->params);
+ ax = 0x4800;
+ dx = devno;
+- asm("pushfl; int $0x13; popfl"
++ asm volatile("pushfl; int $0x13; popfl"
+ : "+a" (ax), "+d" (dx), "=m" (ei->params)
+ : "S" (&ei->params)
+ : "ebx", "ecx", "edi");
+@@ -108,7 +108,7 @@ static int get_edd_info(u8 devno, struct
+ ax = 0x0800;
+ dx = devno;
+ di = 0;
+- asm("pushw %%es; "
++ asm volatile("pushw %%es; "
+ "movw %%di,%%es; "
+ "pushfl; stc; int $0x13; setc %%al; popfl; "
+ "popw %%es"
+diff -urNp linux-2.6.23.1/arch/i386/boot/main.c linux-2.6.23.1/arch/i386/boot/main.c
+--- linux-2.6.23.1/arch/i386/boot/main.c 2007-10-12 12:43:44.000000000 -0400
++++ linux-2.6.23.1/arch/i386/boot/main.c 2007-10-30 18:10:07.000000000 -0400
+@@ -77,7 +77,7 @@ static void keyboard_set_repeat(void)
+ */
+ static void query_ist(void)
+ {
+- asm("int $0x15"
++ asm volatile("int $0x15"
+ : "=a" (boot_params.ist_info.signature),
+ "=b" (boot_params.ist_info.command),
+ "=c" (boot_params.ist_info.event),
+diff -urNp linux-2.6.23.1/arch/i386/boot/mca.c linux-2.6.23.1/arch/i386/boot/mca.c
+--- linux-2.6.23.1/arch/i386/boot/mca.c 2007-10-12 12:43:44.000000000 -0400
++++ linux-2.6.23.1/arch/i386/boot/mca.c 2007-10-30 18:10:07.000000000 -0400
+@@ -21,7 +21,7 @@ int query_mca(void)
+ u8 err;
+ u16 es, bx, len;
+
+- asm("pushw %%es ; "
++ asm volatile("pushw %%es ; "
+ "int $0x15 ; "
+ "setc %0 ; "
+ "movw %%es, %1 ; "
+diff -urNp linux-2.6.23.1/arch/i386/boot/memory.c linux-2.6.23.1/arch/i386/boot/memory.c
+--- linux-2.6.23.1/arch/i386/boot/memory.c 2007-10-12 12:43:44.000000000 -0400
++++ linux-2.6.23.1/arch/i386/boot/memory.c 2007-10-30 18:10:07.000000000 -0400
+@@ -32,7 +32,7 @@ static int detect_memory_e820(void)
+ /* Important: %edx is clobbered by some BIOSes,
+ so it must be either used for the error output
+ or explicitly marked clobbered. */
+- asm("int $0x15; setc %0"
++ asm volatile("int $0x15; setc %0"
+ : "=d" (err), "+b" (next), "=a" (id), "+c" (size),
+ "=m" (*desc)
+ : "D" (desc), "d" (SMAP), "a" (0xe820));
+@@ -64,7 +64,7 @@ static int detect_memory_e801(void)
+
+ bx = cx = dx = 0;
+ ax = 0xe801;
+- asm("stc; int $0x15; setc %0"
++ asm volatile("stc; int $0x15; setc %0"
+ : "=m" (err), "+a" (ax), "+b" (bx), "+c" (cx), "+d" (dx));
+
+ if (err)
+@@ -94,7 +94,7 @@ static int detect_memory_88(void)
+ u8 err;
+
+ ax = 0x8800;
+- asm("stc; int $0x15; setc %0" : "=bcdm" (err), "+a" (ax));
++ asm volatile("stc; int $0x15; setc %0" : "=bcdm" (err), "+a" (ax));
+
+ boot_params.screen_info.ext_mem_k = ax;
+
+diff -urNp linux-2.6.23.1/arch/i386/boot/video.c linux-2.6.23.1/arch/i386/boot/video.c
+--- linux-2.6.23.1/arch/i386/boot/video.c 2007-10-12 12:43:44.000000000 -0400
++++ linux-2.6.23.1/arch/i386/boot/video.c 2007-10-30 18:10:07.000000000 -0400
+@@ -40,7 +40,7 @@ static void store_cursor_position(void)
+
+ ax = 0x0300;
+ bx = 0;
+- asm(INT10
++ asm volatile(INT10
+ : "=d" (curpos), "+a" (ax), "+b" (bx)
+ : : "ecx", "esi", "edi");
+
+@@ -55,7 +55,7 @@ static void store_video_mode(void)
+ /* N.B.: the saving of the video page here is a bit silly,
+ since we pretty much assume page 0 everywhere. */
+ ax = 0x0f00;
+- asm(INT10
++ asm volatile(INT10
+ : "+a" (ax), "=b" (page)
+ : : "ecx", "edx", "esi", "edi");
+
+diff -urNp linux-2.6.23.1/arch/i386/boot/video-vesa.c linux-2.6.23.1/arch/i386/boot/video-vesa.c
+--- linux-2.6.23.1/arch/i386/boot/video-vesa.c 2007-10-12 12:43:44.000000000 -0400
++++ linux-2.6.23.1/arch/i386/boot/video-vesa.c 2007-10-30 18:10:07.000000000 -0400
+@@ -41,7 +41,7 @@ static int vesa_probe(void)
+
+ ax = 0x4f00;
+ di = (size_t)&vginfo;
+- asm(INT10
++ asm volatile(INT10
+ : "+a" (ax), "+D" (di), "=m" (vginfo)
+ : : "ebx", "ecx", "edx", "esi");
+
+@@ -68,7 +68,7 @@ static int vesa_probe(void)
+ ax = 0x4f01;
+ cx = mode;
+ di = (size_t)&vminfo;
+- asm(INT10
++ asm volatile(INT10
+ : "+a" (ax), "+c" (cx), "+D" (di), "=m" (vminfo)
+ : : "ebx", "edx", "esi");
+
+@@ -115,7 +115,7 @@ static int vesa_set_mode(struct mode_inf
+ ax = 0x4f01;
+ cx = vesa_mode;
+ di = (size_t)&vminfo;
+- asm(INT10
++ asm volatile(INT10
+ : "+a" (ax), "+c" (cx), "+D" (di), "=m" (vminfo)
+ : : "ebx", "edx", "esi");
+
+@@ -193,19 +193,20 @@ static void vesa_dac_set_8bits(void)
+ /* Save the VESA protected mode info */
+ static void vesa_store_pm_info(void)
+ {
+- u16 ax, bx, di, es;
++ u16 ax, bx, cx, di, es;
<<Diff was trimmed, longer than 597 lines>>
More information about the pld-cvs-commit
mailing list