Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 EFI fixes from Peter Anvin:
"This is a collection of fixes for the EFI support. The controversial
bit here is a set of patches which bumps the boot protocol version as
part of fixing some serious problems with the EFI handover protocol,
used when booting under EFI using a bootloader as opposed to directly
from EFI. These changes should also make it a lot saner to support
cross-mode 32/64-bit EFI booting in the future. Getting these changes
into 3.8 means we avoid presenting an inconsistent ABI to bootloaders.

Other changes are display detection and fixing efivarfs."

* 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86, efi: remove attribute check from setup_efi_pci
x86, build: Dynamically find entry points in compressed startup code
x86, efi: Fix PCI ROM handing in EFI boot stub, in 32-bit mode
x86, efi: Fix 32-bit EFI handover protocol entry point
x86, efi: Fix display detection in EFI boot stub
x86, boot: Define the 2.12 bzImage boot protocol
x86/boot: Fix minor fd leakage in tools/relocs.c
x86, efi: Set runtime_version to the EFI spec revision
x86, efi: fix 32-bit warnings in setup_efi_pci()
efivarfs: Delete dentry from dcache in efivarfs_file_write()
efivarfs: Never return ENOENT from firmware
efi, x86: Pass a proper identity mapping in efi_call_phys_prelog
efivarfs: Drop link count of the right inode

+216 -76
+26 -1
Documentation/x86/boot.txt
··· 57 57 Protocol 2.11: (Kernel 3.6) Added a field for offset of EFI handover 58 58 protocol entry point. 59 59 60 + Protocol 2.12: (Kernel 3.9) Added the xloadflags field and extension fields 61 + to struct boot_params for for loading bzImage and ramdisk 62 + above 4G in 64bit. 63 + 60 64 **** MEMORY LAYOUT 61 65 62 66 The traditional memory map for the kernel loader, used for Image or ··· 186 182 0230/4 2.05+ kernel_alignment Physical addr alignment required for kernel 187 183 0234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not 188 184 0235/1 2.10+ min_alignment Minimum alignment, as a power of two 189 - 0236/2 N/A pad3 Unused 185 + 0236/2 2.12+ xloadflags Boot protocol option flags 190 186 0238/4 2.06+ cmdline_size Maximum size of the kernel command line 191 187 023C/4 2.07+ hardware_subarch Hardware subarchitecture 192 188 0240/8 2.07+ hardware_subarch_data Subarchitecture-specific data ··· 585 581 There may be a considerable performance cost with an excessively 586 582 misaligned kernel. Therefore, a loader should typically try each 587 583 power-of-two alignment from kernel_alignment down to this alignment. 584 + 585 + Field name: xloadflags 586 + Type: read 587 + Offset/size: 0x236/2 588 + Protocol: 2.12+ 589 + 590 + This field is a bitmask. 591 + 592 + Bit 0 (read): XLF_KERNEL_64 593 + - If 1, this kernel has the legacy 64-bit entry point at 0x200. 594 + 595 + Bit 1 (read): XLF_CAN_BE_LOADED_ABOVE_4G 596 + - If 1, kernel/boot_params/cmdline/ramdisk can be above 4G. 597 + 598 + Bit 2 (read): XLF_EFI_HANDOVER_32 599 + - If 1, the kernel supports the 32-bit EFI handoff entry point 600 + given at handover_offset. 601 + 602 + Bit 3 (read): XLF_EFI_HANDOVER_64 603 + - If 1, the kernel supports the 64-bit EFI handoff entry point 604 + given at handover_offset + 0x200. 588 605 589 606 Field name: cmdline_size 590 607 Type: read
+4
Documentation/x86/zero-page.txt
··· 19 19 090/010 ALL hd1_info hd1 disk parameter, OBSOLETE!! 20 20 0A0/010 ALL sys_desc_table System description table (struct sys_desc_table) 21 21 0B0/010 ALL olpc_ofw_header OLPC's OpenFirmware CIF and friends 22 + 0C0/004 ALL ext_ramdisk_image ramdisk_image high 32bits 23 + 0C4/004 ALL ext_ramdisk_size ramdisk_size high 32bits 24 + 0C8/004 ALL ext_cmd_line_ptr cmd_line_ptr high 32bits 22 25 140/080 ALL edid_info Video mode setup (struct edid_info) 23 26 1C0/020 ALL efi_info EFI 32 information (struct efi_info) 24 27 1E0/004 ALL alk_mem_k Alternative mem check, in KB ··· 30 27 1E9/001 ALL eddbuf_entries Number of entries in eddbuf (below) 31 28 1EA/001 ALL edd_mbr_sig_buf_entries Number of entries in edd_mbr_sig_buffer 32 29 (below) 30 + 1EF/001 ALL sentinel Used to detect broken bootloaders 33 31 290/040 ALL edd_mbr_sig_buffer EDD MBR signatures 34 32 2D0/A00 ALL e820_map E820 memory map table 35 33 (array of struct e820entry)
+2 -2
arch/x86/boot/Makefile
··· 71 71 $(obj)/bzImage: asflags-y := $(SVGA_MODE) 72 72 73 73 quiet_cmd_image = BUILD $@ 74 - cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin > $@ 74 + cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/zoffset.h > $@ 75 75 76 76 $(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE 77 77 $(call if_changed,image) ··· 92 92 $(obj)/voffset.h: vmlinux FORCE 93 93 $(call if_changed,voffset) 94 94 95 - sed-zoffset := -e 's/^\([0-9a-fA-F]*\) . \(startup_32\|input_data\|_end\|z_.*\)$$/\#define ZO_\2 0x\1/p' 95 + sed-zoffset := -e 's/^\([0-9a-fA-F]*\) . \(startup_32\|startup_64\|efi_pe_entry\|efi_stub_entry\|input_data\|_end\|z_.*\)$$/\#define ZO_\2 0x\1/p' 96 96 97 97 quiet_cmd_zoffset = ZOFFSET $@ 98 98 cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@
+11 -10
arch/x86/boot/compressed/eboot.c
··· 256 256 int i; 257 257 struct setup_data *data; 258 258 259 - data = (struct setup_data *)params->hdr.setup_data; 259 + data = (struct setup_data *)(unsigned long)params->hdr.setup_data; 260 260 261 261 while (data && data->next) 262 - data = (struct setup_data *)data->next; 262 + data = (struct setup_data *)(unsigned long)data->next; 263 263 264 264 status = efi_call_phys5(sys_table->boottime->locate_handle, 265 265 EFI_LOCATE_BY_PROTOCOL, &pci_proto, ··· 295 295 if (!pci) 296 296 continue; 297 297 298 + #ifdef CONFIG_X86_64 298 299 status = efi_call_phys4(pci->attributes, pci, 299 300 EfiPciIoAttributeOperationGet, 0, 300 301 &attributes); 301 - 302 + #else 303 + status = efi_call_phys5(pci->attributes, pci, 304 + EfiPciIoAttributeOperationGet, 0, 0, 305 + &attributes); 306 + #endif 302 307 if (status != EFI_SUCCESS) 303 - continue; 304 - 305 - if (!(attributes & EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM)) 306 308 continue; 307 309 308 310 if (!pci->romimage || !pci->romsize) ··· 347 345 memcpy(rom->romdata, pci->romimage, pci->romsize); 348 346 349 347 if (data) 350 - data->next = (uint64_t)rom; 348 + data->next = (unsigned long)rom; 351 349 else 352 - params->hdr.setup_data = (uint64_t)rom; 350 + params->hdr.setup_data = (unsigned long)rom; 353 351 354 352 data = (struct setup_data *)rom; 355 353 ··· 434 432 * Once we've found a GOP supporting ConOut, 435 433 * don't bother looking any further. 436 434 */ 435 + first_gop = gop; 437 436 if (conout_found) 438 437 break; 439 - 440 - first_gop = gop; 441 438 } 442 439 } 443 440
+5 -3
arch/x86/boot/compressed/head_32.S
··· 35 35 #ifdef CONFIG_EFI_STUB 36 36 jmp preferred_addr 37 37 38 - .balign 0x10 39 38 /* 40 39 * We don't need the return address, so set up the stack so 41 - * efi_main() can find its arugments. 40 + * efi_main() can find its arguments. 42 41 */ 42 + ENTRY(efi_pe_entry) 43 43 add $0x4, %esp 44 44 45 45 call make_boot_params ··· 50 50 pushl %eax 51 51 pushl %esi 52 52 pushl %ecx 53 + sub $0x4, %esp 53 54 54 - .org 0x30,0x90 55 + ENTRY(efi_stub_entry) 56 + add $0x4, %esp 55 57 call efi_main 56 58 cmpl $0, %eax 57 59 movl %eax, %esi
+4 -4
arch/x86/boot/compressed/head_64.S
··· 201 201 */ 202 202 #ifdef CONFIG_EFI_STUB 203 203 /* 204 - * The entry point for the PE/COFF executable is 0x210, so only 205 - * legacy boot loaders will execute this jmp. 204 + * The entry point for the PE/COFF executable is efi_pe_entry, so 205 + * only legacy boot loaders will execute this jmp. 206 206 */ 207 207 jmp preferred_addr 208 208 209 - .org 0x210 209 + ENTRY(efi_pe_entry) 210 210 mov %rcx, %rdi 211 211 mov %rdx, %rsi 212 212 pushq %rdi ··· 218 218 popq %rsi 219 219 popq %rdi 220 220 221 - .org 0x230,0x90 221 + ENTRY(efi_stub_entry) 222 222 call efi_main 223 223 movq %rax,%rsi 224 224 cmpq $0,%rax
+29 -10
arch/x86/boot/header.S
··· 21 21 #include <asm/e820.h> 22 22 #include <asm/page_types.h> 23 23 #include <asm/setup.h> 24 + #include <asm/bootparam.h> 24 25 #include "boot.h" 25 26 #include "voffset.h" 26 27 #include "zoffset.h" ··· 256 255 # header, from the old boot sector. 257 256 258 257 .section ".header", "a" 258 + .globl sentinel 259 + sentinel: .byte 0xff, 0xff /* Used to detect broken loaders */ 260 + 259 261 .globl hdr 260 262 hdr: 261 263 setup_sects: .byte 0 /* Filled in by build.c */ ··· 283 279 # Part 2 of the header, from the old setup.S 284 280 285 281 .ascii "HdrS" # header signature 286 - .word 0x020b # header version number (>= 0x0105) 282 + .word 0x020c # header version number (>= 0x0105) 287 283 # or else old loadlin-1.5 will fail) 288 284 .globl realmode_swtch 289 285 realmode_swtch: .word 0, 0 # default_switch, SETUPSEG ··· 301 297 302 298 # flags, unused bits must be zero (RFU) bit within loadflags 303 299 loadflags: 304 - LOADED_HIGH = 1 # If set, the kernel is loaded high 305 - CAN_USE_HEAP = 0x80 # If set, the loader also has set 306 - # heap_end_ptr to tell how much 307 - # space behind setup.S can be used for 308 - # heap purposes. 309 - # Only the loader knows what is free 310 - .byte LOADED_HIGH 300 + .byte LOADED_HIGH # The kernel is to be loaded high 311 301 312 302 setup_move_size: .word 0x8000 # size to move, when setup is not 313 303 # loaded at 0x90000. We will move setup ··· 367 369 relocatable_kernel: .byte 0 368 370 #endif 369 371 min_alignment: .byte MIN_KERNEL_ALIGN_LG2 # minimum alignment 370 - pad3: .word 0 372 + 373 + xloadflags: 374 + #ifdef CONFIG_X86_64 375 + # define XLF0 XLF_KERNEL_64 /* 64-bit kernel */ 376 + #else 377 + # define XLF0 0 378 + #endif 379 + #ifdef CONFIG_EFI_STUB 380 + # ifdef CONFIG_X86_64 381 + # define XLF23 XLF_EFI_HANDOVER_64 /* 64-bit EFI handover ok */ 382 + # else 383 + # define XLF23 XLF_EFI_HANDOVER_32 /* 32-bit EFI handover ok */ 384 + # endif 385 + #else 386 + # define XLF23 0 387 + #endif 388 + .word XLF0 | XLF23 371 389 372 390 cmdline_size: .long COMMAND_LINE_SIZE-1 #length of the command line, 373 391 #added with boot protocol ··· 411 397 #define INIT_SIZE VO_INIT_SIZE 412 398 #endif 413 399 init_size: .long INIT_SIZE # kernel initialization size 414 - handover_offset: .long 0x30 # offset to the handover 400 + handover_offset: 401 + #ifdef CONFIG_EFI_STUB 402 + .long 0x30 # offset to the handover 415 403 # protocol entry point 404 + #else 405 + .long 0 406 + #endif 416 407 417 408 # End of setup header ##################################################### 418 409
+1 -1
arch/x86/boot/setup.ld
··· 13 13 .bstext : { *(.bstext) } 14 14 .bsdata : { *(.bsdata) } 15 15 16 - . = 497; 16 + . = 495; 17 17 .header : { *(.header) } 18 18 .entrytext : { *(.entrytext) } 19 19 .inittext : { *(.inittext) }
+63 -18
arch/x86/boot/tools/build.c
··· 52 52 53 53 #define PECOFF_RELOC_RESERVE 0x20 54 54 55 + unsigned long efi_stub_entry; 56 + unsigned long efi_pe_entry; 57 + unsigned long startup_64; 58 + 55 59 /*----------------------------------------------------------------------*/ 56 60 57 61 static const u32 crctab32[] = { ··· 136 132 137 133 static void usage(void) 138 134 { 139 - die("Usage: build setup system [> image]"); 135 + die("Usage: build setup system [zoffset.h] [> image]"); 140 136 } 141 137 142 138 #ifdef CONFIG_EFI_STUB ··· 210 206 */ 211 207 put_unaligned_le32(file_sz - 512, &buf[pe_header + 0x1c]); 212 208 213 - #ifdef CONFIG_X86_32 214 209 /* 215 - * Address of entry point. 216 - * 217 - * The EFI stub entry point is +16 bytes from the start of 218 - * the .text section. 210 + * Address of entry point for PE/COFF executable 219 211 */ 220 - put_unaligned_le32(text_start + 16, &buf[pe_header + 0x28]); 221 - #else 222 - /* 223 - * Address of entry point. startup_32 is at the beginning and 224 - * the 64-bit entry point (startup_64) is always 512 bytes 225 - * after. The EFI stub entry point is 16 bytes after that, as 226 - * the first instruction allows legacy loaders to jump over 227 - * the EFI stub initialisation 228 - */ 229 - put_unaligned_le32(text_start + 528, &buf[pe_header + 0x28]); 230 - #endif /* CONFIG_X86_32 */ 212 + put_unaligned_le32(text_start + efi_pe_entry, &buf[pe_header + 0x28]); 231 213 232 214 update_pecoff_section_header(".text", text_start, text_sz); 233 215 } 234 216 235 217 #endif /* CONFIG_EFI_STUB */ 218 + 219 + 220 + /* 221 + * Parse zoffset.h and find the entry points. We could just #include zoffset.h 222 + * but that would mean tools/build would have to be rebuilt every time. It's 223 + * not as if parsing it is hard... 224 + */ 225 + #define PARSE_ZOFS(p, sym) do { \ 226 + if (!strncmp(p, "#define ZO_" #sym " ", 11+sizeof(#sym))) \ 227 + sym = strtoul(p + 11 + sizeof(#sym), NULL, 16); \ 228 + } while (0) 229 + 230 + static void parse_zoffset(char *fname) 231 + { 232 + FILE *file; 233 + char *p; 234 + int c; 235 + 236 + file = fopen(fname, "r"); 237 + if (!file) 238 + die("Unable to open `%s': %m", fname); 239 + c = fread(buf, 1, sizeof(buf) - 1, file); 240 + if (ferror(file)) 241 + die("read-error on `zoffset.h'"); 242 + buf[c] = 0; 243 + 244 + p = (char *)buf; 245 + 246 + while (p && *p) { 247 + PARSE_ZOFS(p, efi_stub_entry); 248 + PARSE_ZOFS(p, efi_pe_entry); 249 + PARSE_ZOFS(p, startup_64); 250 + 251 + p = strchr(p, '\n'); 252 + while (p && (*p == '\r' || *p == '\n')) 253 + p++; 254 + } 255 + } 236 256 237 257 int main(int argc, char ** argv) 238 258 { ··· 269 241 void *kernel; 270 242 u32 crc = 0xffffffffUL; 271 243 272 - if (argc != 3) 244 + /* Defaults for old kernel */ 245 + #ifdef CONFIG_X86_32 246 + efi_pe_entry = 0x10; 247 + efi_stub_entry = 0x30; 248 + #else 249 + efi_pe_entry = 0x210; 250 + efi_stub_entry = 0x230; 251 + startup_64 = 0x200; 252 + #endif 253 + 254 + if (argc == 4) 255 + parse_zoffset(argv[3]); 256 + else if (argc != 3) 273 257 usage(); 274 258 275 259 /* Copy the setup code */ ··· 339 299 340 300 #ifdef CONFIG_EFI_STUB 341 301 update_pecoff_text(setup_sectors * 512, sz + i + ((sys_size * 16) - sz)); 302 + 303 + #ifdef CONFIG_X86_64 /* Yes, this is really how we defined it :( */ 304 + efi_stub_entry -= 0x200; 305 + #endif 306 + put_unaligned_le32(efi_stub_entry, &buf[0x264]); 342 307 #endif 343 308 344 309 crc = partial_crc32(buf, i, crc);
+46 -17
arch/x86/include/uapi/asm/bootparam.h
··· 1 1 #ifndef _ASM_X86_BOOTPARAM_H 2 2 #define _ASM_X86_BOOTPARAM_H 3 3 4 + /* setup_data types */ 5 + #define SETUP_NONE 0 6 + #define SETUP_E820_EXT 1 7 + #define SETUP_DTB 2 8 + #define SETUP_PCI 3 9 + 10 + /* ram_size flags */ 11 + #define RAMDISK_IMAGE_START_MASK 0x07FF 12 + #define RAMDISK_PROMPT_FLAG 0x8000 13 + #define RAMDISK_LOAD_FLAG 0x4000 14 + 15 + /* loadflags */ 16 + #define LOADED_HIGH (1<<0) 17 + #define QUIET_FLAG (1<<5) 18 + #define KEEP_SEGMENTS (1<<6) 19 + #define CAN_USE_HEAP (1<<7) 20 + 21 + /* xloadflags */ 22 + #define XLF_KERNEL_64 (1<<0) 23 + #define XLF_CAN_BE_LOADED_ABOVE_4G (1<<1) 24 + #define XLF_EFI_HANDOVER_32 (1<<2) 25 + #define XLF_EFI_HANDOVER_64 (1<<3) 26 + 27 + #ifndef __ASSEMBLY__ 28 + 4 29 #include <linux/types.h> 5 30 #include <linux/screen_info.h> 6 31 #include <linux/apm_bios.h> ··· 33 8 #include <asm/e820.h> 34 9 #include <asm/ist.h> 35 10 #include <video/edid.h> 36 - 37 - /* setup data types */ 38 - #define SETUP_NONE 0 39 - #define SETUP_E820_EXT 1 40 - #define SETUP_DTB 2 41 - #define SETUP_PCI 3 42 11 43 12 /* extensible setup data list node */ 44 13 struct setup_data { ··· 47 28 __u16 root_flags; 48 29 __u32 syssize; 49 30 __u16 ram_size; 50 - #define RAMDISK_IMAGE_START_MASK 0x07FF 51 - #define RAMDISK_PROMPT_FLAG 0x8000 52 - #define RAMDISK_LOAD_FLAG 0x4000 53 31 __u16 vid_mode; 54 32 __u16 root_dev; 55 33 __u16 boot_flag; ··· 58 42 __u16 kernel_version; 59 43 __u8 type_of_loader; 60 44 __u8 loadflags; 61 - #define LOADED_HIGH (1<<0) 62 - #define QUIET_FLAG (1<<5) 63 - #define KEEP_SEGMENTS (1<<6) 64 - #define CAN_USE_HEAP (1<<7) 65 45 __u16 setup_move_size; 66 46 __u32 code32_start; 67 47 __u32 ramdisk_image; ··· 70 58 __u32 initrd_addr_max; 71 59 __u32 kernel_alignment; 72 60 __u8 relocatable_kernel; 73 - __u8 _pad2[3]; 61 + __u8 min_alignment; 62 + __u16 xloadflags; 74 63 __u32 cmdline_size; 75 64 __u32 hardware_subarch; 76 65 __u64 hardware_subarch_data; ··· 119 106 __u8 hd1_info[16]; /* obsolete! */ /* 0x090 */ 120 107 struct sys_desc_table sys_desc_table; /* 0x0a0 */ 121 108 struct olpc_ofw_header olpc_ofw_header; /* 0x0b0 */ 122 - __u8 _pad4[128]; /* 0x0c0 */ 109 + __u32 ext_ramdisk_image; /* 0x0c0 */ 110 + __u32 ext_ramdisk_size; /* 0x0c4 */ 111 + __u32 ext_cmd_line_ptr; /* 0x0c8 */ 112 + __u8 _pad4[116]; /* 0x0cc */ 123 113 struct edid_info edid_info; /* 0x140 */ 124 114 struct efi_info efi_info; /* 0x1c0 */ 125 115 __u32 alt_mem_k; /* 0x1e0 */ ··· 131 115 __u8 eddbuf_entries; /* 0x1e9 */ 132 116 __u8 edd_mbr_sig_buf_entries; /* 0x1ea */ 133 117 __u8 kbd_status; /* 0x1eb */ 134 - __u8 _pad6[5]; /* 0x1ec */ 118 + __u8 _pad5[3]; /* 0x1ec */ 119 + /* 120 + * The sentinel is set to a nonzero value (0xff) in header.S. 121 + * 122 + * A bootloader is supposed to only take setup_header and put 123 + * it into a clean boot_params buffer. If it turns out that 124 + * it is clumsy or too generous with the buffer, it most 125 + * probably will pick up the sentinel variable too. The fact 126 + * that this variable then is still 0xff will let kernel 127 + * know that some variables in boot_params are invalid and 128 + * kernel should zero out certain portions of boot_params. 129 + */ 130 + __u8 sentinel; /* 0x1ef */ 131 + __u8 _pad6[1]; /* 0x1f0 */ 135 132 struct setup_header hdr; /* setup header */ /* 0x1f1 */ 136 133 __u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)]; 137 134 __u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */ ··· 163 134 X86_NR_SUBARCHS, 164 135 }; 165 136 166 - 137 + #endif /* __ASSEMBLY__ */ 167 138 168 139 #endif /* _ASM_X86_BOOTPARAM_H */
+1 -1
arch/x86/platform/efi/efi.c
··· 949 949 * 950 950 * Call EFI services through wrapper functions. 951 951 */ 952 - efi.runtime_version = efi_systab.fw_revision; 952 + efi.runtime_version = efi_systab.hdr.revision; 953 953 efi.get_time = virt_efi_get_time; 954 954 efi.set_time = virt_efi_set_time; 955 955 efi.get_wakeup_time = virt_efi_get_wakeup_time;
+17 -5
arch/x86/platform/efi/efi_64.c
··· 38 38 #include <asm/cacheflush.h> 39 39 #include <asm/fixmap.h> 40 40 41 - static pgd_t save_pgd __initdata; 41 + static pgd_t *save_pgd __initdata; 42 42 static unsigned long efi_flags __initdata; 43 43 44 44 static void __init early_code_mapping_set_exec(int executable) ··· 61 61 void __init efi_call_phys_prelog(void) 62 62 { 63 63 unsigned long vaddress; 64 + int pgd; 65 + int n_pgds; 64 66 65 67 early_code_mapping_set_exec(1); 66 68 local_irq_save(efi_flags); 67 - vaddress = (unsigned long)__va(0x0UL); 68 - save_pgd = *pgd_offset_k(0x0UL); 69 - set_pgd(pgd_offset_k(0x0UL), *pgd_offset_k(vaddress)); 69 + 70 + n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE); 71 + save_pgd = kmalloc(n_pgds * sizeof(pgd_t), GFP_KERNEL); 72 + 73 + for (pgd = 0; pgd < n_pgds; pgd++) { 74 + save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE); 75 + vaddress = (unsigned long)__va(pgd * PGDIR_SIZE); 76 + set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), *pgd_offset_k(vaddress)); 77 + } 70 78 __flush_tlb_all(); 71 79 } 72 80 ··· 83 75 /* 84 76 * After the lock is released, the original page table is restored. 85 77 */ 86 - set_pgd(pgd_offset_k(0x0UL), save_pgd); 78 + int pgd; 79 + int n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT) , PGDIR_SIZE); 80 + for (pgd = 0; pgd < n_pgds; pgd++) 81 + set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), save_pgd[pgd]); 82 + kfree(save_pgd); 87 83 __flush_tlb_all(); 88 84 local_irq_restore(efi_flags); 89 85 early_code_mapping_set_exec(0);
+4 -2
arch/x86/tools/relocs.c
··· 814 814 read_relocs(fp); 815 815 if (show_absolute_syms) { 816 816 print_absolute_symbols(); 817 - return 0; 817 + goto out; 818 818 } 819 819 if (show_absolute_relocs) { 820 820 print_absolute_relocs(); 821 - return 0; 821 + goto out; 822 822 } 823 823 emit_relocs(as_text, use_real_mode); 824 + out: 825 + fclose(fp); 824 826 return 0; 825 827 }
+3 -2
drivers/firmware/efivars.c
··· 674 674 err = -EACCES; 675 675 break; 676 676 case EFI_NOT_FOUND: 677 - err = -ENOENT; 677 + err = -EIO; 678 678 break; 679 679 default: 680 680 err = -EINVAL; ··· 793 793 spin_unlock(&efivars->lock); 794 794 efivar_unregister(var); 795 795 drop_nlink(inode); 796 + d_delete(file->f_dentry); 796 797 dput(file->f_dentry); 797 798 798 799 } else { ··· 995 994 list_del(&var->list); 996 995 spin_unlock(&efivars->lock); 997 996 efivar_unregister(var); 998 - drop_nlink(dir); 997 + drop_nlink(dentry->d_inode); 999 998 dput(dentry); 1000 999 return 0; 1001 1000 }