From patchwork Wed May 24 19:41:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tulio Magno Quites Machado Filho X-Patchwork-Id: 766660 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3wY2qx4lbWz9sP8 for ; Thu, 25 May 2017 05:43:09 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="Swk8D+zY"; dkim-atps=neutral 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:cc:subject:date:message-id; q=dns; s= default; b=OC2hj/USCXWI2s8OYOw7SFsR/R/m7ybFy2Rw7IZM+WNshkdxyBouN rUZhpxzIAYpkDScx4I6CBEh882ljFC2qU06NjtRzw5VfU8EH0gE16Xow8r8IfSBQ ysEeJAjEF1FKrzeINwpyirwQGna1rKMZzArsx1dgHXiEJGFnNz1Asg= 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:cc:subject:date:message-id; s=default; bh=PRsuTbbHId9CK9YXvEpBCKcPrf8=; b=Swk8D+zYqevPemarA1krF6gX8xph KgzqKREj/wZQS0kFataOJnZQeQy22TFQI3lsd1kbWfA3Z0bXhdCJiZMkS3xPixfx dncJOX+/FftBmwW2LONDxltfxY/WSY1J50z787IznK/5jKI1efCPeHCTCCbXmqdf 55mrj28sSeOP+7Q= Received: (qmail 82866 invoked by alias); 24 May 2017 19:42:57 -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 82378 invoked by uid 89); 24 May 2017 19:42:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com From: "Tulio Magno Quites Machado Filho" To: libc-alpha@sourceware.org Cc: pc@us.ibm.com Subject: [PATCH] Add a way to bypass the PLT when calling getauxval Date: Wed, 24 May 2017 16:41:23 -0300 X-TM-AS-MML: disable x-cbid: 17052419-0032-0000-0000-00000561F306 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17052419-0033-0000-0000-000011E75CC6 Message-Id: <1495654883-24546-1-git-send-email-tuliom@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-24_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705240093 Add __libc_getauxval as an internal libc symbol allowing internal libc calls to bypass the PLT. This is leaving the ABI as it was: getauxval continues to be exported as a weak symbol and __getauxval as a global symbol. 2017-05-24 Tulio Magno Quites Machado Filho * include/sys/auxv.h: Add a prototype for __libc_getauxval. * misc/getauxval.c (__getauxval): Rename to __libc_getauxval and add the strong alias __getauxval to __libc_getauxval. --- include/sys/auxv.h | 2 ++ misc/getauxval.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/sys/auxv.h b/include/sys/auxv.h index dede2c3..7b6ad3b 100644 --- a/include/sys/auxv.h +++ b/include/sys/auxv.h @@ -1 +1,3 @@ #include + +extern __typeof (getauxval) __libc_getauxval; diff --git a/misc/getauxval.c b/misc/getauxval.c index c83fbce..ff3e0ba 100644 --- a/misc/getauxval.c +++ b/misc/getauxval.c @@ -21,7 +21,8 @@ unsigned long int -__getauxval (unsigned long int type) +attribute_hidden +__libc_getauxval (unsigned long int type) { #ifdef HAVE_AUX_VECTOR ElfW(auxv_t) *p; @@ -42,4 +43,5 @@ __getauxval (unsigned long int type) return 0; } -weak_alias (__getauxval, getauxval) +weak_alias (__libc_getauxval, getauxval) +strong_alias (__libc_getauxval, __getauxval)