public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/104027] New: [12 Regression] libgnat-12.so requires executable stack on x86_64-linux
@ 2022-01-14 10:09 jakub at gcc dot gnu.org
  2022-01-14 10:19 ` [Bug ada/104027] " jakub at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-14 10:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104027

            Bug ID: 104027
           Summary: [12 Regression] libgnat-12.so requires executable
                    stack on x86_64-linux
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

while libgnat-11.so didn't (and some earlier too).
Seems the reason is a-nbnbig.o, which is empty and doesn't have .note.GNU-stack
section.
gnat1drv seems to exit (0) during the middle of compile_file, which means it
skips a big part of toplev.c (compile_file) cleanups, in particular
  targetm.asm_out.file_end ();
for this case.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug ada/104027] [12 Regression] libgnat-12.so requires executable stack on x86_64-linux
  2022-01-14 10:09 [Bug ada/104027] New: [12 Regression] libgnat-12.so requires executable stack on x86_64-linux jakub at gcc dot gnu.org
@ 2022-01-14 10:19 ` jakub at gcc dot gnu.org
  2022-01-14 10:31 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-14 10:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104027

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0
                 CC|                            |charlet at gcc dot gnu.org,
                   |                            |ebotcazou at gcc dot gnu.org,
                   |                            |pmderodat at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Compiling a-nbnbig.o with additional -Wa,--noexecstack fixes it, but it is an
ugly workaround and would need to be done conditionally on the assembler
supporting it and on the target being a target where gcc normally emits
.note.GNU-stack.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug ada/104027] [12 Regression] libgnat-12.so requires executable stack on x86_64-linux
  2022-01-14 10:09 [Bug ada/104027] New: [12 Regression] libgnat-12.so requires executable stack on x86_64-linux jakub at gcc dot gnu.org
  2022-01-14 10:19 ` [Bug ada/104027] " jakub at gcc dot gnu.org
@ 2022-01-14 10:31 ` pinskia at gcc dot gnu.org
  2022-01-14 10:31 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-14 10:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104027

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 52190
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52190&action=edit
Patch which might fix the issue

I suspect it was caused by r12-5670-g8ba38e8c8b73 were we call:
Back_End.Gen_Or_Update_Object_File

It should have used a goto here instead of an exit.
The attached patch might be correct but I don't know Ada well enough.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug ada/104027] [12 Regression] libgnat-12.so requires executable stack on x86_64-linux
  2022-01-14 10:09 [Bug ada/104027] New: [12 Regression] libgnat-12.so requires executable stack on x86_64-linux jakub at gcc dot gnu.org
  2022-01-14 10:19 ` [Bug ada/104027] " jakub at gcc dot gnu.org
  2022-01-14 10:31 ` pinskia at gcc dot gnu.org
@ 2022-01-14 10:31 ` pinskia at gcc dot gnu.org
  2022-01-14 10:35 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-14 10:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104027

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-01-14

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug ada/104027] [12 Regression] libgnat-12.so requires executable stack on x86_64-linux
  2022-01-14 10:09 [Bug ada/104027] New: [12 Regression] libgnat-12.so requires executable stack on x86_64-linux jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-01-14 10:31 ` pinskia at gcc dot gnu.org
@ 2022-01-14 10:35 ` jakub at gcc dot gnu.org
  2022-01-14 13:46 ` charlet at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-14 10:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104027

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kenner at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Indeed.  If the FE emitted something registered with the middle-end symtab,
best would be to remove those again, if not, just arranging for return into the
caller seems much better than exiting.  It isn't just .note.GNU-stack on Linux,
but
e.g. plugin hooks won't be called etc.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug ada/104027] [12 Regression] libgnat-12.so requires executable stack on x86_64-linux
  2022-01-14 10:09 [Bug ada/104027] New: [12 Regression] libgnat-12.so requires executable stack on x86_64-linux jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-01-14 10:35 ` jakub at gcc dot gnu.org
@ 2022-01-14 13:46 ` charlet at gcc dot gnu.org
  2022-01-14 23:02 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: charlet at gcc dot gnu.org @ 2022-01-14 13:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104027

--- Comment #4 from Arnaud Charlet <charlet at gcc dot gnu.org> ---
Thanks for the report and investigation. The issue is actually caused by the
introduction of a "ghost" (empty for code generation purposes) unit
a-nbnbbig.ads, since the change you mentioned didn't change the existing call
to exit(0), the issue was already there before, just never triggered in
libgnat.so.

Patch looks good to me, if you get a successful build and check-ada, it's
preapproved.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug ada/104027] [12 Regression] libgnat-12.so requires executable stack on x86_64-linux
  2022-01-14 10:09 [Bug ada/104027] New: [12 Regression] libgnat-12.so requires executable stack on x86_64-linux jakub at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-01-14 13:46 ` charlet at gcc dot gnu.org
@ 2022-01-14 23:02 ` cvs-commit at gcc dot gnu.org
  2022-01-15 12:20 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-14 23:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104027

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:952b7dbb418198f86d7829aaf9d7f9fc7714a8b3

commit r12-6599-g952b7dbb418198f86d7829aaf9d7f9fc7714a8b3
Author: Andrew Pinski <apinski@marvell.com>
Date:   Fri Jan 14 23:58:38 2022 +0100

    ada: Fix up handling of ghost units [PR104027]

    As reported, libgnat-12.so gets PT_GNU_STACK RWE, which means it doesn't
    work in some SELinux configurations.
    This is caused by the a-nbnbig.o file, which is a ghost unit and since
    r12-5670 the FE emits an object file for it, but exits before compile_file
    has a chance to finalize it e.g. with targetm.asm_out.file_end ()
    that emits the .note.GNU-stack section on various linux targets.

    Fixed by not existing but instead returning early to the caller.

    2022-01-14  Andrew Pinski  <apinski@marvell.com>

            PR ada/104027
            * gnat1drv.adb (Gnat1drv): After Back_End.Gen_Or_Update_Object_File
            goto End_Of_Program.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug ada/104027] [12 Regression] libgnat-12.so requires executable stack on x86_64-linux
  2022-01-14 10:09 [Bug ada/104027] New: [12 Regression] libgnat-12.so requires executable stack on x86_64-linux jakub at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-01-14 23:02 ` cvs-commit at gcc dot gnu.org
@ 2022-01-15 12:20 ` jakub at gcc dot gnu.org
  2022-01-31 10:47 ` cvs-commit at gcc dot gnu.org
  2022-04-27  8:00 ` cvs-commit at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-15 12:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104027

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug ada/104027] [12 Regression] libgnat-12.so requires executable stack on x86_64-linux
  2022-01-14 10:09 [Bug ada/104027] New: [12 Regression] libgnat-12.so requires executable stack on x86_64-linux jakub at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2022-01-15 12:20 ` jakub at gcc dot gnu.org
@ 2022-01-31 10:47 ` cvs-commit at gcc dot gnu.org
  2022-04-27  8:00 ` cvs-commit at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-31 10:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104027

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Pierre-Marie de Rodat
<pmderodat@gcc.gnu.org>:

https://gcc.gnu.org/g:2dbc237e8605bb87f8b25adc455436dcba41fce8

commit r12-6943-g2dbc237e8605bb87f8b25adc455436dcba41fce8
Author: Arnaud Charlet <charlet@adacore.com>
Date:   Mon Jan 24 14:16:27 2022 -0500

    [Ada] Fix up handling of ghost units PR104027 #2

    gcc/ada/

            PR ada/104027
            * gnat1drv.adb (Gnat1drv): Only call Exit_Program when not
            generating code, otherwise instead go to End_Of_Program.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug ada/104027] [12 Regression] libgnat-12.so requires executable stack on x86_64-linux
  2022-01-14 10:09 [Bug ada/104027] New: [12 Regression] libgnat-12.so requires executable stack on x86_64-linux jakub at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2022-01-31 10:47 ` cvs-commit at gcc dot gnu.org
@ 2022-04-27  8:00 ` cvs-commit at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-27  8:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104027

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Pierre-Marie de Rodat
<pmderodat@gcc.gnu.org>:

https://gcc.gnu.org/g:b2df4c40c44adcc1d70db11c39593ace9b4cb588

commit r12-8278-gb2df4c40c44adcc1d70db11c39593ace9b4cb588
Author: Pierre-Marie de Rodat <derodat@adacore.com>
Date:   Tue Apr 26 09:51:47 2022 +0000

    [Ada] Revert r12-6599 (Fix up handling of ghost units [PR104027])

    gcc/ada/

            PR ada/104027
            * gnat1drv.adb: Remove the goto End_Of_Program.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-04-27  8:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-14 10:09 [Bug ada/104027] New: [12 Regression] libgnat-12.so requires executable stack on x86_64-linux jakub at gcc dot gnu.org
2022-01-14 10:19 ` [Bug ada/104027] " jakub at gcc dot gnu.org
2022-01-14 10:31 ` pinskia at gcc dot gnu.org
2022-01-14 10:31 ` pinskia at gcc dot gnu.org
2022-01-14 10:35 ` jakub at gcc dot gnu.org
2022-01-14 13:46 ` charlet at gcc dot gnu.org
2022-01-14 23:02 ` cvs-commit at gcc dot gnu.org
2022-01-15 12:20 ` jakub at gcc dot gnu.org
2022-01-31 10:47 ` cvs-commit at gcc dot gnu.org
2022-04-27  8:00 ` cvs-commit at gcc dot gnu.org

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).