spufs_mem_mmap_access() calculates the local store offset relative to the
start of the VMA and ignores vm_pgoff. After VMA splits, debugger reads and
writes access the wrong part of the local store. Mappings created with a
nonzero file offset have the same problem.
Properly take the vm_pgoff into account, just like spufs_mem_mmap_fault()
already does.
Fixes: a352894d0705 ("spufs: use new vm_ops->access to allow local state access
from gdb")
Cc: [email protected]
Signed-off-by: David Hildenbrand (Arm) <[email protected]>
---
arch/powerpc/platforms/cell/spufs/file.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/cell/spufs/file.c
b/arch/powerpc/platforms/cell/spufs/file.c
index 98c47bafaf678..0a46d6f7178ab 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -248,7 +248,8 @@ static int spufs_mem_mmap_access(struct vm_area_struct *vma,
void *buf, int len, int write)
{
struct spu_context *ctx = vma->vm_file->private_data;
- unsigned long offset = address - vma->vm_start;
+ unsigned long offset = address - vma->vm_start +
+ (vma->vm_pgoff << PAGE_SHIFT);
char *local_store;
if (write && !(vma->vm_flags & VM_WRITE))
--
2.43.0