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.

binfmt_flat: make support for old format binaries optional

No need to carry the extra code around, given that systems using flat
binaries are generally very resource constrained.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>

authored by

Christoph Hellwig and committed by
Greg Ungerer
cf9a566c aef0f78e

+29 -8
+7
fs/Kconfig.binfmt
··· 106 106 config BINFMT_FLAT_OLD_ALWAYS_RAM 107 107 bool 108 108 109 + config BINFMT_FLAT_OLD 110 + bool "Enable support for very old legacy flat binaries" 111 + depends on BINFMT_FLAT 112 + help 113 + Support decade old uClinux FLAT format binaries. Unless you know 114 + you have some of those say N here. 115 + 109 116 config BINFMT_ZFLAT 110 117 bool "Enable ZFLAT support" 111 118 depends on BINFMT_FLAT
+22 -8
fs/binfmt_flat.c
··· 374 374 375 375 /****************************************************************************/ 376 376 377 + #ifdef CONFIG_BINFMT_FLAT_OLD 377 378 static void old_reloc(unsigned long rl) 378 379 { 379 380 static const char *segment[] = { "TEXT", "DATA", "BSS", "*UNKNOWN*" }; ··· 412 411 413 412 pr_debug("Relocation became %lx\n", val); 414 413 } 414 + #endif /* CONFIG_BINFMT_FLAT_OLD */ 415 415 416 416 /****************************************************************************/ 417 417 ··· 463 461 if (flags & FLAT_FLAG_KTRACE) 464 462 pr_info("Loading file: %s\n", bprm->filename); 465 463 464 + #ifdef CONFIG_BINFMT_FLAT_OLD 466 465 if (rev != FLAT_VERSION && rev != OLD_FLAT_VERSION) { 467 466 pr_err("bad flat file version 0x%x (supported 0x%lx and 0x%lx)\n", 468 467 rev, FLAT_VERSION, OLD_FLAT_VERSION); ··· 480 477 } 481 478 482 479 /* 480 + * fix up the flags for the older format, there were all kinds 481 + * of endian hacks, this only works for the simple cases 482 + */ 483 + if (rev == OLD_FLAT_VERSION && 484 + (flags || IS_ENABLED(CONFIG_BINFMT_FLAT_OLD_ALWAYS_RAM))) 485 + flags = FLAT_FLAG_RAM; 486 + 487 + #else /* CONFIG_BINFMT_FLAT_OLD */ 488 + if (rev != FLAT_VERSION) { 489 + pr_err("bad flat file version 0x%x (supported 0x%lx)\n", 490 + rev, FLAT_VERSION); 491 + ret = -ENOEXEC; 492 + goto err; 493 + } 494 + #endif /* !CONFIG_BINFMT_FLAT_OLD */ 495 + 496 + /* 483 497 * Make sure the header params are sane. 484 498 * 28 bits (256 MB) is way more than reasonable in this case. 485 499 * If some top bits are set we have probable binary corruption. ··· 506 486 ret = -ENOEXEC; 507 487 goto err; 508 488 } 509 - 510 - /* 511 - * fix up the flags for the older format, there were all kinds 512 - * of endian hacks, this only works for the simple cases 513 - */ 514 - if (rev == OLD_FLAT_VERSION && 515 - (flags || IS_ENABLED(CONFIG_BINFMT_FLAT_OLD_ALWAYS_RAM))) 516 - flags = FLAT_FLAG_RAM; 517 489 518 490 #ifndef CONFIG_BINFMT_ZFLAT 519 491 if (flags & (FLAT_FLAG_GZIP|FLAT_FLAG_GZDATA)) { ··· 845 833 goto err; 846 834 } 847 835 } 836 + #ifdef CONFIG_BINFMT_FLAT_OLD 848 837 } else { 849 838 for (i = 0; i < relocs; i++) { 850 839 __be32 relval; ··· 853 840 return -EFAULT; 854 841 old_reloc(ntohl(relval)); 855 842 } 843 + #endif /* CONFIG_BINFMT_FLAT_OLD */ 856 844 } 857 845 858 846 flush_icache_range(start_code, end_code);