* [PATCH] configure: define TARGET_LIBC_GNUSTACK on musl
@ 2021-11-15 8:25 Ilya Lipnitskiy
2021-11-15 22:50 ` Jeff Law
0 siblings, 1 reply; 11+ messages in thread
From: Ilya Lipnitskiy @ 2021-11-15 8:25 UTC (permalink / raw)
To: gcc-patches, Dragan Mladjenovic; +Cc: Ilya Lipnitskiy
musl only uses PT_GNU_STACK to set default thread stack size and has no
executable stack support[0], so there is no reason not to emit the
.note.GNU-stack section on musl builds.
[0]: https://lore.kernel.org/all/20190423192534.GN23599@brightrain.aerifal.cx/T/#u
gcc/ChangeLog:
* configure: Regenerate.
* configure.ac: define TARGET_LIBC_GNUSTACK on musl
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
---
gcc/configure | 3 +++
gcc/configure.ac | 3 +++
2 files changed, 6 insertions(+)
diff --git a/gcc/configure b/gcc/configure
index 920868bcd33d..366d6d969f45 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -31263,6 +31263,9 @@ if test $glibc_version_major -gt 2 \
gcc_cv_libc_gnustack=yes
fi
;;
+ mips*-*-linux-musl*)
+ gcc_cv_libc_gnustack=yes
+ ;;
esac
if test x$gcc_cv_libc_gnustack = xyes; then
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 065080a4b399..56d5bb7785a8 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6950,6 +6950,9 @@ case "$target" in
mips*-*-linux*)
GCC_GLIBC_VERSION_GTE_IFELSE([2], [31], [gcc_cv_libc_gnustack=yes], )
;;
+ mips*-*-linux-musl*)
+ gcc_cv_libc_gnustack=yes
+ ;;
esac
if test x$gcc_cv_libc_gnustack = xyes; then
AC_DEFINE(TARGET_LIBC_GNUSTACK, 1,
--
2.33.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] configure: define TARGET_LIBC_GNUSTACK on musl
2021-11-15 8:25 [PATCH] configure: define TARGET_LIBC_GNUSTACK on musl Ilya Lipnitskiy
@ 2021-11-15 22:50 ` Jeff Law
2021-11-16 5:10 ` Ilya Lipnitskiy
0 siblings, 1 reply; 11+ messages in thread
From: Jeff Law @ 2021-11-15 22:50 UTC (permalink / raw)
To: Ilya Lipnitskiy, gcc-patches, Dragan Mladjenovic
On 11/15/2021 1:25 AM, Ilya Lipnitskiy via Gcc-patches wrote:
> musl only uses PT_GNU_STACK to set default thread stack size and has no
> executable stack support[0], so there is no reason not to emit the
> .note.GNU-stack section on musl builds.
>
> [0]: https://lore.kernel.org/all/20190423192534.GN23599@brightrain.aerifal.cx/T/#u
>
> gcc/ChangeLog:
>
> * configure: Regenerate.
> * configure.ac: define TARGET_LIBC_GNUSTACK on musl
If musl has no executable stack support, then wouldn't we want this
change to apply to all musl platforms, not just mips?
jeff
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] configure: define TARGET_LIBC_GNUSTACK on musl
2021-11-15 22:50 ` Jeff Law
@ 2021-11-16 5:10 ` Ilya Lipnitskiy
2021-11-16 5:13 ` [PATCH v2] " Ilya Lipnitskiy
2021-11-23 0:30 ` [PATCH] " Jeff Law
0 siblings, 2 replies; 11+ messages in thread
From: Ilya Lipnitskiy @ 2021-11-16 5:10 UTC (permalink / raw)
To: Jeff Law; +Cc: gcc-patches, Dragan Mladjenovic
On Mon, Nov 15, 2021 at 2:50 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
>
> On 11/15/2021 1:25 AM, Ilya Lipnitskiy via Gcc-patches wrote:
> > musl only uses PT_GNU_STACK to set default thread stack size and has no
> > executable stack support[0], so there is no reason not to emit the
> > .note.GNU-stack section on musl builds.
> >
> > [0]: https://lore.kernel.org/all/20190423192534.GN23599@brightrain.aerifal.cx/T/#u
> >
> > gcc/ChangeLog:
> >
> > * configure: Regenerate.
> > * configure.ac: define TARGET_LIBC_GNUSTACK on musl
> If musl has no executable stack support, then wouldn't we want this
> change to apply to all musl platforms, not just mips?
The original change was MIPS-specific[0] and TARGET_LIBC_GNUSTACK is
only used by mips code today. We could change both cases to be more
generic or keep it MIPS-specific. Dragan, what do you think?
I also need to re-spin my change as my case is a more specific match
than the first and never executes with my patch.
[0]: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=54b3d52c3cca836c7c4c08cc9c02eda6c096372a
>
> jeff
>
Ilya
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2] configure: define TARGET_LIBC_GNUSTACK on musl
2021-11-16 5:10 ` Ilya Lipnitskiy
@ 2021-11-16 5:13 ` Ilya Lipnitskiy
2021-11-16 14:40 ` Dragan Mladjenovic
2021-12-02 20:48 ` Jeff Law
2021-11-23 0:30 ` [PATCH] " Jeff Law
1 sibling, 2 replies; 11+ messages in thread
From: Ilya Lipnitskiy @ 2021-11-16 5:13 UTC (permalink / raw)
To: gcc-patches, Dragan Mladjenovic, Jeff Law; +Cc: Ilya Lipnitskiy
musl only uses PT_GNU_STACK to set default thread stack size and has no
executable stack support[0], so there is no reason not to emit the
.note.GNU-stack section on musl builds.
[0]: https://lore.kernel.org/all/20190423192534.GN23599@brightrain.aerifal.cx/T/#u
gcc/ChangeLog:
* configure: Regenerate.
* configure.ac: define TARGET_LIBC_GNUSTACK on musl
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
---
gcc/configure | 3 +++
gcc/configure.ac | 3 +++
2 files changed, 6 insertions(+)
diff --git a/gcc/configure b/gcc/configure
index 74b9d9be4c85..7091a838aefa 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -31275,6 +31275,9 @@ fi
# Check if the target LIBC handles PT_GNU_STACK.
gcc_cv_libc_gnustack=unknown
case "$target" in
+ mips*-*-linux-musl*)
+ gcc_cv_libc_gnustack=yes
+ ;;
mips*-*-linux*)
if test $glibc_version_major -gt 2 \
diff --git a/gcc/configure.ac b/gcc/configure.ac
index c9ee1fb8919e..8a2d34179a75 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6961,6 +6961,9 @@ fi
# Check if the target LIBC handles PT_GNU_STACK.
gcc_cv_libc_gnustack=unknown
case "$target" in
+ mips*-*-linux-musl*)
+ gcc_cv_libc_gnustack=yes
+ ;;
mips*-*-linux*)
GCC_GLIBC_VERSION_GTE_IFELSE([2], [31], [gcc_cv_libc_gnustack=yes], )
;;
--
2.33.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] configure: define TARGET_LIBC_GNUSTACK on musl
2021-11-16 5:13 ` [PATCH v2] " Ilya Lipnitskiy
@ 2021-11-16 14:40 ` Dragan Mladjenovic
2021-11-16 16:25 ` [musl] " Rich Felker
2021-12-02 20:48 ` Jeff Law
1 sibling, 1 reply; 11+ messages in thread
From: Dragan Mladjenovic @ 2021-11-16 14:40 UTC (permalink / raw)
To: Ilya Lipnitskiy, gcc-patches, Jeff Law, musl
Hi,
Looks fine to me. If possible, maybe it should even be back-ported to
stable branches.
Not sure if MIPS assembly sources (if any) in musl would need explicit
.note.GNU-stack
to complement this?
Best regards,
Dragan
On 16-Nov-21 06:13, Ilya Lipnitskiy wrote:
> musl only uses PT_GNU_STACK to set default thread stack size and has no
> executable stack support[0], so there is no reason not to emit the
> .note.GNU-stack section on musl builds.
>
> [0]: https://lore.kernel.org/all/20190423192534.GN23599@brightrain.aerifal.cx/T/#u
>
> gcc/ChangeLog:
>
> * configure: Regenerate.
> * configure.ac: define TARGET_LIBC_GNUSTACK on musl
>
> Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
> ---
> gcc/configure | 3 +++
> gcc/configure.ac | 3 +++
> 2 files changed, 6 insertions(+)
>
> diff --git a/gcc/configure b/gcc/configure
> index 74b9d9be4c85..7091a838aefa 100755
> --- a/gcc/configure
> +++ b/gcc/configure
> @@ -31275,6 +31275,9 @@ fi
> # Check if the target LIBC handles PT_GNU_STACK.
> gcc_cv_libc_gnustack=unknown
> case "$target" in
> + mips*-*-linux-musl*)
> + gcc_cv_libc_gnustack=yes
> + ;;
> mips*-*-linux*)
>
> if test $glibc_version_major -gt 2 \
> diff --git a/gcc/configure.ac b/gcc/configure.ac
> index c9ee1fb8919e..8a2d34179a75 100644
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -6961,6 +6961,9 @@ fi
> # Check if the target LIBC handles PT_GNU_STACK.
> gcc_cv_libc_gnustack=unknown
> case "$target" in
> + mips*-*-linux-musl*)
> + gcc_cv_libc_gnustack=yes
> + ;;
> mips*-*-linux*)
> GCC_GLIBC_VERSION_GTE_IFELSE([2], [31], [gcc_cv_libc_gnustack=yes], )
> ;;
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [musl] Re: [PATCH v2] configure: define TARGET_LIBC_GNUSTACK on musl
2021-11-16 14:40 ` Dragan Mladjenovic
@ 2021-11-16 16:25 ` Rich Felker
2021-11-16 17:49 ` Ilya Lipnitskiy
0 siblings, 1 reply; 11+ messages in thread
From: Rich Felker @ 2021-11-16 16:25 UTC (permalink / raw)
To: Dragan Mladjenovic; +Cc: Ilya Lipnitskiy, gcc-patches, Jeff Law, musl
On Tue, Nov 16, 2021 at 03:40:00PM +0100, Dragan Mladjenovic wrote:
> Hi,
>
> Looks fine to me. If possible, maybe it should even be back-ported
> to stable branches.
>
> Not sure if MIPS assembly sources (if any) in musl would need
> explicit ..note.GNU-stack
>
> to complement this?
What are the actual consequences of making this change, and what is
the goal? I'm concerned that it might produce object files which don't
include annotation that they don't need executable stack, in which
case the final executable file will be marked as executable-stack and
the kernel will load it as such. That would be very bad.
Rich
> On 16-Nov-21 06:13, Ilya Lipnitskiy wrote:
> >musl only uses PT_GNU_STACK to set default thread stack size and has no
> >executable stack support[0], so there is no reason not to emit the
> >.note.GNU-stack section on musl builds.
> >
> >[0]: https://lore.kernel.org/all/20190423192534.GN23599@brightrain.aerifal.cx/T/#u
> >
> >gcc/ChangeLog:
> >
> > * configure: Regenerate.
> > * configure.ac: define TARGET_LIBC_GNUSTACK on musl
> >
> >Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
> >---
> > gcc/configure | 3 +++
> > gcc/configure.ac | 3 +++
> > 2 files changed, 6 insertions(+)
> >
> >diff --git a/gcc/configure b/gcc/configure
> >index 74b9d9be4c85..7091a838aefa 100755
> >--- a/gcc/configure
> >+++ b/gcc/configure
> >@@ -31275,6 +31275,9 @@ fi
> > # Check if the target LIBC handles PT_GNU_STACK.
> > gcc_cv_libc_gnustack=unknown
> > case "$target" in
> >+ mips*-*-linux-musl*)
> >+ gcc_cv_libc_gnustack=yes
> >+ ;;
> > mips*-*-linux*)
> > if test $glibc_version_major -gt 2 \
> >diff --git a/gcc/configure.ac b/gcc/configure.ac
> >index c9ee1fb8919e..8a2d34179a75 100644
> >--- a/gcc/configure.ac
> >+++ b/gcc/configure.ac
> >@@ -6961,6 +6961,9 @@ fi
> > # Check if the target LIBC handles PT_GNU_STACK.
> > gcc_cv_libc_gnustack=unknown
> > case "$target" in
> >+ mips*-*-linux-musl*)
> >+ gcc_cv_libc_gnustack=yes
> >+ ;;
> > mips*-*-linux*)
> > GCC_GLIBC_VERSION_GTE_IFELSE([2], [31], [gcc_cv_libc_gnustack=yes], )
> > ;;
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [musl] Re: [PATCH v2] configure: define TARGET_LIBC_GNUSTACK on musl
2021-11-16 16:25 ` [musl] " Rich Felker
@ 2021-11-16 17:49 ` Ilya Lipnitskiy
0 siblings, 0 replies; 11+ messages in thread
From: Ilya Lipnitskiy @ 2021-11-16 17:49 UTC (permalink / raw)
To: Rich Felker; +Cc: Dragan Mladjenovic, gcc-patches, Jeff Law, musl
On Tue, Nov 16, 2021 at 8:41 AM Rich Felker <dalias@libc.org> wrote:
>
> On Tue, Nov 16, 2021 at 03:40:00PM +0100, Dragan Mladjenovic wrote:
> > Hi,
> >
> > Looks fine to me. If possible, maybe it should even be back-ported
> > to stable branches.
The change cherry-picks fine onto 10.x and 11.x branches. Should I
send out separate patches or can the committer of this patch apply it
to 10.x and 11.x?
> >
> > Not sure if MIPS assembly sources (if any) in musl would need
> > explicit ..note.GNU-stack
> >
> > to complement this?
>
> What are the actual consequences of making this change, and what is
> the goal? I'm concerned that it might produce object files which don't
> include annotation that they don't need executable stack, in which
> case the final executable file will be marked as executable-stack and
> the kernel will load it as such. That would be very bad.
It is actually the other way around - for MIPS hard-float targets on
non-glibc (or glibc < 2.31) without this change the .note.GNU-stack
annotation is not emitted by GCC.
Ilya
>
> Rich
>
>
> > On 16-Nov-21 06:13, Ilya Lipnitskiy wrote:
> > >musl only uses PT_GNU_STACK to set default thread stack size and has no
> > >executable stack support[0], so there is no reason not to emit the
> > >.note.GNU-stack section on musl builds.
> > >
> > >[0]: https://lore.kernel.org/all/20190423192534.GN23599@brightrain.aerifal.cx/T/#u
> > >
> > >gcc/ChangeLog:
> > >
> > > * configure: Regenerate.
> > > * configure.ac: define TARGET_LIBC_GNUSTACK on musl
> > >
> > >Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
> > >---
> > > gcc/configure | 3 +++
> > > gcc/configure.ac | 3 +++
> > > 2 files changed, 6 insertions(+)
> > >
> > >diff --git a/gcc/configure b/gcc/configure
> > >index 74b9d9be4c85..7091a838aefa 100755
> > >--- a/gcc/configure
> > >+++ b/gcc/configure
> > >@@ -31275,6 +31275,9 @@ fi
> > > # Check if the target LIBC handles PT_GNU_STACK.
> > > gcc_cv_libc_gnustack=unknown
> > > case "$target" in
> > >+ mips*-*-linux-musl*)
> > >+ gcc_cv_libc_gnustack=yes
> > >+ ;;
> > > mips*-*-linux*)
> > > if test $glibc_version_major -gt 2 \
> > >diff --git a/gcc/configure.ac b/gcc/configure.ac
> > >index c9ee1fb8919e..8a2d34179a75 100644
> > >--- a/gcc/configure.ac
> > >+++ b/gcc/configure.ac
> > >@@ -6961,6 +6961,9 @@ fi
> > > # Check if the target LIBC handles PT_GNU_STACK.
> > > gcc_cv_libc_gnustack=unknown
> > > case "$target" in
> > >+ mips*-*-linux-musl*)
> > >+ gcc_cv_libc_gnustack=yes
> > >+ ;;
> > > mips*-*-linux*)
> > > GCC_GLIBC_VERSION_GTE_IFELSE([2], [31], [gcc_cv_libc_gnustack=yes], )
> > > ;;
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] configure: define TARGET_LIBC_GNUSTACK on musl
2021-11-16 5:13 ` [PATCH v2] " Ilya Lipnitskiy
2021-11-16 14:40 ` Dragan Mladjenovic
@ 2021-12-02 20:48 ` Jeff Law
2021-12-02 20:59 ` Ilya Lipnitskiy
1 sibling, 1 reply; 11+ messages in thread
From: Jeff Law @ 2021-12-02 20:48 UTC (permalink / raw)
To: Ilya Lipnitskiy, gcc-patches, Dragan Mladjenovic
On 11/15/2021 10:13 PM, Ilya Lipnitskiy wrote:
> musl only uses PT_GNU_STACK to set default thread stack size and has no
> executable stack support[0], so there is no reason not to emit the
> .note.GNU-stack section on musl builds.
>
> [0]: https://lore.kernel.org/all/20190423192534.GN23599@brightrain.aerifal.cx/T/#u
>
> gcc/ChangeLog:
>
> * configure: Regenerate.
> * configure.ac: define TARGET_LIBC_GNUSTACK on musl
Thanks. I've pushed this to the trunk. Sorry for the long wait.
Jeff
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] configure: define TARGET_LIBC_GNUSTACK on musl
2021-11-16 5:10 ` Ilya Lipnitskiy
2021-11-16 5:13 ` [PATCH v2] " Ilya Lipnitskiy
@ 2021-11-23 0:30 ` Jeff Law
1 sibling, 0 replies; 11+ messages in thread
From: Jeff Law @ 2021-11-23 0:30 UTC (permalink / raw)
To: Ilya Lipnitskiy; +Cc: gcc-patches, Dragan Mladjenovic
On 11/15/2021 10:10 PM, Ilya Lipnitskiy wrote:
> On Mon, Nov 15, 2021 at 2:50 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
>>
>>
>> On 11/15/2021 1:25 AM, Ilya Lipnitskiy via Gcc-patches wrote:
>>> musl only uses PT_GNU_STACK to set default thread stack size and has no
>>> executable stack support[0], so there is no reason not to emit the
>>> .note.GNU-stack section on musl builds.
>>>
>>> [0]: https://lore.kernel.org/all/20190423192534.GN23599@brightrain.aerifal.cx/T/#u
>>>
>>> gcc/ChangeLog:
>>>
>>> * configure: Regenerate.
>>> * configure.ac: define TARGET_LIBC_GNUSTACK on musl
>> If musl has no executable stack support, then wouldn't we want this
>> change to apply to all musl platforms, not just mips?
> The original change was MIPS-specific[0] and TARGET_LIBC_GNUSTACK is
> only used by mips code today. We could change both cases to be more
> generic or keep it MIPS-specific. Dragan, what do you think?
Oh yea, I forgot about that older change. Let me take another looksie.
jeff
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-12-02 21:12 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 8:25 [PATCH] configure: define TARGET_LIBC_GNUSTACK on musl Ilya Lipnitskiy
2021-11-15 22:50 ` Jeff Law
2021-11-16 5:10 ` Ilya Lipnitskiy
2021-11-16 5:13 ` [PATCH v2] " Ilya Lipnitskiy
2021-11-16 14:40 ` Dragan Mladjenovic
2021-11-16 16:25 ` [musl] " Rich Felker
2021-11-16 17:49 ` Ilya Lipnitskiy
2021-12-02 20:48 ` Jeff Law
2021-12-02 20:59 ` Ilya Lipnitskiy
2021-12-02 21:12 ` Jeff Law
2021-11-23 0:30 ` [PATCH] " Jeff Law
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).