* [PATCH] Add a way to bypass the PLT when calling getauxval
@ 2017-05-24 19:42 Tulio Magno Quites Machado Filho
2017-05-24 19:52 ` Joseph Myers
0 siblings, 1 reply; 9+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-05-24 19:42 UTC (permalink / raw)
To: libc-alpha; +Cc: pc
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 <tuliom@linux.vnet.ibm.com>
* 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 <misc/sys/auxv.h>
+
+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)
--
2.1.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Add a way to bypass the PLT when calling getauxval
2017-05-24 19:42 [PATCH] Add a way to bypass the PLT when calling getauxval Tulio Magno Quites Machado Filho
@ 2017-05-24 19:52 ` Joseph Myers
2017-05-24 21:43 ` Tulio Magno Quites Machado Filho
2017-05-25 20:06 ` [PATCHv2] " Tulio Magno Quites Machado Filho
0 siblings, 2 replies; 9+ messages in thread
From: Joseph Myers @ 2017-05-24 19:52 UTC (permalink / raw)
To: Tulio Magno Quites Machado Filho; +Cc: libc-alpha, pc
On Wed, 24 May 2017, Tulio Magno Quites Machado Filho wrote:
> Add __libc_getauxval as an internal libc symbol allowing internal libc
> calls to bypass the PLT.
Why add this alias instead of simply doing libc_hidden_proto (__getauxval)
/ libc_hidden_def (__getauxval)?
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Add a way to bypass the PLT when calling getauxval
2017-05-24 19:52 ` Joseph Myers
@ 2017-05-24 21:43 ` Tulio Magno Quites Machado Filho
2017-05-25 20:06 ` [PATCHv2] " Tulio Magno Quites Machado Filho
1 sibling, 0 replies; 9+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-05-24 21:43 UTC (permalink / raw)
To: Joseph Myers; +Cc: libc-alpha, pc
Joseph Myers <joseph@codesourcery.com> writes:
> On Wed, 24 May 2017, Tulio Magno Quites Machado Filho wrote:
>
>> Add __libc_getauxval as an internal libc symbol allowing internal libc
>> calls to bypass the PLT.
>
> Why add this alias instead of simply doing libc_hidden_proto (__getauxval)
> / libc_hidden_def (__getauxval)?
Because I made a wrong assumption about those macros.
I'll fix my patch and re-submit.
Thanks!
--
Tulio Magno
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCHv2] Add a way to bypass the PLT when calling getauxval
2017-05-24 19:52 ` Joseph Myers
2017-05-24 21:43 ` Tulio Magno Quites Machado Filho
@ 2017-05-25 20:06 ` Tulio Magno Quites Machado Filho
2017-06-09 13:14 ` Tulio Magno Quites Machado Filho
2017-06-09 13:33 ` Florian Weimer
1 sibling, 2 replies; 9+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-05-25 20:06 UTC (permalink / raw)
To: libc-alpha; +Cc: pc, joseph
2017-05-25 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
* include/sys/auxv.h (__getauxval): Add a prototype and its
libc_hidden_proto.
* misc/getauxval.c (__getauxval): Use libc_hidden_def.
---
include/sys/auxv.h | 7 +++++++
misc/getauxval.c | 1 +
2 files changed, 8 insertions(+)
diff --git a/include/sys/auxv.h b/include/sys/auxv.h
index dede2c3..d46008e 100644
--- a/include/sys/auxv.h
+++ b/include/sys/auxv.h
@@ -1 +1,8 @@
#include <misc/sys/auxv.h>
+
+#ifndef _ISOMAC
+
+extern __typeof(getauxval) __getauxval;
+libc_hidden_proto (__getauxval)
+
+#endif /* !_ISOMAC */
diff --git a/misc/getauxval.c b/misc/getauxval.c
index c83fbce..14f4298 100644
--- a/misc/getauxval.c
+++ b/misc/getauxval.c
@@ -43,3 +43,4 @@ __getauxval (unsigned long int type)
}
weak_alias (__getauxval, getauxval)
+libc_hidden_def (__getauxval)
--
2.1.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCHv2] Add a way to bypass the PLT when calling getauxval
2017-05-25 20:06 ` [PATCHv2] " Tulio Magno Quites Machado Filho
@ 2017-06-09 13:14 ` Tulio Magno Quites Machado Filho
2017-06-09 13:29 ` H.J. Lu
2017-06-09 13:33 ` Florian Weimer
1 sibling, 1 reply; 9+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-06-09 13:14 UTC (permalink / raw)
To: libc-alpha; +Cc: pc, joseph
Ping!
Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com> writes:
> 2017-05-25 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
>
> * include/sys/auxv.h (__getauxval): Add a prototype and its
> libc_hidden_proto.
> * misc/getauxval.c (__getauxval): Use libc_hidden_def.
> ---
> include/sys/auxv.h | 7 +++++++
> misc/getauxval.c | 1 +
> 2 files changed, 8 insertions(+)
>
> diff --git a/include/sys/auxv.h b/include/sys/auxv.h
> index dede2c3..d46008e 100644
> --- a/include/sys/auxv.h
> +++ b/include/sys/auxv.h
> @@ -1 +1,8 @@
> #include <misc/sys/auxv.h>
> +
> +#ifndef _ISOMAC
> +
> +extern __typeof(getauxval) __getauxval;
> +libc_hidden_proto (__getauxval)
> +
> +#endif /* !_ISOMAC */
> diff --git a/misc/getauxval.c b/misc/getauxval.c
> index c83fbce..14f4298 100644
> --- a/misc/getauxval.c
> +++ b/misc/getauxval.c
> @@ -43,3 +43,4 @@ __getauxval (unsigned long int type)
> }
>
> weak_alias (__getauxval, getauxval)
> +libc_hidden_def (__getauxval)
> --
> 2.1.0
>
--
Tulio Magno
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCHv2] Add a way to bypass the PLT when calling getauxval
2017-06-09 13:14 ` Tulio Magno Quites Machado Filho
@ 2017-06-09 13:29 ` H.J. Lu
2017-06-09 13:34 ` Florian Weimer
0 siblings, 1 reply; 9+ messages in thread
From: H.J. Lu @ 2017-06-09 13:29 UTC (permalink / raw)
To: Tulio Magno Quites Machado Filho; +Cc: GNU C Library, pc, Joseph S. Myers
On Fri, Jun 9, 2017 at 6:13 AM, Tulio Magno Quites Machado Filho
<tuliom@linux.vnet.ibm.com> wrote:
> Ping!
>
> Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com> writes:
>
>> 2017-05-25 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
>>
>> * include/sys/auxv.h (__getauxval): Add a prototype and its
>> libc_hidden_proto.
>> * misc/getauxval.c (__getauxval): Use libc_hidden_def.
>> ---
>> include/sys/auxv.h | 7 +++++++
>> misc/getauxval.c | 1 +
>> 2 files changed, 8 insertions(+)
>>
>> diff --git a/include/sys/auxv.h b/include/sys/auxv.h
>> index dede2c3..d46008e 100644
>> --- a/include/sys/auxv.h
>> +++ b/include/sys/auxv.h
>> @@ -1 +1,8 @@
>> #include <misc/sys/auxv.h>
>> +
>> +#ifndef _ISOMAC
>> +
>> +extern __typeof(getauxval) __getauxval;
>> +libc_hidden_proto (__getauxval)
>> +
>> +#endif /* !_ISOMAC */
>> diff --git a/misc/getauxval.c b/misc/getauxval.c
>> index c83fbce..14f4298 100644
>> --- a/misc/getauxval.c
>> +++ b/misc/getauxval.c
>> @@ -43,3 +43,4 @@ __getauxval (unsigned long int type)
>> }
>>
>> weak_alias (__getauxval, getauxval)
>> +libc_hidden_def (__getauxval)
>> --
>> 2.1.0
>>
Which one is better?
https://sourceware.org/ml/libc-alpha/2017-06/msg00332.html
--
H.J.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCHv2] Add a way to bypass the PLT when calling getauxval
2017-05-25 20:06 ` [PATCHv2] " Tulio Magno Quites Machado Filho
2017-06-09 13:14 ` Tulio Magno Quites Machado Filho
@ 2017-06-09 13:33 ` Florian Weimer
2017-06-09 15:01 ` Tulio Magno Quites Machado Filho
1 sibling, 1 reply; 9+ messages in thread
From: Florian Weimer @ 2017-06-09 13:33 UTC (permalink / raw)
To: Tulio Magno Quites Machado Filho; +Cc: libc-alpha, pc, joseph
"Tulio Magno Quites Machado Filho" <tuliom@linux.vnet.ibm.com> writes:
> +extern __typeof(getauxval) __getauxval;
Missing space before paren.
> diff --git a/misc/getauxval.c b/misc/getauxval.c
> index c83fbce..14f4298 100644
> --- a/misc/getauxval.c
> +++ b/misc/getauxval.c
> @@ -43,3 +43,4 @@ __getauxval (unsigned long int type)
> }
>
> weak_alias (__getauxval, getauxval)
> +libc_hidden_def (__getauxval)
Looks good.
Thanks,
Florian
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCHv2] Add a way to bypass the PLT when calling getauxval
2017-06-09 13:29 ` H.J. Lu
@ 2017-06-09 13:34 ` Florian Weimer
0 siblings, 0 replies; 9+ messages in thread
From: Florian Weimer @ 2017-06-09 13:34 UTC (permalink / raw)
To: H.J. Lu
Cc: Tulio Magno Quites Machado Filho, GNU C Library, pc, Joseph S. Myers
"H.J. Lu" <hjl.tools@gmail.com> writes:
>>> diff --git a/misc/getauxval.c b/misc/getauxval.c
>>> index c83fbce..14f4298 100644
>>> --- a/misc/getauxval.c
>>> +++ b/misc/getauxval.c
>>> @@ -43,3 +43,4 @@ __getauxval (unsigned long int type)
>>> }
>>>
>>> weak_alias (__getauxval, getauxval)
>>> +libc_hidden_def (__getauxval)
>>> --
>>> 2.1.0
>>>
>
> Which one is better?
>
> https://sourceware.org/ml/libc-alpha/2017-06/msg00332.html
Tulio's patch is better because getauxval references could lead to
namespace violations.
Thanks,
Florian
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCHv2] Add a way to bypass the PLT when calling getauxval
2017-06-09 13:33 ` Florian Weimer
@ 2017-06-09 15:01 ` Tulio Magno Quites Machado Filho
0 siblings, 0 replies; 9+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-06-09 15:01 UTC (permalink / raw)
To: Florian Weimer; +Cc: libc-alpha, pc, joseph
Florian Weimer <fweimer@redhat.com> writes:
> "Tulio Magno Quites Machado Filho" <tuliom@linux.vnet.ibm.com> writes:
>
>> +extern __typeof(getauxval) __getauxval;
>
> Missing space before paren.
Fixed locally.
>> diff --git a/misc/getauxval.c b/misc/getauxval.c
>> index c83fbce..14f4298 100644
>> --- a/misc/getauxval.c
>> +++ b/misc/getauxval.c
>> @@ -43,3 +43,4 @@ __getauxval (unsigned long int type)
>> }
>>
>> weak_alias (__getauxval, getauxval)
>> +libc_hidden_def (__getauxval)
>
> Looks good.
I'll push this patch with the fix.
Thanks!
--
Tulio Magno
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-06-09 15:01 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-24 19:42 [PATCH] Add a way to bypass the PLT when calling getauxval Tulio Magno Quites Machado Filho
2017-05-24 19:52 ` Joseph Myers
2017-05-24 21:43 ` Tulio Magno Quites Machado Filho
2017-05-25 20:06 ` [PATCHv2] " Tulio Magno Quites Machado Filho
2017-06-09 13:14 ` Tulio Magno Quites Machado Filho
2017-06-09 13:29 ` H.J. Lu
2017-06-09 13:34 ` Florian Weimer
2017-06-09 13:33 ` Florian Weimer
2017-06-09 15:01 ` Tulio Magno Quites Machado Filho
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).