compel: use a correct name format for vma files in /proc/pid/map_files/

Submitted by Andrei Vagin on Nov. 28, 2017, 12:38 a.m.

Details

Message ID 20171128003831.4364-1-avagin@openvz.org
State Accepted
Series "compel: use a correct name format for vma files in /proc/pid/map_files/"
Headers show

Commit Message

Andrei Vagin Nov. 28, 2017, 12:38 a.m.
From: Andrei Vagin <avagin@virtuozzo.com>

Currently we use the "map_files/%p-%p" format, but actually it should
be "map_files/%lx-%lx".

The kernel could handle both formats, but recently Alexey Dobriyan fixed
the kernel and it accept only the second format.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
---
 compel/src/lib/infect.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c
index 9ebc5b5ac..0527481ed 100644
--- a/compel/src/lib/infect.c
+++ b/compel/src/lib/infect.c
@@ -695,8 +695,8 @@  static int parasite_mmap_exchange(struct parasite_ctl *ctl, unsigned long size)
 
 	ctl->map_length = round_up(size, page_size());
 
-	fd = ctl->ictx.open_proc(ctl->rpid, O_RDWR, "map_files/%p-%p",
-		 ctl->remote_map, ctl->remote_map + ctl->map_length);
+	fd = ctl->ictx.open_proc(ctl->rpid, O_RDWR, "map_files/%lx-%lx",
+		 (long)ctl->remote_map, (long)ctl->remote_map + ctl->map_length);
 	if (fd < 0)
 		return -1;
 

Comments

Cyrill Gorcunov Nov. 28, 2017, 7:22 a.m.
On Tue, Nov 28, 2017 at 03:38:31AM +0300, Andrei Vagin wrote:
> From: Andrei Vagin <avagin@virtuozzo.com>
> 
> Currently we use the "map_files/%p-%p" format, but actually it should
> be "map_files/%lx-%lx".
> 
> The kernel could handle both formats, but recently Alexey Dobriyan fixed
> the kernel and it accept only the second format.
> 
> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>

Actually it's userspace API breakage :/ But since not that
many people are using this api we can live with that.

Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Andrey Vagin Nov. 29, 2017, 10:02 p.m.
Applied

On Tue, Nov 28, 2017 at 03:38:31AM +0300, Andrei Vagin wrote:
> From: Andrei Vagin <avagin@virtuozzo.com>
> 
> Currently we use the "map_files/%p-%p" format, but actually it should
> be "map_files/%lx-%lx".
> 
> The kernel could handle both formats, but recently Alexey Dobriyan fixed
> the kernel and it accept only the second format.
> 
> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
> ---
>  compel/src/lib/infect.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c
> index 9ebc5b5ac..0527481ed 100644
> --- a/compel/src/lib/infect.c
> +++ b/compel/src/lib/infect.c
> @@ -695,8 +695,8 @@ static int parasite_mmap_exchange(struct parasite_ctl *ctl, unsigned long size)
>  
>  	ctl->map_length = round_up(size, page_size());
>  
> -	fd = ctl->ictx.open_proc(ctl->rpid, O_RDWR, "map_files/%p-%p",
> -		 ctl->remote_map, ctl->remote_map + ctl->map_length);
> +	fd = ctl->ictx.open_proc(ctl->rpid, O_RDWR, "map_files/%lx-%lx",
> +		 (long)ctl->remote_map, (long)ctl->remote_map + ctl->map_length);
>  	if (fd < 0)
>  		return -1;
>  
> -- 
> 2.13.6
>