Skip to content
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

mark the assembly object stacks as non-executable #5647

Closed
wants to merge 1 commit into from
Closed

mark the assembly object stacks as non-executable #5647

wants to merge 1 commit into from

Conversation

thestinger
Copy link
Contributor

@thestinger thestinger commented Mar 31, 2013

Closes #5643

@brson
Copy link
Contributor

brson commented Mar 31, 2013

Can this be fixed by passing -znoexecstack to the linker?

@thestinger
Copy link
Contributor Author

thestinger commented Mar 31, 2013

I think so, but I consider this less of a hack. LLVM is already outputting this section for Rust code, it's just not in the assembly objects.

@thestinger
Copy link
Contributor Author

thestinger commented Mar 31, 2013

It's possible someone might actually want an executable stack, which is why I think this (auto-detection) is better.

@brson
Copy link
Contributor

brson commented Mar 31, 2013

So can we remove -znoexecstack flags from mk/platform.mk after making these changes?

@brson
Copy link
Contributor

brson commented Mar 31, 2013

Also, is there any way to test this so it doesn't regress again?

@thestinger
Copy link
Contributor Author

thestinger commented Mar 31, 2013

You can use readelf -lW foo.so | grep GNU_STACK and look for a RWX flag (it should be RW).

I'm checking what happens if the gcc flag is removed right now.

Closes #5643

This also removes the need to pass noexecstack to gcc, but that wasn't
actually working anymore.
@thestinger
Copy link
Contributor Author

thestinger commented Mar 31, 2013

@brson: r? I had to make this specific to Linux - not sure if BSD should have it too. It looks like it might just be a sysctl parameter on FreeBSD.

@yichoi
Copy link
Contributor

yichoi commented Apr 1, 2013

failed on arm build

compile: rt/arm-linux-androideabi/arch/arm/_context.o
/home/yichoi/rust_latest/src/rt/arch/arm/_context.S: Assembler messages:
/home/yichoi/rust_latest/src/rt/arch/arm/_context.S:3: Error: junk at end of line, first unrecognized character is `,'
make: *** [rt/arm-linux-androideabi/arch/arm/_context.o] Error 1

I want to fallback these files. arm libraries does not need to follow base linux policy like Fedora, SELinux
src/rt/arch/arm/_context.S
src/rt/arch/arm/ccall.S
src/rt/arch/arm/morestack.S
src/rt/arch/arm/record_sp.S

@thestinger
Copy link
Contributor Author

thestinger commented Apr 1, 2013

@yichoi: The problem is that I used @ and apparently that's a comment character with the ARM assembler. The stack should be marked as non-executable on ARM too, so I'll send another pull that fixes this problem.

flip1995 pushed a commit to flip1995/rust that referenced this pull request May 27, 2020
…ion, r=flip1995

ptr_arg: honor `allow` attribute on arguments

The `intravisit::Visitor` impl for `LateContextAndPass` only takes into account the attributes of a function parameter inside the `check_param` method. `ptr_arg` starts its heuristics at `check_item` / `check_impl_item` / `check_trait_item`, so the `allow` is not taken into account automatically.

changelog: ptr_arg: honor `allow` attribute on arguments

Fixes rust-lang#5644
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants