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>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <cetfatnt2cy2pmcskg243ebau36au2vy6fi6mu7hpgg3e7kjp4@gg7l5zoix4xt>
Date:   Tue, 9 May 2023 12:03:48 +0200
From:   Michal Koutný <mkoutny@...e.com>
To:     Tejun Heo <tj@...nel.org>
Cc:     cgroups@...r.kernel.org, linux-kernel@...r.kernel.org,
        Zefan Li <lizefan.x@...edance.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Benjamin Berg <benjamin@...solutions.net>
Subject: Re: [RFC PATCH] cgroup: Return error when attempting to migrate a
 zombie process

On Fri, May 05, 2023 at 09:04:37AM -1000, Tejun Heo <tj@...nel.org> wrote:
> This seems racy to me. The liveness state can change between here and the
> PF_EXITING check in cgroup_migrate_add_task(), right?

You're right, threadgroup lock won't prevent that (as I got wrongly in
the patch):

  cgroup_procs_write_start                                 
                                                     do_exit
                                                       exit_signals
                                                         cgroup_threadgroup_change_begin
                                                           tsk->flags |= PF_EXITING
                                                         cgroup_threadgroup_change_end
    percpu_down_write(&cgroup_threadgroup_rwsem)           
      ...                                                  
      atomic_read(&live)                                   
                                                       ...
                                                       atomic_dec_and_test(live)
      ...                                                  
      cgroup_migrate_add_task                              
      ...                                                  
    percpu_up_write(&cgroup_threadgroup_rwsem)


> Wouldn't it be better to just track how many tasks are tracked and
> return -ESRCH if none was migrated?

Thanks, such an integral sounds better, will see.

Michal

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ