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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 3 May 2022 10:26:04 -0700
From:   Randy Dunlap <rdunlap@...radead.org>
To:     Марк Коренберг 
        <socketpair@...il.com>, linux-kernel@...r.kernel.org,
        Alexander Viro <viro@...iv.linux.org.uk>,
        Christian Brauner <christian@...uner.io>
Subject: Re: BUG: vfork() returns EINVAL after unshare(CLONE_NEWTIME)

[add some readers:]

On 3/31/22 01:36, Марк Коренберг wrote:
> test:
> ----------------------------------------
> #define _GNU_SOURCE 1
> #include <stdio.h>
> #include <sched.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <sys/types.h>
> #include <sys/wait.h>
> #include <err.h>
> 
> #ifndef CLONE_NEWTIME
> #define CLONE_NEWTIME   0x00000080
> #endif
> 
> int main (void)
> {
>   if (unshare (CLONE_NEWTIME))  err (EXIT_FAILURE, "UNSHARE_NEWTIME");
> 
>   pid_t pid;
>   switch (pid=vfork ())
>   {
>   case 0:
>     _exit(0);
>   case -1:
>     err(EXIT_FAILURE, "vfork BUG");
>   default:
>     waitpid(pid, NULL, 0);
>   }
>   return 0;
> }
> -----------------------------------------------
> 
> Seems the bug in kernel/fork.c. It does not check for CLONE_VFORK
> 
> if (clone_flags & (CLONE_THREAD | CLONE_VM)) {
>     if (nsp->time_ns != nsp->time_ns_for_children)
>         return ERR_PTR(-EINVAL);
> }
> 
> -----------------------------------
> Changing vfork() to fork() in the program works ok.
> The bug has been found during regression in our system because Python
> 3.10 runs subprocesses using vfork()+execve().
> 

-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ