Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966515AbbBCRoA (ORCPT ); Tue, 3 Feb 2015 12:44:00 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:47179 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966418AbbBCRnx (ORCPT ); Tue, 3 Feb 2015 12:43:53 -0500 X-AuditID: cbfec7f4-b7f126d000001e9a-d0-54d10846bd33 From: Andrey Ryabinin To: linux-kernel@vger.kernel.org Cc: Andrey Ryabinin , Dmitry Vyukov , Konstantin Serebryany , Dmitry Chernenkov , Andrey Konovalov , Yuri Gribov , Konstantin Khlebnikov , Sasha Levin , Christoph Lameter , Joonsoo Kim , Andrew Morton , Dave Hansen , Andi Kleen , x86@kernel.org, linux-mm@kvack.org, Arnd Bergmann , linux-arch@vger.kernel.org (open list:GENERIC INCLUDE/A...) Subject: [PATCH v11 17/19] kernel: add support for .init_array.* constructors Date: Tue, 03 Feb 2015 20:43:10 +0300 Message-id: <1422985392-28652-18-git-send-email-a.ryabinin@samsung.com> X-Mailer: git-send-email 2.2.2 In-reply-to: <1422985392-28652-1-git-send-email-a.ryabinin@samsung.com> References: <1404905415-9046-1-git-send-email-a.ryabinin@samsung.com> <1422985392-28652-1-git-send-email-a.ryabinin@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrCLMWRmVeSWpSXmKPExsVy+t/xK7puHBdDDP40y1hs+/WIzeL33pms FnPWr2GzOHLtO7vF30nH2C2uf3vDaPHp5QNGi+cPH7JbTHjYxm6xsruZzWL7s7dMFis7H7Ba dOz6ymJxedccNot7a/6zWiw+cpvZ4t2zycwWPzY8ZnUQ8vj9axKjx/ydHxk9ds66y+6xYFOp x+I9L5k8Nq3qZPPY9GkSu0fX2ytMHidm/GbxeHJlOpPHx6e3WDz6tqxi9Pi8SS6AN4rLJiU1 J7MstUjfLoEr48ue+IJVvBWPb2xmbmDs4e5i5OSQEDCR+LZxNTOELSZx4d56ti5GLg4hgaWM ErPWnYZy+pgkrvzbyQJSxSagJ/Fv1nY2EFtEQEFic+8zVpAiZoE2Vokrr26ygySEBXwlZj1b zgRiswioSixcMRWsmVfAXWL2gmdAzRxA6+QkLnyMBwlzAoX39T9jhFjWxCjxZnEL8wRG3gWM DKsYRVNLkwuKk9JzDfWKE3OLS/PS9ZLzczcxQmLiyw7GxcesDjEKcDAq8fCuMLoQIsSaWFZc mXuIUYKDWUmEd89voBBvSmJlVWpRfnxRaU5q8SFGJg5OqQZGA75pTIF3Wl6y5qfXT5D2WTJ/ wbWe4tDGd93nP7nOCdTbLtu32iN8woGdzZ4pkpJJC25u3PT81UYhrxJ/nojJSudfn/OLNL9y oGVv+2MJ1RDdf2mXZr9YI77ljYGfQaCR9hPNs7KLWoq3T3R0TJpjZfvpaWn01BO77D7d/vPv 2bMD3+wnHjE7pMRSnJFoqMVcVJwIALaM0qFnAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1904 Lines: 52 KASan uses constructors for initializing redzones for global variables. Globals instrumentation in GCC 4.9.2 produces constructors with priority (.init_array.00099) Currently kernel ignores such constructors. Only constructors with default priority supported (.init_array) This patch adds support for constructors with priorities. For kernel image we put pointers to constructors between __ctors_start/__ctors_end and do_ctors() will call them on start up. For modules we merge .init_array.* sections into resulting .init_array. Module code properly handles constructors in .init_array section. Signed-off-by: Andrey Ryabinin --- include/asm-generic/vmlinux.lds.h | 1 + scripts/module-common.lds | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index bee5d68..ac78910 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -478,6 +478,7 @@ #define KERNEL_CTORS() . = ALIGN(8); \ VMLINUX_SYMBOL(__ctors_start) = .; \ *(.ctors) \ + *(SORT(.init_array.*)) \ *(.init_array) \ VMLINUX_SYMBOL(__ctors_end) = .; #else diff --git a/scripts/module-common.lds b/scripts/module-common.lds index 0865b3e..01c5849 100644 --- a/scripts/module-common.lds +++ b/scripts/module-common.lds @@ -16,4 +16,7 @@ SECTIONS { __kcrctab_unused : { *(SORT(___kcrctab_unused+*)) } __kcrctab_unused_gpl : { *(SORT(___kcrctab_unused_gpl+*)) } __kcrctab_gpl_future : { *(SORT(___kcrctab_gpl_future+*)) } + + . = ALIGN(8); + .init_array : { *(SORT(.init_array.*)) *(.init_array) } } -- 2.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/