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

SEGFAULT on WSL for simple binary that doesn't SEGFAULT on std. Ubuntu or with valgrind #2546

Closed
dhermes opened this issue Oct 5, 2017 · 9 comments
Labels

Comments

@dhermes
Copy link

dhermes commented Oct 5, 2017

  • Windows build number: >ver ... Microsoft Windows [Version 10.0.15063]
  • What you're doing and what's happening: Running a binary compiled with gfortran (see gist). The Fortran uses a closure and it seems there is a bad reference to the procedure with the closure (or to the enclosed reference).
  • What's wrong: the binary SEGAULTS, but it does not SEGFAULT when I run with valgrind / what should be happening instead: it should not SEGFAULT (it doesn't on "normal" Ubuntu)
  • Strace of the failing command, see gist

Context: This is a minimal reproduction from a more involved error experienced when calling into QUADPACK for a numerical library.

dhermes added a commit to dhermes/bezier that referenced this issue Oct 9, 2017
dhermes added a commit to dhermes/bezier that referenced this issue Oct 13, 2017
@dhermes dhermes changed the title SEGFAULT on WSL for simple binary that does SEGFAULT on std. Ubuntu or with valgrind SEGFAULT on WSL for simple binary that doesn't SEGFAULT on std. Ubuntu or with valgrind Sep 25, 2018
@dhermes
Copy link
Author

dhermes commented Nov 14, 2019

@therealkenc Has this been resolved? I noticed the need-repro label but my gist provides a minimal repro.

@therealkenc
Copy link
Collaborator

Ah. In 2017 this likely got skipped because the OP did not have any CLI steps visible, and with no repro visible the likelihood of someone clicking through a link was "small". The closed status was just cleaning up because I did a valgrind search and saw it chirping crickets. Ref #120 #4672. Will re-open and return to previous state.

@therealkenc therealkenc reopened this Nov 14, 2019
dhermes added a commit to dhermes/bezier that referenced this issue Feb 11, 2020
See flang-compiler/flang#298

As of this, the build fails for a different reason:

```
F90-S-0439-An internal subprogram cannot be passed as argument - vec_size (.../bezier/src/fortran/curve.f90: 837)
  0 inform,   0 warnings,   1 severes, 0 fatal for compute_length
```

Support for passing the function closure (i.e. the "internal
subprogram") has been problematic before when using `gfortran` on
Windows Subsystem for Linux (WSL):
microsoft/WSL#2546
@mobius-eng
Copy link

Can it be that the issue is with the (lack of support for) executable stack that is used by gfrortran to pass inner functions (closures) as parameters?

gfortran creates a trampoline to call inner function when it is passed as an argument. The trampoline instructions are placed on the stack. Hence, they need executable stack.

@therealkenc
Copy link
Collaborator

Plausible.

@dhermes
Copy link
Author

dhermes commented Jul 17, 2020

@therealkenc Would you like me to generate assembly and print it out? (I can do it in WSL vs. a "real" Ubuntu install to compare?)

@therealkenc
Copy link
Collaborator

What could be done is check whether the use case runs on 19041 WSL2. If it works the issue is sort of destined for fixed-in-wsl2 tag. In WSL1 execstack wasn't respected by-design (something about birds).

@benhillis benhillis added the wsl1 label May 5, 2021
@therealkenc
Copy link
Collaborator

The repro does take on WSL2. This one is for all intents dupe #2553.

image

@dhermes
Copy link
Author

dhermes commented May 6, 2021

Awesome! Thanks. (I am just about to buy a new PC and I think I won't even make an Ubuntu partition on it because of the richness of the WSL experience.)

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants