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: 20568 X-Patchwork-Delegate: joseph@codesourcery.com 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)