[lxc-devel] [PATCH] Fix parsing /proc/self/mounts in lxc-{ls, netstat, ps}

Serge Hallyn serge.hallyn at canonical.com
Thu May 31 13:53:13 UTC 2012


Quoting Ryota Ozaki (ozaki.ryota at gmail.com):
> The original code assumes that 1st column is mount type,
> however, 3rd column is really mount type. Fix it.
> 
> Signed-off-by: Ryota Ozaki <ozaki.ryota at gmail.com>

As the person probably responsible for that mistake,

Acked-by: Serge Hallyn <serge.hallyn at ubuntu.com>


> ---
>  src/lxc/lxc-ls.in      |    2 +-
>  src/lxc/lxc-netstat.in |    2 +-
>  src/lxc/lxc-ps.in      |    2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/lxc/lxc-ls.in b/src/lxc/lxc-ls.in
> index 11a3b45..1c5f8c5 100644
> --- a/src/lxc/lxc-ls.in
> +++ b/src/lxc/lxc-ls.in
> @@ -57,7 +57,7 @@ get_parent_cgroup()
>  		init_cgroup=${fields#*:}
>  
>  		# Get the filesystem mountpoint of the hierarchy
> -		mountpoint=$(grep -E "^cgroup [^ ]+ [^ ]+ ([^ ]+,)?$subsystems(,[^ ]+)? " /proc/self/mounts | cut -d ' ' -f 2)
> +		mountpoint=$(grep -E "^[^ ]+ [^ ]+ cgroup ([^ ]+,)?$subsystems(,[^ ]+)? " /proc/self/mounts | cut -d ' ' -f 2)
>  		if [ -z "$mountpoint" ]; then continue; fi
>  
>  		# Return the absolute path to the containers' parent cgroup
> diff --git a/src/lxc/lxc-netstat.in b/src/lxc/lxc-netstat.in
> index 113c0da..0663d56 100644
> --- a/src/lxc/lxc-netstat.in
> +++ b/src/lxc/lxc-netstat.in
> @@ -53,7 +53,7 @@ get_parent_cgroup()
>  		init_cgroup=${fields#*:}
>  
>  		# Get the filesystem mountpoint of the hierarchy
> -		mountpoint=$(grep -E "^cgroup [^ ]+ [^ ]+ ([^ ]+,)?$subsystems(,[^ ]+)? " /proc/self/mounts | cut -d ' ' -f 2)
> +		mountpoint=$(grep -E "^[^ ]+ [^ ]+ cgroup ([^ ]+,)?$subsystems(,[^ ]+)? " /proc/self/mounts | cut -d ' ' -f 2)
>  		if [ -z "$mountpoint" ]; then continue; fi
>  
>  		# Return the absolute path to the containers' parent cgroup
> diff --git a/src/lxc/lxc-ps.in b/src/lxc/lxc-ps.in
> index a9923f0..c665bc6 100644
> --- a/src/lxc/lxc-ps.in
> +++ b/src/lxc/lxc-ps.in
> @@ -56,7 +56,7 @@ get_parent_cgroup()
>  		init_cgroup=${fields#*:}
>  
>  		# Get the filesystem mountpoint of the hierarchy
> -		mountpoint=$(grep -E "^cgroup [^ ]+ [^ ]+ ([^ ]+,)?$subsystems(,[^ ]+)? " /proc/self/mounts | cut -d ' ' -f 2)
> +		mountpoint=$(grep -E "^[^ ]+ [^ ]+ cgroup ([^ ]+,)?$subsystems(,[^ ]+)? " /proc/self/mounts | cut -d ' ' -f 2)
>  		if [ -z "$mountpoint" ]; then continue; fi
>  
>  		# Return the absolute path to the containers' parent cgroup
> -- 
> 1.7.9.5
> 
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel




More information about the lxc-devel mailing list