From patchwork Thu Nov 8 20:13:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 995171 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-97081-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="BnT1IU9x"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42rZHV5TKZz9s7T for ; Fri, 9 Nov 2018 07:13:58 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; q=dns; s= default; b=jION36bcLTBYFkrQeBcnp0ApVZDTNDSfWVEJq9Lt5bmMKNRaaPEzm oJl44NR1RQJhMduGWuzTo7uE+HbAC5zyCd2jY7mbCvzO5Aa2ytzGMVWNWYrgaBv1 JqD96xFi8R72OOU1i3aEina34PgompvaaY1LCdXz4hKf210g8Ifi8g= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; s=default; bh=9wKPT9hsloCMrggkzIMFf6WO2Y8=; b=BnT1IU9xHuvLaj+bO7DzqNvNQBOD CVQsa6NQmR1amRo7BHBAulNfLonsNL1GGvYPLAG6hSQPA+v8rlQN5mjdn9DHBYec 5jS5Gsa/D2X60VYmvB3B3Gm9Kz2hdGsblyYV7Ep6B+0mPrhJXRYRA7T2jlhE6ACL F/Zv5+hVZ4YhiLg= Received: (qmail 19540 invoked by alias); 8 Nov 2018 20:13:46 -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 19419 invoked by uid 89); 8 Nov 2018 20:13:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.2 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: mga18.intel.com From: "H.J. Lu" To: libc-alpha@sourceware.org Subject: [PATCH 2/2] x86/CET: Stop if the GNU_PROPERTY_X86_UINT32_VALID bit is set Date: Thu, 8 Nov 2018 12:13:40 -0800 Message-Id: <20181108201340.29845-3-hjl.tools@gmail.com> In-Reply-To: <20181108201340.29845-1-hjl.tools@gmail.com> References: <20181108201340.29845-1-hjl.tools@gmail.com> MIME-Version: 1.0 When updated linkers merge input .note.gnu.property sections into one .note.gnu.property section, it sets the GNU_PROPERTY_X86_UINT32_VALID bit in the GNU_PROPERTY_X86_FEATURE_1_AND property. This can be used to detect if the NT_GNU_PROPERTY_TYPE_0 note is generated by updated linkers. If the GNU_PROPERTY_X86_UINT32_VALID bit is set, we can stop checking for invalid .note.gnu.property section. * sysdeps/x86/dl-prop.h (_dl_process_cet_property_note): Stop if the GNU_PROPERTY_X86_UINT32_VALID bit is set. --- sysdeps/x86/dl-prop.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sysdeps/x86/dl-prop.h b/sysdeps/x86/dl-prop.h index 9ab890d12b..5c06aa5fbc 100644 --- a/sysdeps/x86/dl-prop.h +++ b/sysdeps/x86/dl-prop.h @@ -115,6 +115,11 @@ _dl_process_cet_property_note (struct link_map *l, feature_1 = *(unsigned int *) ptr; + /* Done if this property note is created by updated + linker. */ + if ((feature_1 & GNU_PROPERTY_X86_UINT32_VALID)) + goto found_feature_1; + /* Keep searching for the next GNU property note generated by the older linker. */ break; @@ -138,6 +143,7 @@ _dl_process_cet_property_note (struct link_map *l, align)); } +found_feature_1: /* We get here only if there is one or no GNU property note. */ if ((feature_1 & GNU_PROPERTY_X86_FEATURE_1_IBT)) l->l_cet |= lc_ibt;