nh2 / nh2/static-haskell-nix

Document example failure of glibc static linking with NSS somewhere

Open
#17 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Nix
Stars
401
Forks
36
PR merge metrics
No merged PRs in 30d

Description

I got this example segfault of somebody trying to use an executable statically linked with glibc and using the network.

The stacktrace is of the program crashing in `gdb`; `stack build ... --no-strip` was used to obtain a sensible stack trace, otherwise it would show just `in ?? ()` in the entire trace.

```
Thread 11 "myprogram:w" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 494]
0x00007ffff43857a0 in internal_getent (stream=stream@entry=0x7ffff4059680, result=result@entry=0x368b1a0 , buffer=buffer@entry=0x36e7a20 "# Internet (IP) protocols\n", buflen=buflen@entry=1024, errnop=errnop@entry=0x7fffe67fc6a0)
at nss_files/files-XXX.c:216
216 nss_files/files-XXX.c: No such file or directory.
(gdb) bt
#0 0x00007ffff43857a0 in internal_getent (stream=stream@entry=0x7ffff4059680, result=result@entry=0x368b1a0 , buffer=buffer@entry=0x36e7a20 "# Internet (IP) protocols\n", buflen=buflen@entry=1024, errnop=errnop@entry=0x7fffe67fc6a0)
at nss_files/files-XXX.c:216
#1 0x00007ffff4385a32 in _nss_files_getprotobyname_r (name=0x420021c800 "tcp", result=0x368b1a0 , buffer=0x36e7a20 "# Internet (IP) protocols\n", buflen=1024, errnop=0x7fffe67fc6a0) at nss_files/files-proto.c:38
#2 0x0000000003026f47 in getprotobyname_r ()
#3 0x0000000003026d18 in getprotobyname ()
#4 0x0000000002208aee in ?? ()
#5 0x0000000000000000 in ?? ()
```

Should probably document that somewhere as an example for why you may want to use musl here.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.