From patchwork Tue Oct 31 16:37:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lu, Hongjiu" X-Patchwork-Id: 24024 Received: (qmail 80660 invoked by alias); 31 Oct 2017 16:37:16 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 80640 invoked by uid 89); 31 Oct 2017 16:37:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, NO_DNS_FOR_FROM, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Initial X-HELO: mga05.intel.com X-ExtLoop1: 1 Date: Tue, 31 Oct 2017 09:37:12 -0700 From: "H.J. Lu" To: GNU C Library Subject: [PATCH] ld.so: Add architecture specific fields Message-ID: <20171031163712.GA10434@gmail.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.1 (2017-09-22) To support Intel Control-flow Enforcement Technology (CET) run-time control: 1. An architecture specific field in the writable ld.so namespace is needed to indicate if CET features are enabled at run-time. 2. An architecture specific field in struct link_map is needed if CET features are enabled in an ELF module. This patch adds dl-procruntime.c to the writable ld.so namespace and link_map.h to struct link_map. Tested on x86-64. Any comments? H.J. --- * elf/dl-support.c: Include . * include/link.h: Include . * sysdeps/generic/dl-procruntime.c: New file. * sysdeps/generic/link_map.h: Likewise. * sysdeps/generic/ldsodefs.h: Include in the writable ld.so namespace. --- elf/dl-support.c | 1 + include/link.h | 2 ++ sysdeps/generic/dl-procruntime.c | 1 + sysdeps/generic/ldsodefs.h | 11 +++++++---- sysdeps/generic/link_map.h | 1 + 5 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 sysdeps/generic/dl-procruntime.c create mode 100644 sysdeps/generic/link_map.h diff --git a/elf/dl-support.c b/elf/dl-support.c index 5e3de90598..235d3a7f46 100644 --- a/elf/dl-support.c +++ b/elf/dl-support.c @@ -126,6 +126,7 @@ int _dl_starting_up = 1; void *_dl_random; /* Get architecture specific initializer. */ +#include #include /* Initial value of the CPU clock. */ diff --git a/include/link.h b/include/link.h index 3e1b2aefb7..82b77a6b41 100644 --- a/include/link.h +++ b/include/link.h @@ -203,6 +203,8 @@ struct link_map freed, ie. not allocated with the dummy malloc in ld.so. */ +#include + /* Collected information about own RPATH directories. */ struct r_search_path_struct l_rpath_dirs; diff --git a/sysdeps/generic/dl-procruntime.c b/sysdeps/generic/dl-procruntime.c new file mode 100644 index 0000000000..a056184690 --- /dev/null +++ b/sysdeps/generic/dl-procruntime.c @@ -0,0 +1 @@ +/* No architecture specific definitions. */ diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 5efae2d96d..52a792a597 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -373,6 +373,13 @@ struct rtld_global EXTERN void (*_dl_rtld_unlock_recursive) (void *); #endif + /* Get architecture specific definitions. */ +#define PROCINFO_DECL +#ifndef PROCINFO_CLASS +# define PROCINFO_CLASS EXTERN +#endif +#include + /* If loading a shared object requires that we make the stack executable when it was not, we do it by calling this function. It returns an errno code or zero on success. */ @@ -529,10 +536,6 @@ struct rtld_global_ro #endif /* Get architecture specific definitions. */ -#define PROCINFO_DECL -#ifndef PROCINFO_CLASS -# define PROCINFO_CLASS EXTERN -#endif #include /* Names of shared object for which the RPATH should be ignored. */ diff --git a/sysdeps/generic/link_map.h b/sysdeps/generic/link_map.h new file mode 100644 index 0000000000..a056184690 --- /dev/null +++ b/sysdeps/generic/link_map.h @@ -0,0 +1 @@ +/* No architecture specific definitions. */