cubehub / doppler

Command line utility that takes IQ data stream as input and produces doppler corrected output stream based on TLE
MIT License
51 stars 13 forks source link

On some 64 bit Gentoo doppler -h crashes #4

Closed whit3fir3 closed 8 years ago

whit3fir3 commented 8 years ago

I've recently downloaded and successfully compiled Doppler however when I execute it, the program stops with the message that just says Killed. I was able to get the following from strace when I attempted to execute the program. I'm trying to figure out why this is happening. Any help would be greatly appreciated:

$strace /usr/local/bin/doppler -h

execve("/usr/local/bin/doppler", ["/usr/local/bin/doppler", "-h"], [/* 49 vars _/]) = 0 brk(0) = 0xe1c6e555d90 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6653bb182000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=273529, ...}) = 0 mmap(NULL, 273529, PROT_READ, MAP_PRIVATE, 3, 0) = 0x6653bb13f000 close(3) = 0 open("/lib64/libm.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@U\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1050592, ...}) = 0 mmap(NULL, 3145832, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x6653bac65000 mprotect(0x6653bad65000, 2093056, PROT_NONE) = 0 mmap(0x6653baf64000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xff000) = 0x6653baf64000 close(3) = 0 open("/usr/local/lib64/libgpredict.so", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000(\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=73572, ...}) = 0 mmap(NULL, 2162728, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x6653baa54000 mprotect(0x6653baa64000, 2093056, PROT_NONE) = 0 mmap(0x6653bac63000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xf000) = 0x6653bac63000 close(3) = 0 open("/lib64/librt.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 #\0\0\0\0\0\0"..., 832) = 832 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6653bb13e000 fstat(3, {st_mode=S_IFREG|0755, st_size=31056, ...}) = 0 mmap(NULL, 2128408, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x6653ba84c000 mprotect(0x6653ba853000, 2093056, PROT_NONE) = 0 mmap(0x6653baa52000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x6653baa52000 close(3) = 0 open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\274\37\2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1692984, ...}) = 0 mmap(NULL, 3800728, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x6653ba4ac000 mprotect(0x6653ba643000, 2093056, PROT_NONE) = 0 mmap(0x6653ba842000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x196000) = 0x6653ba842000 mmap(0x6653ba848000, 16024, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x6653ba848000 close(3) = 0 open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\16\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=14296, ...}) = 0 mmap(NULL, 2109584, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x6653ba2a8000 mprotect(0x6653ba2aa000, 2097152, PROT_NONE) = 0 mmap(0x6653ba4aa000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x6653ba4aa000 close(3) = 0 open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\327p\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=96936, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6653bb13d000 mmap(NULL, 2208304, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x6653ba08c000 mprotect(0x6653ba0a3000, 2093056, PROT_NONE) = 0 mmap(0x6653ba2a2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0x6653ba2a2000 mmap(0x6653ba2a4000, 12848, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x6653ba2a4000 close(3) = 0 open("/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.5/libgcc_s.so.1", O_RDONLY|OCLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=87776, ...}) = 0 mmap(NULL, 2183840, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x6653b9e76000 mprotect(0x6653b9e8a000, 2097152, PROT_NONE) = 0 mmap(0x6653ba08a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14000) = 0x6653ba08a000 close(3) = 0 open("/usr/lib64/libglib-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\252\1\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1228128, ...}) = 0 mmap(NULL, 3325856, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x6653b9b4a000 mprotect(0x6653b9c74000, 2097152, PROT_NONE) = 0 mmap(0x6653b9e74000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12a000) = 0x6653b9e74000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6653bb13c000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6653bb13b000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6653bb139000 arch_prctl(ARCH_SET_FS, 0x6653bb139800) = 0 mprotect(0x6653ba842000, 16384, PROT_READ) = 0 mprotect(0x6653ba2a2000, 4096, PROT_READ) = 0 mprotect(0x6653b9e74000, 4096, PROT_READ) = 0 mprotect(0x6653ba08a000, 4096, PROT_READ) = 0 mprotect(0x6653ba4aa000, 4096, PROT_READ) = 0 mprotect(0x6653baa52000, 4096, PROT_READ) = 0 +++ killed by SIGKILL +++ Killed

andresv commented 8 years ago

Which platform you are using? I have tested it on 64 bit 14.04 and on Mac OS X 10.10.

There is problem with 32 bit ubuntu 14.04 because of how Rust deals with complex numbers: https://github.com/cubehub/doppler/issues/3

whit3fir3 commented 8 years ago

andresv,

Sorry I guess it would have helped if I had included that information in my initial post. I'm running this on a 64bit Gentoo based system. Just to be clear any time I execute the doppler binary it is being killed, I assume by MProtect. I have not been able to figure out why MProtect is unhappy about what the code is doing in memory.

andresv commented 8 years ago

I cannot reproduce your error on 64 bit Gentoo livecd:

gentoo@livecd ~/Downloads/doppler $ uname -a
Linux livecd 3.15.6-aufs-r1 #1 SMP Thu Aug 7 15:26:08 UTC 2014 x86_64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz GenuineIntel GNU/Linux
gentoo@livecd ~/Downloads $ git clone https://github.com/cubehub/doppler.git
Cloning into 'doppler'...
remote: Counting objects: 378, done.
remote: Total 378 (delta 0), reused 0 (delta 0), pack-reused 378
Receiving objects: 100% (378/378), 73.16 KiB | 0 bytes/s, done.
Resolving deltas: 100% (213/213), done.
Checking connectivity... done.
gentoo@livecd ~/Downloads $ git clone https://github.com/cubehub/libgpredict.gitCloning into 'libgpredict'...
remote: Counting objects: 124, done.
remote: Total 124 (delta 0), reused 0 (delta 0), pack-reused 124
Receiving objects: 100% (124/124), 75.74 KiB | 0 bytes/s, done.
Resolving deltas: 100% (61/61), done.
Checking connectivity... done.
gentoo@livecd ~/Downloads $ cd libgpredict/
gentoo@livecd ~/Downloads/libgpredict $ mkdir build
gentoo@livecd ~/Downloads/libgpredict $ cd build/
gentoo@livecd ~/Downloads/libgpredict/build $ cmake ../
-- The C compiler identification is GNU 4.8.3
-- The CXX compiler identification is GNU 4.8.3
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28")
-- Found GLIB: /usr/include/glib-2.0;/usr/lib64/glib-2.0/include (found version "2.40.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/gentoo/Downloads/libgpredict/build
gentoo@livecd ~/Downloads/libgpredict/build $ make
Scanning dependencies of target gpredict
[  8%] Building C object CMakeFiles/gpredict.dir/sgpsdp/solar.c.o
[ 16%] Building C object CMakeFiles/gpredict.dir/sgpsdp/sgp_obs.c.o            
[ 25%] Building C object CMakeFiles/gpredict.dir/sgpsdp/sgp_in.c.o              
[ 33%] Building C object CMakeFiles/gpredict.dir/sgpsdp/sgp_time.c.o            
[ 41%] Building C object CMakeFiles/gpredict.dir/sgpsdp/sgp_math.c.o            
[ 50%] Building C object CMakeFiles/gpredict.dir/sgpsdp/sgp4sdp4.c.o            
[ 58%] Building C object CMakeFiles/gpredict.dir/predict-tools.c.o              
[ 66%] Building C object CMakeFiles/gpredict.dir/time-tools.c.o                
[ 75%] Building C object CMakeFiles/gpredict.dir/orbit-tools.c.o                
[ 83%] Building C object CMakeFiles/gpredict.dir/gtk-sat-data.c.o              
[ 91%] Building C object CMakeFiles/gpredict.dir/qth-data.c.o                  
[100%] Building C object CMakeFiles/gpredict.dir/sat-vis.c.o                    
Linking C shared library libgpredict.so
[100%] Built target gpredict
gentoo@livecd ~/Downloads/libgpredict/build $ make install
[100%] Built target gpredict
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/lib/libgpredict.so
CMake Error at cmake_install.cmake:42 (FILE):
  file INSTALL cannot copy file
  "/home/gentoo/Downloads/libgpredict/build/libgpredict.so" to
  "/usr/local/lib/libgpredict.so".

Makefile:65: recipe for target 'install' failed
make: *** [install] Error 1
gentoo@livecd ~/Downloads/libgpredict/build $ sudo make install
[100%] Built target gpredict
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/lib/libgpredict.so
-- Installing: /usr/local/include/gpredict/gpredict.h
-- Installing: /usr/local/include/gpredict/gtk-sat-data.h
-- Installing: /usr/local/include/gpredict/orbit-tools.h
-- Installing: /usr/local/include/gpredict/predict-tools.h
-- Installing: /usr/local/include/gpredict/qth-data.h
-- Installing: /usr/local/include/gpredict/sat-vis.h
-- Installing: /usr/local/include/gpredict/time-tools.h
-- Installing: /usr/local/include/gpredict/sgpsdp/sgp4sdp4.h
gentoo@livecd ~/Downloads/libgpredict/build $ sudo ldconfig
gentoo@livecd ~/Downloads/libgpredict/build $ cd ..
gentoo@livecd ~/Downloads/libgpredict $ cd ..
gentoo@livecd ~/Downloads $ cd doppler/
gentoo@livecd ~/Downloads/doppler $ curl -sSf https://static.rust-lang.org/rustup.sh | sh

Welcome to Rust.

This script will download the Rust compiler and its package manager, Cargo, and
install them to /usr/local. You may install elsewhere by running this script
with the --prefix=<path> option.

The installer will run under 'sudo' and may ask you for your password. If you do
not want the script to run 'sudo' then pass it the --disable-sudo flag.

You may uninstall later by running /usr/local/lib/rustlib/uninstall.sh,
or by running this script again with the --uninstall flag.

Continue? (y/N) y

rustup: gpg available. signatures will be verified
rustup: downloading manifest for 'stable'
rustup: downloading toolchain for 'stable'
######################################################################## 100.0%
gpg: Signature made Wed 05 Aug 2015 01:31:43 AM UTC using RSA key ID 7B3B09DC
gpg: Good signature from "Rust Language (Tag and Release Signing Key) <rust-key@rust-lang.org>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 108F 6620 5EAE B0AA A8DD  5E1C 85AB 96E6 FA1B E5FE
     Subkey fingerprint: C134 66B7 E169 A085 1886  3216 5CB4 A934 7B3B 09DC
rustup: extracting installer
rustup: installing toolchain for 'stable'
install: creating uninstall script at /usr/local/lib/rustlib/uninstall.sh
install: installing component 'rustc'
install: installing component 'cargo'
install: installing component 'rust-docs'

    Rust is ready to roll.

gentoo@livecd ~/Downloads/doppler $ cargo build --release
    Updating registry `https://github.com/rust-lang/crates.io-index`
    Updating git repository `https://github.com/cubehub/rust-gpredict.git`
 Downloading clap v0.9.2
 Downloading num v0.1.25
 Downloading ansi_term v0.5.2
 Downloading libc v0.1.5
 Downloading strsim v0.3.0
 Downloading log v0.3.2
 Downloading rustc-serialize v0.3.15
 Downloading rand v0.3.8
 Downloading gcc v0.3.5
 Downloading time v0.1.25
   Compiling libc v0.1.5
   Compiling strsim v0.3.0
   Compiling rustc-serialize v0.3.15
   Compiling ansi_term v0.5.2
   Compiling gcc v0.3.5
   Compiling rand v0.3.8
   Compiling log v0.3.2
   Compiling clap v0.9.2
   Compiling time v0.1.25
   Compiling gpredict v0.2.2 (https://github.com/cubehub/rust-gpredict.git#763df98b)
   Compiling num v0.1.25
   Compiling doppler v1.1.1 (file:///home/gentoo/Downloads/doppler)
gentoo@livecd ~/Downloads/doppler $ ./target/release/doppler -h
doppler 1.1.1
Andres Vahter <andres.vahter@gmail.com>
Compensates IQ data stream doppler shift based on TLE information and constant shift for IQ data is also possible.

USAGE:
        doppler [FLAGS] [SUBCOMMANDS]

FLAGS:
    -h, --help       Prints help information
    -v, --version    Prints version information

SUBCOMMANDS:
    const    Constant shift mode
    help     Prints this message
    track    Doppler tracking mode
gentoo@livecd ~/Downloads/doppler $ sudo cp target/release/doppler /usr/local/bin/
gentoo@livecd ~/Downloads/doppler $ doppler -h                                            
doppler 1.1.1                                                                                            
Andres Vahter <andres.vahter@gmail.com>
Compensates IQ data stream doppler shift based on TLE information and constant shift for IQ data is also possible.

USAGE:
        doppler [FLAGS] [SUBCOMMANDS]

FLAGS:
    -h, --help       Prints help information
    -v, --version    Prints version information

SUBCOMMANDS:
    const    Constant shift mode
    help     Prints this message
    track    Doppler tracking mode
whit3fir3 commented 8 years ago

andresv,

On the live environment that you were running were you using normal Gentoo or the Hardened Gentoo live CD? The reason I ask is I believe the problem is related to PaX ( https://en.wikipedia.org/wiki/PaX ) and I do believe that PaX is preinstalled on the Gentoo Hardened live version. Something that the code is attempting to do something PaX isn't happy about, or that is my theory at least.

Currently I've disabled MPROTECT on the binary (#paxctl -m ./doppler), but when I attempt to execute doppler in an strace I still see MPROTECT killing the process.

andresv commented 8 years ago

I was using this image: http://ftp.snt.utwente.nl/pub/os/linux/gentoo/releases/amd64/20140826/livedvd-amd64-multilib-20140826.iso