From patchwork Thu Sep 21 14:31:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Cambus X-Patchwork-Id: 142803 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp4890620vqi; Thu, 21 Sep 2023 07:31:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQnTKaKMMP3rvRLPF0Hl3p2q9mCR6Utv0jLWjR1w2E/8qY8rvg24qj4tkZsi1yvawF+wW6 X-Received: by 2002:a2e:96c4:0:b0:2bd:1804:29fa with SMTP id d4-20020a2e96c4000000b002bd180429famr5557909ljj.39.1695306688383; Thu, 21 Sep 2023 07:31:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695306688; cv=none; d=google.com; s=arc-20160816; b=CbTXYlWAWuz7F2hKZjLwiBYiiUuppidarOn+t24X975dOd/0eM4EWORNLV2YpTV9Bi nUX1+6lJSIHLz1ERwT5uRNy+MJYyzLp7Eiu0f1seWemAnx+0Y1htgyaPItDjWpSE1QWS V4CAwNT1Q/GJ1RTNIFw3+2Zjblg1qi0i8ShTd7YgKX28/7yp9GbPysMkyeGhT0a8z1fz FDT9owyQOb+NyzvzlVqDPfbfWaI+1+WyAaBCbSRE5luJlfpppHuGzLaOx+9fLC0ako0g iz5ksSXzzl4A2++hllWQP55NzFMU/r4f22vMWNhzIWcx3ZZVC2tBBerAQVSPEGGRdZYg cnqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:message-id:subject:to:from:date:feedback-id :dkim-signature:dkim-signature:dmarc-filter:delivered-to; bh=oTxlJHfltYVcUC96X77Sa2DUdEV1+GCBsX72YCJGPv8=; fh=NLxAvL/bDfPg4AGOtxqvQlND8vazkZrNzKLY8+LAbBY=; b=m4u2KrvFwmjMRLn7LjA7H1r/LYPZZo9BWWJplX2iKakR+y6HGQ3CT0pxaErCxVOzfp MgWcSIZYGwgj5bX54GSctc6N2qo/GazQWtnSIC27qRewtHARJuMCTUTaapFCYlcP91BE W7dO4o4FhPHH0qyfVFWQlUt/FcgV0b8FQh9dO9NvTcVU68uIQ4DBoKDdfhbqG6Mjt3Ph FEKaVIq7G0UIPrQSRyNkNxxDEdV9/ZdVA1xjsT5eyPvr7NJL4KSluA92LJ9p691c4w4z 5tIR4eeK++KsAZ0xTXwTZYb0xpHu2j48Ypi9BthY3Aso2sxk/9AzvT20mlKP1K3UwgOn LUEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@statdns.com header.s=fm1 header.b="T3M/PPZR"; dkim=fail header.i=@messagingengine.com header.s=fm2 header.b=f3niBaa4; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id n21-20020a170906701500b0099b7a166dccsi1274470ejj.308.2023.09.21.07.31.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 07:31:28 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=fail header.i=@statdns.com header.s=fm1 header.b="T3M/PPZR"; dkim=fail header.i=@messagingengine.com header.s=fm2 header.b=f3niBaa4; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DFFEC38582A9 for ; Thu, 21 Sep 2023 14:31:25 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by sourceware.org (Postfix) with ESMTPS id 06D5B3858C74 for ; Thu, 21 Sep 2023 14:31:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 06D5B3858C74 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=statdns.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=statdns.com Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id D43E35C006E for ; Thu, 21 Sep 2023 10:31:19 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 21 Sep 2023 10:31:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=statdns.com; h= cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm1; t=1695306679; x=1695393079; bh=oTxlJHfltYVcUC96X77Sa2DUd EV1+GCBsX72YCJGPv8=; b=T3M/PPZR0mOsYa1ptWyu5QApamXhw3UzpA+hGCV7f hJNloIR6Q6wVbnKvNar8gUn8X/lMKdIgjHPsr0u8O6B8s6bBYNX9O+DmWSDUv1Rp oXRqaTQEryc5sw1Q2LWwy8OhYERrlIEqJ89WkqwGzmLfiGXIlvOM/IJSNsXg5le7 S8EE2xJGGEaJQNgvM0wzp1qPmp5978SYWjLEo898LlvByMBbSwGKdFiIPkR+bgsN M7b+YN9ZOrZd7eYnb8BpyV8E5mug04ukTdvFfxqHppOsR6FzmWzStHmlkcPVvNYT Ww/RqJKCwxQXnK0KBXUbIzING6B/0GdCqOUvhTaWyv2CA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1695306679; x=1695393079; bh=oTxlJHfltYVcUC96X77Sa2DUdEV1+GCBsX7 2YCJGPv8=; b=f3niBaa4BTp1+u9XcXvHd8eH/6eTJL8pIkRViUN7aqxs19XNi3z OWhUNHNUjkb01C2D1zxq0qLtTLvBOC4mrnrMfdepdGvpTpOKOvC+j7R4SvstVXIl NcslTEOAhr2NgMffN9heBiTipIbn1Ty3dXrX9919IX3fOLQmjmx099GN8b4oC1cX WbfaCHKylkQcnD6rlN7+Obr5nVeyCzHdV0bxqvIu8LBGgMZy5dJNClBjblJLVyNh mHlivDvQQZhVFP7D7AkzAkkKfIsCbz0oVa3+mFlcIgrOomyFTmfJt2ULbCHgAFLj F5LkIiNStHqrtnehzcIzrGxJWAHL5xUVsvQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudekiedgjeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkgggtugesthdtrodttd dtvdenucfhrhhomhephfhrvgguvghrihgtucevrghmsghushcuoehfrhgvugesshhtrght ughnshdrtghomheqnecuggftrfgrthhtvghrnhephfffleffveevteetheeugefgffffge elgedukedtteeftdeuuefhudehgfeftedtnecuvehluhhsthgvrhfuihiivgeptdenucfr rghrrghmpehmrghilhhfrhhomhepfhhrvggusehsthgrthgunhhsrdgtohhm X-ME-Proxy: Feedback-ID: ic0e9462c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 21 Sep 2023 10:31:18 -0400 (EDT) Date: Thu, 21 Sep 2023 16:31:16 +0200 From: Frederic Cambus To: binutils@sourceware.org Subject: [PATCH] Add support to readelf for the PT_OPENBSD_NOBTCFI segment type. Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777657906066468663 X-GMAIL-MSGID: 1777657906066468663 binutils * readelf.c (get_segment_type): Handle PT_OPENBSD_NOBTCFI segment type. include * elf/common.h (PT_OPENBSD_NOBTCFI): Define. --- binutils/ChangeLog | 5 +++++ binutils/readelf.c | 1 + include/ChangeLog | 4 ++++ include/elf/common.h | 1 + 4 files changed, 11 insertions(+) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index ac14aff1827..4e58cc2e3dd 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2023-09-21 Frederic Cambus + + * readelf.c (get_segment_type): Handle PT_OPENBSD_NOBTCFI segment + type. + 2023-09-05 Nick Clifton PR 30684 diff --git a/binutils/readelf.c b/binutils/readelf.c index e9935c010cf..be2f3851c63 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -5082,6 +5082,7 @@ get_segment_type (Filedata * filedata, unsigned long p_type) case PT_OPENBSD_MUTABLE: return "OPENBSD_MUTABLE"; case PT_OPENBSD_RANDOMIZE: return "OPENBSD_RANDOMIZE"; case PT_OPENBSD_WXNEEDED: return "OPENBSD_WXNEEDED"; + case PT_OPENBSD_NOBTCFI: return "OPENBSD_NOBTCFI"; case PT_OPENBSD_BOOTDATA: return "OPENBSD_BOOTDATA"; default: diff --git a/include/ChangeLog b/include/ChangeLog index eb54da44146..90eb51f9208 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2023-09-21 Frederic Cambus + + * elf/common.h (PT_OPENBSD_NOBTCFI): Define. + 2023-08-02 Tom Tromey * coff/x86_64.h (COFF_X86_64_H): Add include guard. diff --git a/include/elf/common.h b/include/elf/common.h index 932ea94e3ae..ad95dbc965f 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -495,6 +495,7 @@ #define PT_OPENBSD_MUTABLE (PT_LOOS + 0x5a3dbe5) /* Like bss, but not immutable. */ #define PT_OPENBSD_RANDOMIZE (PT_LOOS + 0x5a3dbe6) /* Fill with random data. */ #define PT_OPENBSD_WXNEEDED (PT_LOOS + 0x5a3dbe7) /* Program does W^X violations. */ +#define PT_OPENBSD_NOBTCFI (PT_LOOS + 0x5a3dbe8) /* no branch target CFI. */ #define PT_OPENBSD_BOOTDATA (PT_LOOS + 0x5a41be6) /* Section for boot arguments. */ /* Mbind segments */