From patchwork Wed Jan 20 09:05:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 570596 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id ACA50140B8C for ; Wed, 20 Jan 2016 20:14:14 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b=izDTD+Fe; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 7BE101A1974 for ; Wed, 20 Jan 2016 20:14:14 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b=izDTD+Fe; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-wm0-x231.google.com (mail-wm0-x231.google.com [IPv6:2a00:1450:400c:c09::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 0A19D1A180C for ; Wed, 20 Jan 2016 20:06:02 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b=izDTD+Fe; dkim-atps=neutral Received: by mail-wm0-x231.google.com with SMTP id r129so122107251wmr.0 for ; Wed, 20 Jan 2016 01:06:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LF0PKMvYq88TgqWdOECm17lJE9vs+4FZI0p5SFScYJM=; b=izDTD+FexF/bgtRQsAnoAKix8S9GDhlA4/d/4TjqBCd+WkRNMOE7BhHE8kZSATw6Qu CeRzGkm2K6l0IxpC9btW2fH5OGq/t23WXUnj3sDXNlqXACw+fM41mV2WEmWiqdO7Xsm0 nWhfyiGeTnhYBVn5sR8NSAsR3eufLu9RwZKwY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LF0PKMvYq88TgqWdOECm17lJE9vs+4FZI0p5SFScYJM=; b=FLsH0W0Y+smmVbADpTI/QT7uKp38gDDlGKBZXdzRi1MK7L6oC8jguXv8CrZwkHIe/a AzGbXpuzpipngJc7FE/Z8ngIZtw6LqFE8C7CTQzblNvqa4pNL1ceMKa8suMTHnCyAo3f Qyw4bPeBsErAr3Cj6ycCv4v4h/A5bdwBLDSJm+vgx9IeWPW5a4/hremW47xcuULiA4sH 7JMFJREXlWjT5ZZnn0tr7LXL9GbR+Ned3gLJBowN/vkZQkHtJD6jgbsd9zy23v/KPyQf 8oCwHSsO1cloMc16pyR0QvZ8M2+Xj2BUnHEe5byBvy2boNgfg3zKRhiZ6VKuxPfiU6sT lzFg== X-Gm-Message-State: ALoCoQnrpT8LBcs5FLc+VDiwqQLGKpG6FQ+zpqxZ1gDP3XMcoPGRxKHEwpEyAucavyga+MzZTUuchl4od94RVRfENXTqJMcVQQ== X-Received: by 10.194.238.162 with SMTP id vl2mr33749263wjc.91.1453280759135; Wed, 20 Jan 2016 01:05:59 -0800 (PST) Received: from localhost.localdomain (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by smtp.gmail.com with ESMTPSA id k130sm24234780wmg.6.2016.01.20.01.05.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Jan 2016 01:05:58 -0800 (PST) From: Ard Biesheuvel To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, keescook@chromium.org, akpm@linux-foundation.org, mingo@kernel.org, hpa@zytor.com, heiko.carstens@de.ibm.com, benh@kernel.crashing.org, mpe@ellerman.id.au, mmarek@suse.cz, rusty@rustcorp.com.au Subject: [PATCH 4/4] x86_64: enable text relative kallsyms for 64-bit targets Date: Wed, 20 Jan 2016 10:05:38 +0100 Message-Id: <1453280738-18721-5-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1453280738-18721-1-git-send-email-ard.biesheuvel@linaro.org> References: <1453280738-18721-1-git-send-email-ard.biesheuvel@linaro.org> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" This enables the newly introduced text-relative kallsyms support when building 64-bit targets. This cuts the size of the kallsyms address table in half, reducing the memory footprint of the kernel .rodata section by about 400 KB for a KALLSYMS_ALL build, and about 100 KB reduction in compressed size. (with CONFIG_RELOCATABLE=y) Signed-off-by: Ard Biesheuvel Tested-by: Kees Cook --- I tested this with my Ubuntu Wily box's config-4.2.0-23-generic, and got the following results: BEFORE: ======= $ size vmlinux text data bss dec hex filename 12972949 2213240 1482752 16668941 fe590d vmlinux $ readelf -S .tmp_kallsyms2.o |less There are 9 section headers, starting at offset 0x3e0788: Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align ... [ 4] .rodata PROGBITS 0000000000000000 00000040 00000000001c7738 0000000000000000 A 0 0 8 [ 5] .rela.rodata RELA 0000000000000000 001c7950 0000000000218e38 0000000000000018 I 7 4 8 [ 6] .shstrtab STRTAB 0000000000000000 001c7778 0000000000000039 0000000000000000 0 0 1 $ ls -l arch/x86/boot/bzImage -rw-rw-r-- 1 ard ard 6893168 Jan 20 09:36 arch/x86/boot/bzImage AFTER: ====== $ size vmlinux text data bss dec hex filename 12604501 2213240 1482752 16300493 f8b9cd vmlinux $ readelf -S .tmp_kallsyms2.o |less There are 8 section headers, starting at offset 0x16dd10: Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align ... [ 4] .rodata PROGBITS 0000000000000000 00000040 000000000016db20 0000000000000000 A 0 0 8 [ 5] .shstrtab STRTAB 0000000000000000 0016db60 0000000000000034 0000000000000000 0 0 1 ... $ ls -l arch/x86/boot/bzImage -rw-rw-r-- 1 ard ard 6790224 Jan 19 22:24 arch/x86/boot/bzImage --- arch/x86/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 4a10ba9e95da..180a94bda8d4 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -142,6 +142,7 @@ config X86 select HAVE_UNSTABLE_SCHED_CLOCK select HAVE_USER_RETURN_NOTIFIER select IRQ_FORCED_THREADING + select KALLSYMS_TEXT_RELATIVE if X86_64 select MODULES_USE_ELF_RELA if X86_64 select MODULES_USE_ELF_REL if X86_32 select OLD_SIGACTION if X86_32