Code Monkey home page Code Monkey logo

Comments (19)

will-riley avatar will-riley commented on September 24, 2024 1

Works! Bravo

from asmttpd.

nemasu avatar nemasu commented on September 24, 2024

Hmm, that's odd. What version of Linux are you running?

from asmttpd.

triforce avatar triforce commented on September 24, 2024

If you have the knowledge to run gdb or strace and give us some more detail such as a stack trace that would also be useful.

from asmttpd.

VioletFlare avatar VioletFlare commented on September 24, 2024

I'm running
OS: Ubuntu 16.04
Kernel: x86_64 Linux 4.4.0-83-generic

That's odd.
When I run the program from within gdb or strace the program works normally (I get a fully working server, it returns the contents of web_root without any problem) until I interrupt it.
Meanwhile, when I try to run it normally it returns the problem i mentioned.
So here's the core:

gdb asmttpd -c core

GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from asmttpd...done.
[New LWP 3943]
[New LWP 3944]
[New LWP 3940]
[New LWP 3945]
[New LWP 3941]
[New LWP 3946]
[New LWP 3942]
Core was generated by `./asmttpd web_root/'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  sys_clone () at syscall.asm:219
219		push r14     ;Else,  set new return address
[Current thread is 1 (LWP 3943)]

Stack trace:

(gdb) thread apply all bt full

Thread 7 (LWP 3942):
#0  sys_accept () at syscall.asm:105
No locals.
#1  0x0000000000400c96 in sys_clone () at syscall.asm:216
No locals.
#2  0x0000000000000000 in ?? ()
No symbol table info available.

Thread 6 (LWP 3946):
#0  sys_clone () at syscall.asm:217
No locals.
Backtrace stopped: Cannot access memory at address 0x7faa5ee96000

Thread 5 (LWP 3941):
#0  sys_accept () at syscall.asm:105
No locals.
#1  0x0000000000400c96 in sys_clone () at syscall.asm:216
No locals.
#2  0x0000000000000000 in ?? ()
No symbol table info available.

Thread 4 (LWP 3945):
#0  sys_clone () at syscall.asm:219
No locals.
Backtrace stopped: Cannot access memory at address 0x7faa5ef9d000

Thread 3 (LWP 3940):
#0  sys_mmap_stack () at syscall.asm:202
No locals.
#1  0x0000000000400c96 in sys_clone () at syscall.asm:216
No locals.
#2  0x0000000000000000 in ?? ()
No symbol table info available.

Thread 2 (LWP 3944):
#0  sys_accept () at syscall.asm:105
No locals.
#1  0x0000000000400c96 in sys_clone () at syscall.asm:216
No locals.
#2  0x0000000000000000 in ?? ()
No symbol table info available.

Thread 1 (LWP 3943):
#0  sys_clone () at syscall.asm:219
No locals.
Backtrace stopped: Cannot access memory at address 0x7faa5f1a8000

I hope I provided enough information.
It is my frist time using it.

from asmttpd.

reallyimeric avatar reallyimeric commented on September 24, 2024

It's wiredweird but I will not get segfault when I run asmttpd with strace, like @VioletFlare ...

ArchLinux with kernel version 4.11.7-1-ARCH x86_64

[x@x-x asmttpd]$ sudo strace ./asmttpd /tmp
execve("./asmttpd", ["./asmttpd", "/tmp"], 0x7ffd2409a428 /* 17 vars */) = 0
write(1, "asmttpd - 0.4\n\0", 15asmttpd - 0.4
)       = 15
write(1, "\n", 1
)                       = 1
write(1, "Using Document Root: \0\0\0\0\0\0\0", 28Using Document Root: ) = 28
write(1, "/tmp", 4/tmp)                     = 4
write(1, "\n", 1
)                       = 1
rt_sigaction(SIGINT, {sa_handler=0x40123e, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=NULL}, NULL, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=0x40123e, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=NULL}, NULL, 8) = 0
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=NULL}, NULL, 8) = 0
open("/tmp", O_RDONLY|O_DIRECTORY)      = 3
socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) = 4
bind(4, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
listen(4, 100000000)                    = 0
mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_GROWSDOWN, -1, 0) = 0x7fc2fcefc000
clone(child_stack=0x7fc2fcefc000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|SIGCHLD) = 31880
mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_GROWSDOWN, -1, 0) = 0x7fc2fcdf4000
clone(child_stack=0x7fc2fcdf4000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|SIGCHLD) = 31881
mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_GROWSDOWN, -1, 0) = 0x7fc2fccec000
clone(child_stack=0x7fc2fccec000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|SIGCHLD) = 31882
mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_GROWSDOWN, -1, 0) = 0x7fc2fcbe4000
clone(child_stack=0x7fc2fcbe4000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|SIGCHLD) = 31883
mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_GROWSDOWN, -1, 0) = 0x7fc2fcadc000
clone(child_stack=0x7fc2fcadc000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|SIGCHLD) = 31884
mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_GROWSDOWN, -1, 0) = 0x7fc2fc9d4000
clone(child_stack=0x7fc2fc9d4000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|SIGCHLD) = 31885
mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_GROWSDOWN, -1, 0) = 0x7fc2fc8cc000
clone(child_stack=0x7fc2fc8cc000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|SIGCHLD) = 31886
mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_GROWSDOWN, -1, 0) = 0x7fc2fc7c4000
clone(child_stack=0x7fc2fc7c4000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|SIGCHLD) = 31887
mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_GROWSDOWN, -1, 0) = 0x7fc2fc6bc000
clone(child_stack=0x7fc2fc6bc000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|SIGCHLD) = 31888
mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_GROWSDOWN, -1, 0) = 0x7fc2fc5b4000
clone(child_stack=0x7fc2fc5b4000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|SIGCHLD) = 31889
nanosleep({tv_sec=10, tv_nsec=0}, 

from asmttpd.

blackjack4494 avatar blackjack4494 commented on September 24, 2024

Any news on this? Because I have the same problem.

Btw. I am using

Linux ffm1 4.10.0-28-generic #32-Ubuntu SMP Fri Jun 30 05:32:18 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

I did some further testings. Ubuntu 16.04 with 4.4.0 kernel works totally fine. I guess there were superior changes in kernel 4.10.0 which is used by ubuntu 17.04

from asmttpd.

nemasu avatar nemasu commented on September 24, 2024

Hmm, I'm on 4.12.3 and it's working. Maybe I'll grab Ubuntu 17.04 and debug it.

from asmttpd.

triforce avatar triforce commented on September 24, 2024

Can you try running it through valgrind? It's not something trivial such as incorrect file permissions is it?

from asmttpd.

nemasu avatar nemasu commented on September 24, 2024

@blackjack4494 @VioletFlare I downloaded a live ISO of Ubuntu 17.04, and I can't get it to segfault. Have you tried using the pre-built version on the releases page?

from asmttpd.

blackjack4494 avatar blackjack4494 commented on September 24, 2024

@triforce https://gist.github.com/blackjack4494/99a520ecda4b5001eef069fd0e9a6575
I am even running this as root and another newly created user same result. I am using this on a server which is virtualized with qemu but shouldn't make any difference actually.

@nemasu I updated the gist and added some gdb logs. But even when I try to run in gdb it is likely 50/50 that it will start or give me segmentation fault.

Sorry in advance my debugging knowledge is not that good anymore :D

from asmttpd.

nemasu avatar nemasu commented on September 24, 2024

@blackjack4494 It seem's that it's running out of stack space, except valgrind says the main thread stack size was 8388608 bytes ( or 8192 KB ), which is what I'm using.
Does ulimit -s return 8192? Also are there any syslogs or dmesg logs from the kernel related to this segfault? I'll try testing with qemu too, can you paste your machine options?

from asmttpd.

nemasu avatar nemasu commented on September 24, 2024

Wow, I just started getting this error myself.

Ran it through valgrind:

==15942== Thread 2:
==15942== Invalid write of size 8
==15942== at 0x400C9C: ??? (syscall.asm:219)
==15942== Address 0x47ffff8 is on thread 2's stack
==15942==
==15942==
==15942== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==15942== Access not within mapped region at address 0x47FFFF8
==15942== at 0x400C9C: ??? (syscall.asm:219)

Tried increasing the stack size of child processes, but didn't work.

from asmttpd.

triforce avatar triforce commented on September 24, 2024

What kernel version are you using @nemasu?

from asmttpd.

nemasu avatar nemasu commented on September 24, 2024

4.12.3 still, was working before. The only difference I can think of is my machine is under heavy load. When I restart I'll try again and see if it makes any difference.

from asmttpd.

will-riley avatar will-riley commented on September 24, 2024

Same segfault, symptoms. Runs under strace. Valgrind shows same Invalid write of size 8.
4.9.34-gentoo

from asmttpd.

nemasu avatar nemasu commented on September 24, 2024

It seems to crash under strace sometimes too:

[pid 32555] mmap(NULL, 163840, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_GROWSDOWN, -1, 0) = 0x7fc050eb6000
....
[pid 32555] clone(child_stack=0x7fc050eb6000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|SIGCHLD) = 32570
....
[pid 32570] --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x7fc050eb5ff8} ---

It appears to be accessing the correct address when it crashes...

from asmttpd.

triforce avatar triforce commented on September 24, 2024

Is there anything we can actually do to prevent this from happening?

from asmttpd.

nemasu avatar nemasu commented on September 24, 2024

There must be a problem or bug somewhere...I've been looking, but still nothing.

from asmttpd.

nemasu avatar nemasu commented on September 24, 2024

Yay! I think I fixed it, please pull, rebuild and try again. I will close this issue soon.

from asmttpd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.