public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "contact@alexander-pick.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/107971] New: linking an assembler object creates an executable stack
Date: Mon, 05 Dec 2022 09:07:24 +0000	[thread overview]
Message-ID: <bug-107971-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 107971
           Summary: linking an assembler object creates an executable
                    stack
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: contact@alexander-pick.com
  Target Milestone: ---

Created attachment 54011
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54011&action=edit
simple testcase for the issue

I encountered a strange behavior with gcc and linking an assembler object.
Doing so will create a binary with executable stack. A testcase is attached.

The code will compile a very simple assembler file as an object and link it to
an object compiled from C. The binary will have an executable stack by default
which isn't that great from a security point of view. Setting "-z noexecstack"
as a workaround is the only way to prevent this.

31:   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr
0x0000000000000000 align 2**4
32-         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rwx

             reply	other threads:[~2022-12-05  9:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05  9:07 contact@alexander-pick.com [this message]
2022-12-05  9:19 ` [Bug c/107971] " pinskia at gcc dot gnu.org
2022-12-05  9:21 ` pinskia at gcc dot gnu.org
2022-12-05  9:58 ` pinskia at gcc dot gnu.org
2022-12-05 10:22 ` contact@alexander-pick.com
2022-12-05 12:45 ` amonakov at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-107971-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).