Re: [RFC PATCH] cgroup: Return error when attempting to migrate a zombie process

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 05, 2023 at 09:04:37AM -1000, Tejun Heo <tj@xxxxxxxxxx> 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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux