You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
on Linux, empty program panics if procfs is not mounted #22642
The program pub main(){} fails if procfs is not mounted:
thread '<unnamed>' panicked at 'failed to get thread attributes', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/sys/unix/thread.rs:84
It seems that the problem is a call to pthread_getattr_np() which tries to read /proc/self/maps and fails.
changed the title [-]empty program panics on Linux if procfs is not mounted[/-][+]on Linux, empty program panics if procfs is not mounted[/+]on Feb 21, 2015
Hm this is somewhat worrisome. It seems overly restrictive, but on the other hand it looks like the failure in question is our detection of the stack start of the main thread in setting up the first guard page. I forget how reliable it is that linux sets up a guard page for us, and it would be tough to remove for now at least.
@alexcrichton could the code skip guard page creation when /proc is unavailable (as detected by pthread_getattr_np failing)? That seems better than failing to work at all, doesn't it?
Has there been any update regarding this issue? For an AI competition we want to isolate our processes and not mounting proc inside the chroot has served well for any other languages. Is there a workaround possible in code or compilation flags?
Activity
[-]empty program panics on Linux if procfs is not mounted[/-][+]on Linux, empty program panics if procfs is not mounted[/+]dwrensha commentedon Feb 22, 2015
I found that I can work around this by defining my own entry point:
alexcrichton commentedon Feb 23, 2015
Hm this is somewhat worrisome. It seems overly restrictive, but on the other hand it looks like the failure in question is our detection of the stack start of the main thread in setting up the first guard page. I forget how reliable it is that linux sets up a guard page for us, and it would be tough to remove for now at least.
kentonv commentedon Feb 23, 2015
@alexcrichton could the code skip guard page creation when /proc is unavailable (as detected by pthread_getattr_np failing)? That seems better than failing to work at all, doesn't it?
alexcrichton commentedon Feb 23, 2015
Perhaps yes, I'd want to have a chance to look more into it though.
psmit commentedon Jul 15, 2015
Has there been any update regarding this issue? For an AI competition we want to isolate our processes and not mounting proc inside the chroot has served well for any other languages. Is there a workaround possible in code or compilation flags?
dwrensha commentedon Jul 16, 2015
@phsmit: You can work around the problem in code by defining your own entry point with the
#[start]attribute.Unfortunately, that's not an adequate solution in all situations, e.g. if you want to run
rustcorcargoin a sandboxed environment.std: Be resilient to failure in pthread_getattr_np
Auto merge of #27073 - alexcrichton:less-proc-fs, r=brson