[CRIU] [PATCH 2/5] net: Don't zap error code in check mode

Pavel Emelyanov xemul at parallels.com
Tue Mar 26 11:21:12 EDT 2013


On 03/26/2013 03:23 PM, Cyrill Gorcunov wrote:
> On Tue, Mar 26, 2013 at 03:12:23PM +0400, Cyrill Gorcunov wrote:
>> On Tue, Mar 26, 2013 at 02:50:22PM +0400, Andrew Vagin wrote:
>>>>
>>>> current_ns_mask = 0 for check mode.
>>>
>>> I think we can set current_ns_mask = CLONE_NEWNET for check mode.
>>
>> Indeed. I'll update the patch.
> 
> Something like below I think.
> ---
> From: Cyrill Gorcunov <gorcunov at openvz.org>
> Subject: [PATCH 2/5] net: Don't zap error code in check mode
> 
> In check mode we need error code returned if
> one of diag kernel module is not loaded or
> not built at all. Thus set up CLONE_NEWNET
> so check would pass into error reporting
> path.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  cr-check.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/cr-check.c b/cr-check.c
> index dabadf5..69472b0 100644
> --- a/cr-check.c
> +++ b/cr-check.c
> @@ -25,6 +25,7 @@
>  #include "mount.h"
>  #include "tty.h"
>  #include "ptrace.h"
> +#include "namespaces.h"
>  
>  static int check_tty(void)
>  {
> @@ -88,6 +89,11 @@ static int check_sock_diag(void)
>  {
>  	int ret;
>  
> +	/*
> +	 * For simplicity use netns cloning in underlied calls.
> +	 */

This is obfuscation. Better use pid == 0 to identify, that we're dumping
socket for current task and thus want clear error report.

> +	current_ns_mask |= CLONE_NEWNET;
> +
>  	ret = collect_sockets(getpid());
>  	if (!ret)
>  		return 0;
> 




More information about the CRIU mailing list