binder: fix offset calculation in debug log
authorCarlos Llamas <cmllamas@google.com>
Tue, 25 Mar 2025 18:49:00 +0000 (18:49 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 15 Apr 2025 13:11:12 +0000 (15:11 +0200)
The vma start address should be substracted from the buffer's user data
address and not the other way around.

Cc: Tiffany Y. Yang <ynaffit@google.com>
Cc: stable <stable@kernel.org>
Fixes: 162c79731448 ("binder: avoid user addresses in debug logs")
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Reviewed-by: Tiffany Y. Yang <ynaffit@google.com>
Link: https://lore.kernel.org/r/20250325184902.587138-1-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/android/binder.c

index 76052006bd8714b03aa0eeccb01f31cc155c5180..5fc2c8ee61b19b6f9ec8b76c4c697ea75219d94f 100644 (file)
@@ -6373,7 +6373,7 @@ static void print_binder_transaction_ilocked(struct seq_file *m,
                seq_printf(m, " node %d", buffer->target_node->debug_id);
        seq_printf(m, " size %zd:%zd offset %lx\n",
                   buffer->data_size, buffer->offsets_size,
-                  proc->alloc.vm_start - buffer->user_data);
+                  buffer->user_data - proc->alloc.vm_start);
 }
 
 static void print_binder_work_ilocked(struct seq_file *m,