From patchwork Wed Dec 11 15:41:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 181263 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp701307ile; Wed, 11 Dec 2019 07:43:42 -0800 (PST) X-Google-Smtp-Source: APXvYqyUWp3aV37gJaYAnGY8PkmT6HMCi9mfYQN+m18oskoJKx+q47x60DP5VPhB56tHRvb7gDJE X-Received: by 2002:aca:1704:: with SMTP id j4mr3326761oii.21.1576079022207; Wed, 11 Dec 2019 07:43:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576079022; cv=none; d=google.com; s=arc-20160816; b=k+O6DlfB46hPo8rogRGP4FO60SviI6sJbwZeOlLRfYH4MrTdE/Qjn60ieJt4/y5M4y viJ/GAbJNUCTKSYXvGo9jCoqvIAnqD2fYUZdmVn9bW3nqZIucq/T//h14Rn3un5lzDdy QD6/eIukZFPnRyQMtZvO2+uuLyD/gJGhzP1poJjVZLGgbTRGSac7ovf4+vnbOCKehIoP vBJI20/IYpopu6lOhwBcWkut4aW9ny9cfMrCfng1g6BDeDsmorSxTgYHTx30OMs1pCxY t1BidC7E5jhGCCveHvP6adT97GQUZSDfN8nzV7JAkCZMjbD2oaeMadf3UboiUFuehXve vX8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=QebfjIu1BY2Pb3nS1pbRo8zxLzcuq5WCUAnAe7D8+q0=; b=md/IVZmImt2U+9EHnVHpBFVwDya4BkhohKt35CLTCx5gyCU0jcmZs1YbZYFGfxjPYn 6rs+lGg4lrDLzva7TtezHwn1Y0GWcTyg8xJ6a02zMfXB93xNaDrJI018xKNpOTODBnoH 2eFQVmw23uR7sPHLUFIps4Fu3JAYYvdWHkl9hRKzdV1fqkyfjHSdk+lIi4IhWO0rlIaf D5X496F7ZdIMnBXkdvP3h8O2tNufnVCToJBmJ/YFM0nvy0OfYV6iVKALydoBndRcKjPn B9iOTzGq8lo5Re6UpIpNKULN0X0GcRt6Mem3kW0drSWg0W0g3ZLpSEWFzg/Rm9dNsX4N CDzQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v14si1178532oto.127.2019.12.11.07.43.41; Wed, 11 Dec 2019 07:43:42 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388011AbfLKPnk (ORCPT + 27 others); Wed, 11 Dec 2019 10:43:40 -0500 Received: from foss.arm.com ([217.140.110.172]:35356 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388678AbfLKPmw (ORCPT ); Wed, 11 Dec 2019 10:42:52 -0500 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 0FC7631B; Wed, 11 Dec 2019 07:42:52 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5A4C03F52E; Wed, 11 Dec 2019 07:42:51 -0800 (PST) From: Mark Brown To: Catalin Marinas , Will Deacon Cc: Paul Elliott , Peter Zijlstra , Yu-cheng Yu , Amit Kachhap , Vincenzo Frascino , Marc Zyngier , Eugene Syromiatnikov , Szabolcs Nagy , "H.J. Lu" , Andrew Jones , Kees Cook , Arnd Bergmann , Jann Horn , Richard Henderson , =?utf-8?q?Kristina_Mart=C5=A1enko?= , Thomas Gleixner , Florian Weimer , Sudakshina Das , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Dave Martin , Mark Brown Subject: [PATCH v4 01/12] ELF: UAPI and Kconfig additions for ELF program properties Date: Wed, 11 Dec 2019 15:41:55 +0000 Message-Id: <20191211154206.46260-2-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191211154206.46260-1-broonie@kernel.org> References: <20191211154206.46260-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Martin Pull the basic ELF definitions relating to the NT_GNU_PROPERTY_TYPE_0 note from Yu-Cheng Yu's earlier x86 shstk series. Signed-off-by: Yu-cheng Yu Signed-off-by: Dave Martin Reviewed-by: Kees Cook Signed-off-by: Mark Brown --- fs/Kconfig.binfmt | 3 +++ include/linux/elf.h | 8 ++++++++ include/uapi/linux/elf.h | 1 + 3 files changed, 12 insertions(+) -- 2.20.1 diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt index 62dc4f577ba1..d2cfe0729a73 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 e3649b3e970e..459cddcceaac 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 34c02e4290fe..c37731407074 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)