From: Nekun <nekokun@firemail.cc>
To: gentoo-dev@lists.gentoo.org
Cc: Sam James <sam@gentoo.org>
Subject: Re: [gentoo-dev] TEXTRELs in assembly program
Date: Thu, 22 Apr 2021 22:29:35 +0000 [thread overview]
Message-ID: <909ef2f291280b4303274872538d9258@firemail.cc> (raw)
In-Reply-To: <D981BDB5-F696-4E21-A7FD-38FF473C24BB@gentoo.org>
On 2021-04-22 21:23, Sam James wrote:
> Such pkg_setups are best avoided if possible because they can be
> confusing and we have other tools to handle it, so I’m glad you asked!
> I’d provide a USE flag for this tool and mask it on non-multilib amd64
> profiles (or mask everywhere and unmask on the multilib amd64
> profiles).
Fasm itself can be built and run in pure amd64 environment, so we need
to mask only USEs for building additional tools and building fasm itself
against libc in non-multilib amd64 (native x86 is correct platform too)
it this approach.
> 1) The TEXTREL QA warning primarily exists because of the security
> issues associated with them - they prevent PIC.
>
> The following links may be useful:
> -
> https://flameeyes.blog/2016/01/16/textrels-text-relocations-and-their-impact-on-hardening-techniques/
> - https://wiki.gentoo.org/wiki/Hardened/Textrels_Guide
>
> However, I think it’s not really likely to be a real world issue if
> the program in question is an assembler. You’re just going to hit
> possible portability issues
> but I’m not sure what the details are there.
Seems like gcc when used as linker frontend expects PIE-aware code in
object file and pass '-pie' to linker, but fasm doesn't know anything
about PIE, so ld fallbacks to TEXTRELs, AFAIK. Suggest two approaches:
disable passing PIE in gcc in some way or ignore textrel issues. Manual
linking seems to be error-prone in any non-standard configuration, such
as ${ROOT}/${SYSROOT} cross-environments, binary hosts, etc... maybe I
too scared because not so familiar with linking, however.
> 2) Passing -fno-PIE and friends should work if you use append-* from
> flag-o-matic.eclass?
Passing -fno-pie to gcc has no effect, `strace --string-limit -vfe
execve` shows that '--pie' is passed to ld anyway.
> Can’t see it here.
Looks like it accidentaly not posted by my stupid webmail client, posted
in plaintext in reply to original post.
next prev parent reply other threads:[~2021-04-22 22:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-22 21:07 [gentoo-dev] TEXTRELs in assembly program Nekun
2021-04-22 21:23 ` Sam James
2021-04-22 22:29 ` Nekun [this message]
2021-04-22 21:32 ` Nekun
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=909ef2f291280b4303274872538d9258@firemail.cc \
--to=nekokun@firemail.cc \
--cc=gentoo-dev@lists.gentoo.org \
--cc=sam@gentoo.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