lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <200709122145.52026.vda.linux@googlemail.com>
Date:	Wed, 12 Sep 2007 21:45:51 +0100
From:	Denys Vlasenko <vda.linux@...glemail.com>
To:	Sam Ravnborg <sam@...nborg.org>
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH 3/2] section garbage collection for i386 - BONUS TRACK

Hi Sam,

This patch makes i386 vmlinux linker script simpler
by minimizing number of generated sections.

For example, these sections:

 21 .init.text    000204a0  78701000  00701000  00502000  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 22 .init.data    000268db  787214a0  007214a0  005224a0  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 23 .init.setup   00000654  78747d80  00747d80  00548d80  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 24 .initcall.init 000004c4  787483d4  007483d4  005493d4  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 25 .con_initcall.init 00000008  78748898  00748898  00549898  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 26 .altinstructions 00009c23  787488a0  007488a0  005498a0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 27 .altinstr_replacement 000027de  787524c3  007524c3  005534c3  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 28 .exit.text    00000f31  78754ca4  00754ca4  00555ca4  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 29 .init.ramfs   00000086  78756000  00756000  00557000  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA

code, data, data, data, rodata, code, code, data... -
doesn't look clean.

Can more sanely be grouped like this:

 15 .init.text    00023baf  78701000  00701000  00502000  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 16 .init.rodata  00009ca8  78725000  00725000  00526000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 17 .init.data    00027408  7872eca8  0072eca8  0052fca8  2**3
                  CONTENTS, ALLOC, LOAD, DATA

All in all, we have 20 sections instead of 32, and it still boots okay.


Full listing:


Before:

$ objdump -h
linux-2.6.23-rc4.gc6.t/vmlinux:     file format elf32-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .head.text    00000379  78200000  00200000  00001000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .text         003646da  78200380  00200380  00001380  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 __ex_table    00000ee8  78564a60  00564a60  00365a60  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .notes        00000024  78565948  00565948  00366948  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  4 .rodata       000e85fe  78566000  00566000  00367000  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .pci_fixup    00000700  7864e600  0064e600  0044f600  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 __ksymtab     000057a0  7864ed00  0064ed00  0044fd00  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 __ksymtab_gpl 00001ac0  786544a0  006544a0  004554a0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 __ksymtab_gpl_future 00000018  78655f60  00655f60  00456f60  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 __kcrctab     00002bd0  78655f78  00655f78  00456f78  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 10 __kcrctab_gpl 00000d60  78658b48  00658b48  00459b48  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 11 __kcrctab_gpl_future 0000000c  786598a8  006598a8  0045a8a8  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 12 __ksymtab_strings 00010d8b  786598b4  006598b4  0045a8b4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 13 __param       00001838  7866a640  0066a640  0046b640  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 14 .data         0007fe99  7866c000  0066c000  0046d000  2**7
                  CONTENTS, ALLOC, LOAD, DATA
 15 .data_nosave  00001000  786ec000  006ec000  004ed000  2**12
                  CONTENTS, ALLOC, LOAD, DATA
 16 .page_aligned.data 00000800  786ed000  006ed000  004ee000  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 17 .cacheline_aligned.data 0000a000  786ed800  006ed800  004ee800  2**7
                  CONTENTS, ALLOC, LOAD, DATA
 18 .read_mostly.data 000020d0  786f7800  006f7800  004f8800  2**7
                  CONTENTS, ALLOC, LOAD, DATA
 19 .init_task.data 00002000  786fa000  006fa000  004fb000  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 20 .smp_locks    00004798  786fc000  006fc000  004fd000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 21 .init.text    000204a0  78701000  00701000  00502000  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 22 .init.data    000268db  787214a0  007214a0  005224a0  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 23 .init.setup   00000654  78747d80  00747d80  00548d80  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 24 .initcall.init 000004c4  787483d4  007483d4  005493d4  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 25 .con_initcall.init 00000008  78748898  00748898  00549898  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 26 .altinstructions 00009c23  787488a0  007488a0  005498a0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 27 .altinstr_replacement 000027de  787524c3  007524c3  005534c3  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 28 .exit.text    00000f31  78754ca4  00754ca4  00555ca4  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 29 .init.ramfs   00000086  78756000  00756000  00557000  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 30 .percpu.data  00005f38  78757000  00757000  00558000  2**12
                  CONTENTS, ALLOC, LOAD, DATA
 31 .bss          00047000  7875d000  0075d000  0055df38  2**12
                  ALLOC
 32 .comment      00005004  00000000  00000000  0055df38  2**0
                  CONTENTS, READONLY


After:

linux-2.6.23-rc4.gc7.t/vmlinux:     file format elf32-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00364a5a  78200000  00200000  00001000  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 __ex_table    00000ee8  78564a60  00564a60  00365a60  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .notes        00000024  78565948  00565948  00366948  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  3 .rodata       000e8602  78566000  00566000  00367000  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .pci_fixup    00000700  7864e604  0064e604  0044f604  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 __ksymtab     000057a0  7864ed04  0064ed04  0044fd04  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 __ksymtab_gpl 00001ac0  786544a4  006544a4  004554a4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 __ksymtab_gpl_future 00000018  78655f64  00655f64  00456f64  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 __kcrctab     00002bd0  78655f7c  00655f7c  00456f7c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 __kcrctab_gpl 00000d60  78658b4c  00658b4c  00459b4c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 10 __kcrctab_gpl_future 0000000c  786598ac  006598ac  0045a8ac  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 11 __ksymtab_strings 00010d8b  786598b8  006598b8  0045a8b8  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 12 __param       00001838  7866a644  0066a644  0046b644  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 13 .data         0008f7d0  7866c000  0066c000  0046d000  2**12
                  CONTENTS, ALLOC, LOAD, DATA
 14 .smp_locks    00004798  786fc000  006fc000  004fd000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 15 .init.text    00023baf  78701000  00701000  00502000  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 16 .init.rodata  00009ca8  78725000  00725000  00526000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 17 .init.data    00027408  7872eca8  0072eca8  0052fca8  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 18 .percpu.data  00005f38  78757000  00757000  00558000  2**12
                  CONTENTS, ALLOC, LOAD, DATA
 19 .bss          00047000  7875d000  0075d000  0055df38  2**12
                  ALLOC
 20 .comment      00005004  00000000  00000000  0055df38  2**0
                  CONTENTS, READONLY

Patch is run-tested.

It's purely cleanup work, it's not bringing any noticeable
size wins (well, maybe statistically it will have a bit less
alignment padding because I placed together a few page-aligned
chunks, but that's all).

Signed-off-by: Denys Vlasenko <vda.linux@...glemail.com>
--
vda

View attachment "linux-2.6.23-rc4.7.i386part2.patch" of type "text/x-diff" (6592 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ