{"action":"created","issue":{"url":"https://api.github.com/repos/mobile-shell/mosh/issues/727","repository_url":"https://api.github.com/repos/mobile-shell/mosh","labels_url":"https://api.github.com/repos/mobile-shell/mosh/issues/727/labels{/name}","comments_url":"https://api.github.com/repos/mobile-shell/mosh/issues/727/comments","events_url":"https://api.github.com/repos/mobile-shell/mosh/issues/727/events","html_url":"https://github.com/mobile-shell/mosh/issues/727","id":139921138,"number":727,"title":"SIGSEGV in mosh-server on debian sid","user":{"login":"gibbon-joel","id":7837969,"avatar_url":"https://avatars.githubusercontent.com/u/7837969?v=3","gravatar_id":"","url":"https://api.github.com/users/gibbon-joel","html_url":"https://github.com/gibbon-joel","followers_url":"https://api.github.com/users/gibbon-joel/followers","following_url":"https://api.github.com/users/gibbon-joel/following{/other_user}","gists_url":"https://api.github.com/users/gibbon-joel/gists{/gist_id}","starred_url":"https://api.github.com/users/gibbon-joel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gibbon-joel/subscriptions","organizations_url":"https://api.github.com/users/gibbon-joel/orgs","repos_url":"https://api.github.com/users/gibbon-joel/repos","events_url":"https://api.github.com/users/gibbon-joel/events{/privacy}","received_events_url":"https://api.github.com/users/gibbon-joel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2016-03-10T15:25:36Z","updated_at":"2016-03-19T00:52:39Z","closed_at":null,"body":"Hi,\r\n\r\nI guess I need a little help to provide useful information on this, but I have a problem with the mosh-server process not starting up properly on debian sid. I noticed the problem first yesterday (9.3.) morning when trying to login into my server.\r\n\r\nStarting the process manually on the affected system yields:\r\n\r\n$ mosh-server\r\n\r\nMOSH CONNECT 60001 <OTP>\r\n\r\nmosh-server (mosh 1.2.5) [build mosh 1.2.5]\r\nCopyright 2012 Keith Winstein <mosh-devel@mit.edu>\r\nLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\r\nThis is free software: you are free to change and redistribute it.\r\nThere is NO WARRANTY, to the extent permitted by law.\r\n\r\n[mosh-server detached, pid = 3321]\r\n$\r\n\r\nwhich looks ok. But there is no mosh-server process running and a message in the kernel log:\r\n[ 4097.845386] mosh-server[3321]: segfault at 0 ip           (null) sp 00007fff59cd0fa8 error 14 in mosh-server[55715b883000+59000]\r\n\r\nlast lines of strace -f mosh-server:\r\n....\r\nioctl(5, TIOCSPTLCK, [0])               = 0\r\nioctl(5, TCGETS, {B38400 opost isig icanon echo ...}) = 0\r\nioctl(5, TIOCGPTN, [1])                 = 0\r\nstat(\"/dev/pts/1\", {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0\r\nopen(\"/dev/pts/1\", O_RDWR|O_NOCTTY)     = 6\r\nioctl(6, TIOCSWINSZ, {ws_row=58, ws_col=272, ws_xpixel=0, ws_ypixel=0}) = 0\r\nclone(strace: Process 3333 attached\r\nchild_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fc0096e2a10) = 3333\r\n[pid  3333] set_robust_list(0x7fc0096e2a20, 24) = 0\r\n[pid  3332] close(6)                    = 0\r\n[pid  3332] rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7fc008d8bd30}, {SIG_DFL, [], 0}, 8) = 0\r\n[pid  3332] --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} ---\r\n[pid  3333] close(5)                    = 0\r\n[pid  3333] setsid()                    = 3333\r\n[pid  3333] ioctl(6, TIOCSCTTY, 0)      = 0\r\n[pid  3333] dup2(6, 0)                  = 0\r\n[pid  3333] dup2(6, 1)                  = 1\r\n[pid  3333] dup2(6, 2)                  = 2\r\n[pid  3333] close(6)                    = 0\r\n[pid  3333] rt_sigaction(SIGHUP, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7fc008d8bd30}, NULL, 8) = 0\r\n[pid  3333] rt_sigaction(SIGPIPE, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7fc008d8bd30}, NULL, 8) = 0\r\n[pid  3333] close(3)                    = 0\r\n[pid  3333] --- SIGHUP {si_signo=SIGHUP, si_code=SI_KERNEL} ---\r\n[pid  3332] +++ killed by SIGSEGV +++\r\n+++ killed by SIGHUP +++\r\n\r\nDebian Package Version: 1.2.5-1.1\r\nI tried building Version 1.2.5 and the current git master (e7303e0b666c6f19b7e3417710217ee4ec95460e) both yielding at least the same SIGSEGV.\r\n\r\n- ii  libncurses5:am 6.0+20160213 amd64\r\n- ii  libprotobuf-c1 1.2.1-1      amd64\r\n- ii  libprotobuf9v5 2.6.1-1.3    amd64\r\n- ii  libssl1.0.0:am 1.0.2d-1     amd64\r\n- ii  libssl1.0.2:am 1.0.2g-1     amd64\r\n- ii  libutempter0:a 1.1.6-3      amd64\r\n- ii  protobuf-compi 2.6.1-1.3    amd64\r\n- ii  zlib1g:amd64   1:1.2.8.dfsg amd64\r\n\r\nFurther library versions can be provided on request since I am not sure which libraries are involved.\r\n\r\nI am not very good with gdb, but if someone tells me what to do, I can try to provide more information."},"comment":{"url":"https://api.github.com/repos/mobile-shell/mosh/issues/comments/198595566","html_url":"https://github.com/mobile-shell/mosh/issues/727#issuecomment-198595566","issue_url":"https://api.github.com/repos/mobile-shell/mosh/issues/727","id":198595566,"user":{"login":"cgull","id":1934797,"avatar_url":"https://avatars.githubusercontent.com/u/1934797?v=3","gravatar_id":"","url":"https://api.github.com/users/cgull","html_url":"https://github.com/cgull","followers_url":"https://api.github.com/users/cgull/followers","following_url":"https://api.github.com/users/cgull/following{/other_user}","gists_url":"https://api.github.com/users/cgull/gists{/gist_id}","starred_url":"https://api.github.com/users/cgull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgull/subscriptions","organizations_url":"https://api.github.com/users/cgull/orgs","repos_url":"https://api.github.com/users/cgull/repos","events_url":"https://api.github.com/users/cgull/events{/privacy}","received_events_url":"https://api.github.com/users/cgull/received_events","type":"User","site_admin":false},"created_at":"2016-03-19T00:52:39Z","updated_at":"2016-03-19T00:52:39Z","body":"There's plenty of little bugs evenly spattered here, and many ways to fix this:\r\n* Root cause, I think, is that `pkg-config --libs protobuf` produces `-lprotobuf -pthread -lpthread`; `-lpthread` is unnecessary and deprecated with gcc.\r\n* `src/frontend/makefile.am` only applies `protobuf_LIBS` to the link command for `mosh-server`; I believe it maybe should also be applying `protobuf_CFLAGS`, but evidence for this is a bit thin.\r\n* `gcc` or `binutils` or `rtld` or...something has a recent change in behavior that causes it to be more sensitive to finding `-lpthread` injected in an odd place in the library search list.  If you hold your mouth just so and look in a certain way, you can almost see this as some kind of issue causing binaries linked with full RELRO to search for symbols differently.  But I think ultimately we're feeding the wrong command to gcc.  I haven't investigated why this breaks; I think making our build more correct is the better solution.\r\n\r\nFixing any one of these little issues would solve Mosh's problem.  I think the problem is only maybe 10% our fault, but we're left holding a bunch of pieces.  The fix in my PR is perhaps slightly less correct than handling CFLAGS better for link commands, but it's also focused on the specific problem and less likely to cause problems on random other platforms.  Bikeshed color opinions (and more substantive comments) will be gratefully listened to.\r\n\r\nI'll also open an issue on protobuf, which I think is primarily to blame here.\r\n"}}