lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Mon, 21 Jan 2008 17:54:39 -0600
From:	Robert Hancock <hancockr@...w.ca>
To:	Li Xiaodong <lixd@...fujitsu.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [HELP]Problem with exit(0) and _exit(0) on RHEL x86

Li Xiaodong wrote:
> I thought the effects of exit(0) and _exit(0) should be different.
> 
> ----
> int main(void)
> {
>         int var = 0;
>         pid_t pid;
> 
>         printf("before vfork\n");
>         if ( (pid = vfork()) < 0 )
>                 printf("error\n");
>         else if ( pid == 0 )
>         {
>                 var++;
>                 exit(0);  /* Clear parent's IO */
>         }
> 
>         printf("%d\n",var);
>         return 0;
> }
> 
> ----
> 
> int main(void)
> {
>         int var = 0;
>         pid_t pid;
> 
>         printf("before vfork\n");
>         if ( (pid = vfork()) < 0 )
>                 printf("error\n");
>         else if ( pid == 0 )
>         {
>                 var++;
>                 _exit(0);  /* Do not clear parent's IO */
>         }
> 
>         printf("%d\n",var);
>         return 0;
> }
> 
> ----
> 
> But the actual results on RHEL5 x86 were beyond my ken. The outputs of the
> above two are the same. 
> 
> $./a.out
> before vfork
> 1
> 
> Could anyone help me with this? Thanks.

Why do you expect a different result? Also, calling exit from a vforked 
child is explicitly not allowed. The only things you can do are execve 
or _exit.

-- 
Robert Hancock      Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@...pamshaw.ca
Home Page: http://www.roberthancock.com/

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ