Skip to content

i386 code ends up with TEXTREL sections #5714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
thestinger opened this issue Apr 4, 2013 · 10 comments
Closed

i386 code ends up with TEXTREL sections #5714

thestinger opened this issue Apr 4, 2013 · 10 comments
Labels
A-security Area: Security (example: address space layout randomization). O-linux Operating system: Linux O-x86_32 Target: x86 processors, 32 bit (like i686-*) (IA-32)

Comments

@thestinger
Copy link
Contributor

The problem functions (this occurs in every library, with the exception of librustrt):

  librustc-c84825241471686d-0.6.so: rust_get_task [0x93E38F] in (optimized out: previous _ZN4main15_c4de63b748e03d3_06E) [0x93DFE0]
  librustc-c84825241471686d-0.6.so: upcall_new_stack [0x93E3AF] in (optimized out: previous _ZN4main15_c4de63b748e03d3_06E) [0x93DFE0]
  librustc-c84825241471686d-0.6.so: upcall_del_stack [0x93E3D1] in (optimized out: previous _ZN4main15_c4de63b748e03d3_06E) [0x93DFE0]

AFAIK this means it's not proper position independent code and uses absolute address references somewhere. I just can't figure out where/why.

This is confounding:

% scanelf -qT librustrt.so
scanelf: scanelf_file_textrels(): ELF librustrt.so has TEXTREL markings but doesnt appear to have any real TEXTREL's !?

Lots of info about this here: http://www.gentoo.org/proj/en/hardened/pic-fix-guide.xml?style=printable

@graydon
Copy link
Contributor

graydon commented May 22, 2013

Yeah, this is in i386 asm code, in rt/arch/i386/morestack.S, we're making some calls wrong. If I change the symbols to @PLT variants, (eg. upcall_new_stack@PLT) this goes away, but the resulting binary crashes in a weird / unrelated area. Hm.

@thestinger
Copy link
Contributor Author

Nominating for the production ready milestone.

@graydon
Copy link
Contributor

graydon commented Jul 11, 2013

agreed, this is suitably tagged. visited during triage.

@graydon
Copy link
Contributor

graydon commented Aug 15, 2013

this is no longer being used, but will be rewritten when #6844 is done. It should check this doesn't re-occur: call the PLT variants.

@graydon
Copy link
Contributor

graydon commented Aug 15, 2013

primarily relevant to packaging, which isn't a milestone issue. though it should be fixed.

@graydon
Copy link
Contributor

graydon commented Aug 15, 2013

just a bug, removing milestone/nomination.

@alexcrichton
Copy link
Member

In today's meeting we have decided to jettison segmented stacks.

@thestinger
Copy link
Contributor Author

rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/liblog-cd31a5b6-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/librustuv-e71b02d9-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/librustdoc-851f57e3-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libgraphviz-c1a03dc9-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libtest-93b19fbd-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libsyntax-cb63d668-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/liburl-49817968-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libsemver-9f099863-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libuuid-516f5013-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libregex_macros-eaf06519-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libtime-63ba030f-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libarena-b986d21c-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libgetopts-de95cee8-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libnum-8b683e59-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libfmt_macros-1d4f94bf-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libnative-35e04b6f-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libstd-e32fa708-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/librustrt-805dca70-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libflate-dd202f5d-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/librustc-a9826c4a-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libterm-3510b061-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libgreen-d290d028-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libhexfloat-9f6f391f-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libsync-eaefc6bd-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libfourcc-a33fb22e-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libserialize-c021c5fb-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libdebug-259338fe-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libglob-1b430430-0.11.0.so') has text relocations.
rust W: ELF file ('usr/lib/rustlib/i686-unknown-linux-gnu/lib/libregex-c7058059-0.11.0.so') has text relocations.

@thestinger thestinger added A-x86 and removed I-cleanup labels Jul 3, 2014
@thestinger thestinger added the A-security Area: Security (example: address space layout randomization). label Sep 16, 2014
@thestinger
Copy link
Contributor Author

This is still an issue, Rust isn't compatible with hardened kernels on 32-bit.

srwalter added a commit to srwalter/rust that referenced this issue Jun 15, 2015
This prevents a relocation in the text section.  Text relocations are
incompatible with hardened kernels.

rust-lang#5714
bors added a commit that referenced this issue Jun 17, 2015
This prevents a relocation in the text section.  Text relocations are
incompatible with hardened kernels.

#5714
@alexcrichton
Copy link
Member

I believe this was handled in #26321

codyps pushed a commit to codyps/rust that referenced this issue Aug 5, 2015
This prevents a relocation in the text section.  Text relocations are
incompatible with hardened kernels.

rust-lang#5714
flip1995 pushed a commit to flip1995/rust that referenced this issue Apr 21, 2022
…archo

Don't lint `manual_non_exhaustive` when the enum variant is used

fixes rust-lang#5714

changelog: Don't lint `manual_non_exhaustive` when the enum variant is used
@Noratrieb Noratrieb added O-x86_32 Target: x86 processors, 32 bit (like i686-*) (IA-32) and removed O-x86-all labels Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-security Area: Security (example: address space layout randomization). O-linux Operating system: Linux O-x86_32 Target: x86 processors, 32 bit (like i686-*) (IA-32)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants