lazy-pages: fix stack detection

Submitted by Mike Rapoport on May 14, 2019, 8:34 a.m.

Details

Message ID 1557822862-19912-1-git-send-email-rppt@linux.ibm.com
State Accepted
Series "lazy-pages: fix stack detection"
Commit 4699aa17e22d23a1839f59e27d4e8ad0dd0d25ab
Headers show

Commit Message

Mike Rapoport May 14, 2019, 8:34 a.m.
The commit 5432a964dcc7 ("lazy-pages: don't mark current stack page as
lazy") tried to make the pages surrounding the stack pointers non-lazy.
Unfortunately, it used a wrong mask for the detection.

Fix it.

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 criu/mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/mem.c b/criu/mem.c
index 8015a7e..df87ed5 100644
--- a/criu/mem.c
+++ b/criu/mem.c
@@ -149,7 +149,7 @@  static bool is_stack(struct pstree_item *item, unsigned long vaddr)
 	for (i = 0; i < item->nr_threads; i++) {
 		uint64_t sp = dmpi(item)->thread_sp[i];
 
-		if (!((sp ^ vaddr) & PAGE_MASK))
+		if (!((sp ^ vaddr) & ~PAGE_MASK))
 			return true;
 	}
 

Comments

Andrei Vagin May 21, 2019, 7:17 a.m.
Applied, thanks!

On Tue, May 14, 2019 at 11:34:22AM +0300, Mike Rapoport wrote:
> The commit 5432a964dcc7 ("lazy-pages: don't mark current stack page as
> lazy") tried to make the pages surrounding the stack pointers non-lazy.
> Unfortunately, it used a wrong mask for the detection.
> 
> Fix it.
> 
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
>  criu/mem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/criu/mem.c b/criu/mem.c
> index 8015a7e..df87ed5 100644
> --- a/criu/mem.c
> +++ b/criu/mem.c
> @@ -149,7 +149,7 @@ static bool is_stack(struct pstree_item *item, unsigned long vaddr)
>  	for (i = 0; i < item->nr_threads; i++) {
>  		uint64_t sp = dmpi(item)->thread_sp[i];
>  
> -		if (!((sp ^ vaddr) & PAGE_MASK))
> +		if (!((sp ^ vaddr) & ~PAGE_MASK))
>  			return true;
>  	}
>  
> -- 
> 2.7.4
> 
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu