Commit Graph

1398 Commits

Author SHA1 Message Date
Alex Chernyakhovsky 2f90addb7c Revert "Remove redundant malloc/free"
This reverts commit 6321b1d9c5.

The original commit 6321b1d9c5 switched
from a malloc call of a 22400 byte buffer to a stack-allocated 22400
byte buffer, in addition to the fairly large buffers already allocated
in the functions. Some systems have fairly small stack frames, making
this 22K allocation potentially dangerous. On my stock Debian bullseye
system, I have 200809 bytes (from `getconf
_POSIX_THREAD_ATTR_STACKSIZE`); a 22400 byte buffer already represents
about 10% of the available stacksize.

Other systems, such as those with musl libc, may have either 80KiB or
128KiB [1], making this allocation represent between 18% to 28% of the
available stack space.

[1] https://wiki.musl-libc.org/functional-differences-from-glibc.html#Thread-stack-size
2022-05-30 20:55:21 -04:00
Alex Chernyakhovsky adb62e97ff Add fuzzer for the terminal
This commit adds a fuzzer for more of the terminal pipeline, adding
coverage for the input and output portions of the terminal
framebuffer.
2022-05-30 20:23:21 -04:00
Alex Chernyakhovsky 0c6e034459 Add fuzzing infrastructure
This commit adds the --enable-fuzzing (and --enable-asan, to make
fuzzing more useful) options and a sample fuzzer for the terminal
parser. At this time only libfuzzer is supported. Future changes to
add AFL to get more fuzzing capability should be possible with the
addition of the afl_driver.cc from Chromium.
2022-05-30 20:23:21 -04:00
Alex Chernyakhovsky 1f27c532ac Add code coverage instructions to README.md 2022-05-30 19:38:10 -04:00
Alex Chernyakhovsky 16c4ff84f9 Ignore generated protobufs for coverage 2022-05-30 19:38:10 -04:00
Alex Chernyakhovsky 70a02d1e83 Add support for generating coverage reports
This change adds autoconf/automake support for building all of mosh
with gcov, and generates an lcov html report. This allows seeing which
parts ofthe source tree have good test coverage, and which can be
shored up. Eventually, it would be good to hook this up to Github
Actions to be generated automatically.
2022-05-30 19:38:10 -04:00
Wolfgang E. Sanyer dbe419d0e0 Disable clang warning in order to mitigate protocolbuffers/protobuf#9181
Signed-off-by: Wolfgang E. Sanyer <WolfgangESanyer@gmail.com>
2022-02-04 11:08:30 -05:00
Wolfgang E. Sanyer 7b534bacb4 Replace Travis-CI badge with Github Actions badge.
Signed-off-by: Wolfgang E. Sanyer <WolfgangSanyer@Google.com>
2022-02-04 11:08:30 -05:00
Wolfgang E. Sanyer 179e1d9f56 Add github action for CI build
Signed-off-by: Wolfgang E. Sanyer <WolfgangSanyer@Google.com>
2022-02-04 11:08:30 -05:00
Andrew Chin 378dfa6aa5 Merge pull request #1150 from ncfavier/patch-1
Add tmux and alacritty to title_term_types
2021-12-10 16:07:48 -05:00
Andrew Chin 311764712e Merge pull request #1124 from piru/master
Use CLOCK_MONOTONIC_RAW when available
2021-12-08 18:42:38 -05:00
Andrew Chin 6b2ffa904d Merge pull request #1160 from njaard/master
Don't sometimes hang just after launching ssh
2021-11-04 12:46:10 -04:00
Kalle Samuels 9cf1a9c8ee Don't sometimes hang just after launching ssh
sshd has a bug in which the sometimes it may get stuck trying to read from the client
even though the child process has already exited. This is visible at
https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/serverloop.c?annotate=1.226 line 274:
once the child is waited on, `child_terminated` is reset to 0, which causes it to use an infinite timeout 
in the select there.

This workaround causes mosh to disconnect from the server, thereby allowing sshd finish.
2021-10-28 12:38:04 -07:00
Harry Sintonen 87fd565268 Only use CLOCK_MONOTONIC_RAW with __APPLE__ systems. 2021-10-21 16:43:41 +03:00
Naïm Favier bb34ce585e Add tmux and alacritty to title_term_types
Resolves #1130
2021-08-26 19:55:08 +02:00
Andrew Chin e023e81c08 Merge pull request #1125 from black-desk/master
.gitignore: add autogenerated files
2021-07-21 10:23:25 -04:00
black_desk 3a0e19075b .gitignore: fix path 2021-07-21 13:13:02 +08:00
black_desk 232c6bf19e .gitignore: add compile_commands.json 2021-07-21 13:12:03 +08:00
Andrew Chin 68035c18d4 Merge pull request #1146 from buzztiaan/patch-1
fixed the irc channel link in README
2021-07-13 16:17:44 -04:00
buZz cf8a680f2d fixed the irc channel link in README 2021-07-13 22:02:41 +02:00
Harry Sintonen 57b97a4c91 Use CLOCK_MONOTONIC_RAW when available 2020-12-05 21:21:14 +02:00
John Hood 03087e7a76 If exec()ing the remote command fails, pause briefly
This makes the resulting error from mosh-server visible in ordinary usage.
2020-05-18 00:01:05 -04:00
John Hood 12199114fe Move generated includes to their own directory to avoid conflicts.
Fixes #1051, mosh fails to build on case-insensitive filesystems.

XXX This isn't perfect because autoconf/automake drop several extra
files in the directory anyway.
2020-05-17 23:55:09 -04:00
John Hood 609fb91fbc Use Travis Homebrew addon. 2020-05-17 22:29:24 -04:00
John Hood 8f7c29dece "Fix" Travis OS X builds. 2020-05-17 01:20:25 -04:00
Anders Kaseorg 0cc492dbae configure: Add test for whether protoc matches protobuf
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-02 22:42:21 -07:00
Anders Kaseorg feced5910c configure: Fix FD_ISSET test under -Werror
The uninitialized variable warning from T x; broke the test if the
user passed CXXFLAGS='-O2 -Wall -Werror'.  (Users shouldn’t do that;
our own --enable-compile-warnings=error option was unaffected.)

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-02 22:42:21 -07:00
Anders Kaseorg 7c10080766 configure: Fix forkpty test code indentation
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-02 22:42:21 -07:00
Anders Kaseorg 8682f39fa5 configure: Remove unused tests
These tests only define HAVE_* macros that we never check.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-02 22:42:20 -07:00
Anders Kaseorg e009ba4e76 configure: Set language to C++ globally
As of commit dd941df19d, we no longer
build any plain C, except within AM_PROG_AR.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-02 22:42:20 -07:00
John Hood b1da700535 Fix Appveyor build.
Change the openssl-devel package to libssl-devel.  Cygwin still has an
"obsolete" (essentially virtual) package for openssl-devel, but it
doesn't seem to work properly on Appveyor's Cygwin install.

Protobuf >= 3.6.0 requires C++11, which I added support for last year.
But when I did that, I requested strict ANSI C++ compatibility, which
causes Cygwin/newlib's libc feature test macros to be set to disable
(at least) POSIX.1 extensions.  Let the Autoconf macro use its default
instead (prefer GNU/extended C++, accept anything).
2019-07-10 12:56:52 -04:00
Anders Kaseorg 335e3869b7 configure: Another flag for macOS distcheck: -Wno-error=nested-anon-types
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-06-12 22:51:08 -07:00
Anders Kaseorg f7a054c3e7 configure: Add --enable-static-LIBRARY options for selective static linking
Statically linking mosh-server with glibc isn’t a great idea for
various reasons (nsswitch modules, locale format incompatibilities).
But we can provide most of the benefits of static linking by allowing
specific library dependencies to be linked statically using -Bstatic
and -Bdynamic.  The full set is enabled by

    ./configure --enable-static-libraries

which is equivalent to

    ./configure --enable-static-libstdc++ --enable-static-libgcc \
      --enable-static-utempter --enable-static-zlib --enable-static-curses \
      --enable-static-crypto --enable-static-protobuf

and results in binaries whose only runtime library dependencies are
provided with libc:

    $ ldd src/frontend/mosh-server
            linux-vdso.so.1 (0x00007ffe0b377000)
            libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fa0d9970000)
            libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa0d97e3000)
            libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa0d97c2000)
            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa0d95d8000)
            /lib64/ld-linux-x86-64.so.2 (0x00007fa0d9f6a000)

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-02-10 15:49:43 -08:00
Anders Kaseorg 6d30b18ccb configure.ac: Fix underquoted AC_HELP_STRING call
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-02-10 15:49:43 -08:00
Peter Edwards c3a2756065 Apply latest consecutive resize, not earliest.
If there are consecutive resize events in the userstream to be applied in
"serve", we should apply the last/latest one in the sequence, not the
first/earliest one.

This fixes a problem where a flurry of resize events (eg, generated
by a window manager resizing the client), can cause mosh to have an
out-of-date idea as to what the physical geometry of the window is.
2019-01-04 04:06:30 -08:00
John Hood 944fd6c796 Restrict cppcheck to src/ directory to avoid Git worktrees. 2018-08-29 22:44:04 -04:00
John Hood 71829ff631 unicode-later-combining.test: Document slightly. 2018-08-29 22:44:04 -04:00
John Hood fecd4ee29b Some more namespace hygiene for "using decl;". 2018-08-15 19:28:38 -04:00
John Hood 756f4f8e98 Remove "using namespace std;". 2018-08-15 19:27:23 -04:00
John Hood fb23168ed9 Always use std::min, std::max. 2018-08-15 19:26:27 -04:00
John Hood e5f8a826ef Fix bind(2) being misinterpreted as std::bind() with libc++7 on FreeBSD.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230624
2018-08-15 01:11:48 -04:00
John Hood 4aff80b872 Fix more inappropriate const_iterator usage. 2018-08-03 19:39:08 -04:00
John Hood 9a606c2f3d src/statesync/completeterminal.cc: fix bad iterator type 2018-08-03 17:32:07 -04:00
John Hood 8ac80db419 C++03 bound functions are not available in C++17; remove
This makes me a little sad, it's time to move to C++11 or greater.
2018-08-03 16:13:47 -04:00
John Hood ace6324a77 Display CPU count on Travis/MacOS. 2018-08-03 15:16:55 -04:00
John Hood 5cdbad68b8 Ignore select() errors on Travis/MacOS. 2018-08-03 15:16:55 -04:00
John Hood 3ea9e3e5a4 mosh-server: improve error logging
Also stop using _exit(), believed unnecessary now with proper stdio
flushing.
2018-08-03 15:16:55 -04:00
John Hood 26143e9a63 Allow Travis to use its preferred MacOS/XCode image. 2018-08-02 22:27:26 -04:00
John Hood 9ba07296f9 Fix Homebrew failure on Travis.
As predicted, 'brew unlink python' is no longer needed.
2018-08-02 21:42:49 -04:00
John Hood 6fe7cde94d Require C++11 if protobuf version >= 3.6.0 is installed
This shouldn't require C++11 when not required.

This hack may not always detect when C++11 *is* required,
in which case a little autoconf tweaking may be needed
to get a good compile.
2018-08-02 19:09:21 -04:00