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-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Peter Anvin:
"A couple of key fixes and a few less critical ones. The main ones
are:

- add a .bss section to the PE/COFF headers when building with EFI
stub

- invoke the correct paravirt magic when building the espfix page
tables

Unfortunately both of these areas also have at least one additional
fix each still in thie pipeline, but which are not yet ready to push"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86: Remove unused variable "polling"
x86/espfix/xen: Fix allocation of pages for paravirt page tables
x86/efi: Include a .bss section within the PE/COFF headers
efi: fdt: Do not report an error during boot if UEFI is not available
efi/arm64: efistub: remove local copy of linux_banner

+69 -35
-2
arch/arm64/kernel/efi-stub.c
··· 12 12 #include <linux/efi.h> 13 13 #include <linux/libfdt.h> 14 14 #include <asm/sections.h> 15 - #include <generated/compile.h> 16 - #include <generated/utsrelease.h> 17 15 18 16 /* 19 17 * AArch64 requires the DTB to be 8-byte aligned in the first 512MiB from
+22 -4
arch/x86/boot/header.S
··· 91 91 92 92 .section ".bsdata", "a" 93 93 bugger_off_msg: 94 - .ascii "Direct floppy boot is not supported. " 95 - .ascii "Use a boot loader program instead.\r\n" 94 + .ascii "Use a boot loader.\r\n" 96 95 .ascii "\n" 97 - .ascii "Remove disk and press any key to reboot ...\r\n" 96 + .ascii "Remove disk and press any key to reboot...\r\n" 98 97 .byte 0 99 98 100 99 #ifdef CONFIG_EFI_STUB ··· 107 108 #else 108 109 .word 0x8664 # x86-64 109 110 #endif 110 - .word 3 # nr_sections 111 + .word 4 # nr_sections 111 112 .long 0 # TimeDateStamp 112 113 .long 0 # PointerToSymbolTable 113 114 .long 1 # NumberOfSymbols ··· 248 249 .word 0 # NumberOfRelocations 249 250 .word 0 # NumberOfLineNumbers 250 251 .long 0x60500020 # Characteristics (section flags) 252 + 253 + # 254 + # The offset & size fields are filled in by build.c. 255 + # 256 + .ascii ".bss" 257 + .byte 0 258 + .byte 0 259 + .byte 0 260 + .byte 0 261 + .long 0 262 + .long 0x0 263 + .long 0 # Size of initialized data 264 + # on disk 265 + .long 0x0 266 + .long 0 # PointerToRelocations 267 + .long 0 # PointerToLineNumbers 268 + .word 0 # NumberOfRelocations 269 + .word 0 # NumberOfLineNumbers 270 + .long 0xc8000080 # Characteristics (section flags) 251 271 252 272 #endif /* CONFIG_EFI_STUB */ 253 273
+30 -8
arch/x86/boot/tools/build.c
··· 143 143 144 144 #ifdef CONFIG_EFI_STUB 145 145 146 - static void update_pecoff_section_header(char *section_name, u32 offset, u32 size) 146 + static void update_pecoff_section_header_fields(char *section_name, u32 vma, u32 size, u32 datasz, u32 offset) 147 147 { 148 148 unsigned int pe_header; 149 149 unsigned short num_sections; ··· 164 164 put_unaligned_le32(size, section + 0x8); 165 165 166 166 /* section header vma field */ 167 - put_unaligned_le32(offset, section + 0xc); 167 + put_unaligned_le32(vma, section + 0xc); 168 168 169 169 /* section header 'size of initialised data' field */ 170 - put_unaligned_le32(size, section + 0x10); 170 + put_unaligned_le32(datasz, section + 0x10); 171 171 172 172 /* section header 'file offset' field */ 173 173 put_unaligned_le32(offset, section + 0x14); ··· 177 177 section += 0x28; 178 178 num_sections--; 179 179 } 180 + } 181 + 182 + static void update_pecoff_section_header(char *section_name, u32 offset, u32 size) 183 + { 184 + update_pecoff_section_header_fields(section_name, offset, size, size, offset); 180 185 } 181 186 182 187 static void update_pecoff_setup_and_reloc(unsigned int size) ··· 208 203 209 204 pe_header = get_unaligned_le32(&buf[0x3c]); 210 205 211 - /* Size of image */ 212 - put_unaligned_le32(file_sz, &buf[pe_header + 0x50]); 213 - 214 206 /* 215 207 * Size of code: Subtract the size of the first sector (512 bytes) 216 208 * which includes the header. ··· 220 218 put_unaligned_le32(text_start + efi_pe_entry, &buf[pe_header + 0x28]); 221 219 222 220 update_pecoff_section_header(".text", text_start, text_sz); 221 + } 222 + 223 + static void update_pecoff_bss(unsigned int file_sz, unsigned int init_sz) 224 + { 225 + unsigned int pe_header; 226 + unsigned int bss_sz = init_sz - file_sz; 227 + 228 + pe_header = get_unaligned_le32(&buf[0x3c]); 229 + 230 + /* Size of uninitialized data */ 231 + put_unaligned_le32(bss_sz, &buf[pe_header + 0x24]); 232 + 233 + /* Size of image */ 234 + put_unaligned_le32(init_sz, &buf[pe_header + 0x50]); 235 + 236 + update_pecoff_section_header_fields(".bss", file_sz, bss_sz, 0, 0); 223 237 } 224 238 225 239 static int reserve_pecoff_reloc_section(int c) ··· 277 259 static inline void update_pecoff_setup_and_reloc(unsigned int size) {} 278 260 static inline void update_pecoff_text(unsigned int text_start, 279 261 unsigned int file_sz) {} 262 + static inline void update_pecoff_bss(unsigned int file_sz, 263 + unsigned int init_sz) {} 280 264 static inline void efi_stub_defaults(void) {} 281 265 static inline void efi_stub_entry_update(void) {} 282 266 ··· 330 310 331 311 int main(int argc, char ** argv) 332 312 { 333 - unsigned int i, sz, setup_sectors; 313 + unsigned int i, sz, setup_sectors, init_sz; 334 314 int c; 335 315 u32 sys_size; 336 316 struct stat sb; ··· 396 376 buf[0x1f1] = setup_sectors-1; 397 377 put_unaligned_le32(sys_size, &buf[0x1f4]); 398 378 399 - update_pecoff_text(setup_sectors * 512, sz + i + ((sys_size * 16) - sz)); 379 + update_pecoff_text(setup_sectors * 512, i + (sys_size * 16)); 380 + init_sz = get_unaligned_le32(&buf[0x260]); 381 + update_pecoff_bss(i + (sys_size * 16), init_sz); 400 382 401 383 efi_stub_entry_update(); 402 384
-1
arch/x86/kernel/apm_32.c
··· 841 841 u32 eax; 842 842 u8 ret = 0; 843 843 int idled = 0; 844 - int polling; 845 844 int err = 0; 846 845 847 846 if (!need_resched()) {
+2 -3
arch/x86/kernel/espfix_64.c
··· 175 175 if (!pud_present(pud)) { 176 176 pmd_p = (pmd_t *)__get_free_page(PGALLOC_GFP); 177 177 pud = __pud(__pa(pmd_p) | (PGTABLE_PROT & ptemask)); 178 - paravirt_alloc_pud(&init_mm, __pa(pmd_p) >> PAGE_SHIFT); 178 + paravirt_alloc_pmd(&init_mm, __pa(pmd_p) >> PAGE_SHIFT); 179 179 for (n = 0; n < ESPFIX_PUD_CLONES; n++) 180 180 set_pud(&pud_p[n], pud); 181 181 } ··· 185 185 if (!pmd_present(pmd)) { 186 186 pte_p = (pte_t *)__get_free_page(PGALLOC_GFP); 187 187 pmd = __pmd(__pa(pte_p) | (PGTABLE_PROT & ptemask)); 188 - paravirt_alloc_pmd(&init_mm, __pa(pte_p) >> PAGE_SHIFT); 188 + paravirt_alloc_pte(&init_mm, __pa(pte_p) >> PAGE_SHIFT); 189 189 for (n = 0; n < ESPFIX_PMD_CLONES; n++) 190 190 set_pmd(&pmd_p[n], pmd); 191 191 } ··· 193 193 pte_p = pte_offset_kernel(&pmd, addr); 194 194 stack_page = (void *)__get_free_page(GFP_KERNEL); 195 195 pte = __pte(__pa(stack_page) | (__PAGE_KERNEL_RO & ptemask)); 196 - paravirt_alloc_pte(&init_mm, __pa(stack_page) >> PAGE_SHIFT); 197 196 for (n = 0; n < ESPFIX_PTE_CLONES; n++) 198 197 set_pte(&pte_p[n*PTE_STRIDE], pte); 199 198
+15 -7
drivers/firmware/efi/efi.c
··· 346 346 347 347 struct param_info { 348 348 int verbose; 349 + int found; 349 350 void *params; 350 351 }; 351 352 ··· 363 362 (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) 364 363 return 0; 365 364 366 - pr_info("Getting parameters from FDT:\n"); 367 - 368 365 for (i = 0; i < ARRAY_SIZE(dt_params); i++) { 369 366 prop = of_get_flat_dt_prop(node, dt_params[i].propname, &len); 370 - if (!prop) { 371 - pr_err("Can't find %s in device tree!\n", 372 - dt_params[i].name); 367 + if (!prop) 373 368 return 0; 374 - } 375 369 dest = info->params + dt_params[i].offset; 370 + info->found++; 376 371 377 372 val = of_read_number(prop, len / sizeof(u32)); 378 373 ··· 387 390 int __init efi_get_fdt_params(struct efi_fdt_params *params, int verbose) 388 391 { 389 392 struct param_info info; 393 + int ret; 394 + 395 + pr_info("Getting EFI parameters from FDT:\n"); 390 396 391 397 info.verbose = verbose; 398 + info.found = 0; 392 399 info.params = params; 393 400 394 - return of_scan_flat_dt(fdt_find_uefi_params, &info); 401 + ret = of_scan_flat_dt(fdt_find_uefi_params, &info); 402 + if (!info.found) 403 + pr_info("UEFI not found.\n"); 404 + else if (!ret) 405 + pr_err("Can't find '%s' in device tree!\n", 406 + dt_params[info.found].name); 407 + 408 + return ret; 395 409 } 396 410 #endif /* CONFIG_EFI_PARAMS_FROM_FDT */
-10
drivers/firmware/efi/fdt.c
··· 23 23 u32 fdt_val32; 24 24 u64 fdt_val64; 25 25 26 - /* 27 - * Copy definition of linux_banner here. Since this code is 28 - * built as part of the decompressor for ARM v7, pulling 29 - * in version.c where linux_banner is defined for the 30 - * kernel brings other kernel dependencies with it. 31 - */ 32 - const char linux_banner[] = 33 - "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@" 34 - LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n"; 35 - 36 26 /* Do some checks on provided FDT, if it exists*/ 37 27 if (orig_fdt) { 38 28 if (fdt_check_header(orig_fdt)) {