From patchwork Fri Aug 23 17:23:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 172128 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp956731ily; Fri, 23 Aug 2019 10:24:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzgjLIqpTAKZLymkcgrtAQBb4djduwQz5UEGmTElwvzFrMDDdVrIMKmEn+2/f9GNn3r6Y3+ X-Received: by 2002:a17:902:aa09:: with SMTP id be9mr5869241plb.52.1566581072924; Fri, 23 Aug 2019 10:24:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566581072; cv=none; d=google.com; s=arc-20160816; b=aW+pu1WS13Kl/ojR7hDMRr6q2fZvU98vtK5sQozdnDP5yH5EkU6vEt2a2UbmP2pACy 3B8Pw6jdzyu27TeFDH5INCgr/U4Aojge3bsXr2BPHvlB1I6wjXJNmiNgbpOO1oOMgyGb FTx4WRRhcWJOkXLcLU/mIm87aAtQyGrR+JRRQ/izsLThP/yiXgQR3L1JXcTUYNXT2Dqr r9DvidtZrcrCnfjb/TKzxzCtyXNfhY6JNoKIssOyA3RKQRuiNEf+4RQ923qkeDWoYpE6 iGxVvAhWgbDTc1zSBYDOuzgtEe4G1+2FA4txF0qc/3LR35NbQD/ozniYvCsNrFTaNGzy 5yxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=CX8yasXqGFb0Pg9FKEid8Jkjybex60f6joit9P9dnyA=; b=yCjrYX4WlXRGe5vkVNk/Y7UPT3FJ/ems6nSVq7KT71D1V4NaQDHLDFROWUjP9jDaj6 tt6dE5CHNPQ1O6gB/aZUth03I6NjFl1Z1GkosM/AErWwwo3Z+dXG8BJfN8bZgCBxcFkq 4TVRUPl9Yk7V2Zc2Ketwc/32osh5MyYRW+lncYbG3YHpekzL0Hf3HugIa8fcVlDXHc5T 8y6neFjbBK9LUvkAV9dTX0XFaTedAgd/gm6VKnUqruhapxzQ2WtkZAxZmqMkHkul2Am0 douo1bf46jTryDkeMI3yIaS2hfglQYnZASvx0cjAqV0d8rmzDLRozw4MfLDLD94kb5+m AeXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k73si2434330pge.353.2019.08.23.10.24.32; Fri, 23 Aug 2019 10:24:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389412AbfHWRYb (ORCPT + 28 others); Fri, 23 Aug 2019 13:24:31 -0400 Received: from foss.arm.com ([217.140.110.172]:37596 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388090AbfHWRY1 (ORCPT ); Fri, 23 Aug 2019 13:24:27 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3D6C1337; Fri, 23 Aug 2019 10:24:27 -0700 (PDT) Received: from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 053C03F246; Fri, 23 Aug 2019 10:24:25 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, Kees Cook , Thomas Gleixner , Jann Horn , "H.J. Lu" , Eugene Syromiatnikov , Florian Weimer , Yu-cheng Yu , Peter Zijlstra Subject: [RFC PATCH v2 1/2] ELF: UAPI and Kconfig additions for ELF program properties Date: Fri, 23 Aug 2019 18:23:39 +0100 Message-Id: <1566581020-9953-2-git-send-email-Dave.Martin@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1566581020-9953-1-git-send-email-Dave.Martin@arm.com> References: <1566581020-9953-1-git-send-email-Dave.Martin@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pull the basic ELF definitions from Yu-Cheng Yu's series. Signed-off-by: Yu-cheng Yu Signed-off-by: Dave Martin --- This patch should be merged with the next patch. I kept it seprate for now to document where this code came from. Changes since RFC v1: * Move struct gnu_property to . There's currently no consensus about exactly what this should look like in the public headers, so keep in private to the kernel for now. Binutils etc. are using their own definitions anyway. --- fs/Kconfig.binfmt | 3 +++ include/linux/elf.h | 8 ++++++++ include/uapi/linux/elf.h | 1 + 3 files changed, 12 insertions(+) -- 2.1.4 diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt index 62dc4f5..d2cfe07 100644 --- a/fs/Kconfig.binfmt +++ b/fs/Kconfig.binfmt @@ -36,6 +36,9 @@ config COMPAT_BINFMT_ELF config ARCH_BINFMT_ELF_STATE bool +config ARCH_USE_GNU_PROPERTY + bool + config BINFMT_ELF_FDPIC bool "Kernel support for FDPIC ELF binaries" default y if !BINFMT_ELF diff --git a/include/linux/elf.h b/include/linux/elf.h index e3649b3..4485499 100644 --- a/include/linux/elf.h +++ b/include/linux/elf.h @@ -2,6 +2,7 @@ #ifndef _LINUX_ELF_H #define _LINUX_ELF_H +#include #include #include @@ -56,4 +57,11 @@ static inline int elf_coredump_extra_notes_write(struct coredump_params *cprm) { extern int elf_coredump_extra_notes_size(void); extern int elf_coredump_extra_notes_write(struct coredump_params *cprm); #endif + +/* NT_GNU_PROPERTY_TYPE_0 header */ +struct gnu_property { + __u32 pr_type; + __u32 pr_datasz; +}; + #endif /* _LINUX_ELF_H */ diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h index 34c02e4..c377314 100644 --- a/include/uapi/linux/elf.h +++ b/include/uapi/linux/elf.h @@ -36,6 +36,7 @@ typedef __s64 Elf64_Sxword; #define PT_LOPROC 0x70000000 #define PT_HIPROC 0x7fffffff #define PT_GNU_EH_FRAME 0x6474e550 +#define PT_GNU_PROPERTY 0x6474e553 #define PT_GNU_STACK (PT_LOOS + 0x474e551)