Re: [PATCH v5 1/8] arch: enable relative relocations for arm64, power, x86, s390 and x86

2017-12-25 Thread Sam Ravnborg
Hi Ard. On Mon, Dec 25, 2017 at 08:54:33PM +, Ard Biesheuvel wrote: > Before updating certain subsystems to use place relative 32-bit > relocations in special sections, to save space and reduce the > number of absolute relocations that need to be processed at runtime > by relocatable

Re: [PATCH v5 1/8] arch: enable relative relocations for arm64, power, x86, s390 and x86

2017-12-25 Thread Ard Biesheuvel
On 25 December 2017 at 21:05, Sam Ravnborg wrote: > Hi Ard. > > On Mon, Dec 25, 2017 at 08:54:33PM +, Ard Biesheuvel wrote: >> Before updating certain subsystems to use place relative 32-bit >> relocations in special sections, to save space and reduce the >> number of

[PATCH v5 8/8] x86/kernel: jump_table: use relative references

2017-12-25 Thread Ard Biesheuvel
Similar to the arm64 case, 64-bit x86 can benefit from using 32-bit relative references rather than 64-bit absolute ones when emitting struct jump_entry instances. Not only does this reduce the memory footprint of the entries themselves by 50%, it also removes the need for carrying relocation

[PATCH v5 7/8] arm64/kernel: jump_label: use relative references

2017-12-25 Thread Ard Biesheuvel
On a randomly chosen distro kernel build for arm64, vmlinux.o shows the following sections, containing jump label entries, and the associated RELA relocation records, respectively: ... [38088] __jump_table PROGBITS 00e19f30 0002ea10

[PATCH v5 6/8] kernel/jump_label: abstract jump_entry member accessors

2017-12-25 Thread Ard Biesheuvel
In preparation of allowing architectures to use relative references in jump_label entries [which can dramatically reduce the memory footprint], introduce abstractions for references to the 'code' and 'key' members of struct jump_entry. Signed-off-by: Ard Biesheuvel ---

[PATCH v5 5/8] kernel: tracepoints: add support for relative references

2017-12-25 Thread Ard Biesheuvel
To avoid the need for relocating absolute references to tracepoint structures at boot time when running relocatable kernels (which may take a disproportionate amount of space), add the option to emit these tables as relative references instead. Cc: Steven Rostedt Cc: Ingo

[PATCH v5 4/8] PCI: Add support for relative addressing in quirk tables

2017-12-25 Thread Ard Biesheuvel
Allow the PCI quirk tables to be emitted in a way that avoids absolute references to the hook functions. This reduces the size of the entries, and, more importantly, makes them invariant under runtime relocation (e.g., for KASLR) Acked-by: Bjorn Helgaas Signed-off-by: Ard

[PATCH v5 3/8] init: allow initcall tables to be emitted using relative references

2017-12-25 Thread Ard Biesheuvel
Allow the initcall tables to be emitted using relative references that are only half the size on 64-bit architectures and don't require fixups at runtime on relocatable kernels. Cc: Petr Mladek Cc: Sergey Senozhatsky Cc: Steven Rostedt

[PATCH v5 2/8] module: use relative references for __ksymtab entries

2017-12-25 Thread Ard Biesheuvel
An ordinary arm64 defconfig build has ~64 KB worth of __ksymtab entries, each consisting of two 64-bit fields containing absolute references, to the symbol itself and to a char array containing its name, respectively. When we build the same configuration with KASLR enabled, we end up with an

[PATCH v5 1/8] arch: enable relative relocations for arm64, power, x86, s390 and x86

2017-12-25 Thread Ard Biesheuvel
Before updating certain subsystems to use place relative 32-bit relocations in special sections, to save space and reduce the number of absolute relocations that need to be processed at runtime by relocatable kernels, introduce the Kconfig symbol and define it for some architectures that should

[PATCH v5 0/8] add support for relative references in special sections

2017-12-25 Thread Ard Biesheuvel
This adds support for emitting special sections such as initcall arrays, PCI fixups and tracepoints as relative references rather than absolute references. This reduces the size by 50% on 64-bit architectures, but more importantly, it removes the need for carrying relocation metadata for these