Re: sys_fork

Ricardo Nabinger Sanchez <[email protected]>
Newsgroups org.kernel.vger.linux-assembly
Message-ID <[email protected]>
Quoting  HIToC <[email protected]>
Sent on  Mon, 28 Nov 2005 11:10:51 +0100

Hello,

as Frank said, you're not handling fork() result.

> st_connection:	mov	[new_sock], eax	; new socket
> saved!
> 
> 		mov	eax, 0x02	; sys_fork
> 		xor	ebx, ebx
> 		int	0x80

you should test here whether eax is < 0 (error), 0 (child) or > 0 (parent)
and act accordingly.  but both processes are executing this right away:

> 
> 		mov		eax, 0x06	; sys_close
> 		mov		ebx, [sock_fd]
> 		int	0x80

and closing their listening socket (the one which is blocked on accept()).

do the program exit with error (EINVAL)?

-- 
Ricardo Nabinger Sanchez
GNU/Linux #140696 [http://counter.li.org]
Slackware Linux + FreeBSD

  Left to themselves, things tend to go from bad to worse.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.