[libvirt] [PATCH 12/13] Protection against doing bad stuff to the root group

Eric Blake eblake at redhat.com
Tue Jul 23 21:58:30 UTC 2013


On 07/23/2013 09:21 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> Add protection such that the virCgroupRemove and
> virCgroupKill* do not do anything to the root cgroup.
> 
> Killing all PIDs in the root cgroup does not end well.

I take it you tried this, on accident :)

> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  src/util/vircgroup.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)

ACK.

> @@ -1002,6 +1007,11 @@ int virCgroupRemove(virCgroupPtr group)
>          if (!group->controllers[i].mountPoint)
>              continue;
>  
> +        /* Don't delete the root group, if we accidentally
> +           ended up in it for some reason */
> +        if (STREQ(group->controllers[i].placement, "/"))
> +            continue;

A VIR_DEBUG might be handy to make it obvious to the next developer that
we are intentionally skipping this.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130723/c4321385/attachment-0001.sig>


More information about the libvir-list mailing list