On 11/22/26 11:25 PM, David Hildenbrand (Arm) wrote:
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.
minor nit:
subject can be
"powerpc/spufs: Fix local store offset calculation in
spufs_mem_mmap_access()"
rest looks fine to me.
Acked-by: Madhavan Srinivasan <[email protected]>
Fixes: a352894d0705 ("spufs: use new vm_ops->access to allow local state access from
gdb")
Cc: [email protected]
Acked-by: Lorenzo Stoakes (ARM) <[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))