From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 476153894C1E; Mon, 5 Dec 2022 09:07:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 476153894C1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670231245; bh=yK4z17I6xHkMLxDGL3Qro+n2vyJB30xz8rRucUt8gj8=; h=From:To:Subject:Date:From; b=dCSQ3MfKlX4bABf+O0h/G50X/vIxK1P6zDr3bZZnUcanJso8PkdRo/IFxcHIuK3dK IUGEvnRoBg+Uc1BInBRhHNmWASAxSXs3j9Zv/7Y7mLN1VgrGKNE5eGbGRNah/kWA28 WMJid9L2j+Cc4SdkbuZQxPnPp+FQJHQihrQI3ggw= From: "contact@alexander-pick.com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: contact@alexander-pick.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107971 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=3D54011&action=3Dedit 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 defa= ult which isn't that great from a security point of view. Setting "-z noexecsta= ck" 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=