From nobody Sun Feb 8 04:23:35 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4516334EF1C for ; Wed, 7 Jan 2026 14:30:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767796206; cv=none; b=qKZ2qJz3Sy5RJsLlZs3xUNoV58K9c0LzfNSeYfhbjBZ40SFh1dm9x90RKOqQgBQWstmt45cWxG7qab3Qt00YH5e18mHJlIG1vJl5BHzvd8czl/BhdmATu8NhIzwTU0EN8STJ2lniQ1ay/soLQA0HYHKyCvqvmEodhev1TRD5msQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767796206; c=relaxed/simple; bh=MFV9cAaY0ic2VG/QVUtnumcnahIKzF1d0U6h0mdjVIY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=ok+f8g8xVQ3qivjq7xCKzFiKm/39079qHoH2lcC8ebM53kSLTjJGqr9MiDH+UqE4dikoIijzq7AU5+HJicnwfKo6jP8RLExPKiZLTIz5yDilIvPtPf9G+ZX3IbDXTKS142Ol688p1OtGBcvl6o9h6uUWKXcnrwuNRt8uPCXijlw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=D/PpGbSa; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=jf189V9g; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="D/PpGbSa"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="jf189V9g" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1767796194; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OHsxxo6sM1fwjnwTGU0us8xTyooPKSr00GyI/MPPTro=; b=D/PpGbSappdZOOnBruRtjoWb0S9951JZKUBFGDjZ7yuzLb2LwjqpwCcELoYv3HV1DSy2Qf 2fr064ALSa+7LUMAKbt+0xn0NgvDypt+QmSWjPhz+46CbPONwkp3i8tzzgemMT/49/TsTE 0M2Inr3OFI25feAY4WG1un9uh1YY9NxA/rMcJTcvY3eT8hkzyXxo50Oj1s+ycaPgrVcfUe FIgfoOHHlVQNK8JYyY8g0lsmwuhiYj2ZKkqKaJUloEsfaF8eDkXA3LEBcHEBwd4npJtn11 ptNm4YZksUsY8g6HwOa9mdMDULlDlxILHyXXKUPm+unZJcwDwmAqobRUEefU8g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1767796194; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OHsxxo6sM1fwjnwTGU0us8xTyooPKSr00GyI/MPPTro=; b=jf189V9gYBuA6Py3cIy15ErzJyyFjmnnvt9LBlRBvOXNu+IC+xQBS60GWWzNhool8PDGbT xl0P/BLi7TdnxoDQ== Date: Wed, 07 Jan 2026 15:29:50 +0100 Subject: [PATCH] binder: don't use %pK through printk Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260107-restricted-pointers-binder-v1-1-181018bf3812@linutronix.de> X-B4-Tracking: v=1; b=H4sIAN1tXmkC/x3MQQqDMBAF0KvIrDsQU0hjr1K6UOdbZxNlJhRBv HtDl2/zTnKYwunZnWT4qutWGvpbR/M6lg9YpZliiCn04cEGr6ZzhfC+aakw50mLwDhD7jGnYUm SqQW7YdHjn7/e1/UDk09E5WwAAAA= X-Change-ID: 20260107-restricted-pointers-binder-8ed32869f6d8 To: Greg Kroah-Hartman , =?utf-8?q?Arve_Hj=C3=B8nnev=C3=A5g?= , Todd Kjos , Christian Brauner , Carlos Llamas , Alice Ryhl Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1767796192; l=2834; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=MFV9cAaY0ic2VG/QVUtnumcnahIKzF1d0U6h0mdjVIY=; b=war4k8VqUOKc9RgymMDlq2ytHrncN2NO1hUC73n1E7RZLy5dOi6gGwklzEKFpRiKH5tGbE0OI yTtdMupKf5YDeG5fWzXPaXC+YHCzVO8D0J5xJCl98cbMyyQCouKydLL X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= In the past %pK was preferable to %p as it would not leak raw pointer values into the kernel log. Since commit ad67b74d2469 ("printk: hash addresses printed with %p") the regular %p has been improved to avoid this issue. Furthermore, restricted pointers ("%pK") were never meant to be used through printk(). They can still unintentionally leak raw pointers or acquire sleeping locks in atomic contexts. Switch to the regular pointer formatting which is safer and easier to reason about. There are still a few users of %pK left, but these use it through seq_file, for which its usage is safe. Signed-off-by: Thomas Wei=C3=9Fschuh Acked-by: Carlos Llamas Reviewed-by: Alice Ryhl --- drivers/android/binder.c | 2 +- drivers/android/binder_alloc.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 535fc881c8da..adde1e40cccd 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -4510,7 +4510,7 @@ static int binder_thread_write(struct binder_proc *pr= oc, } } binder_debug(BINDER_DEBUG_DEAD_BINDER, - "%d:%d BC_DEAD_BINDER_DONE %016llx found %pK\n", + "%d:%d BC_DEAD_BINDER_DONE %016llx found %p\n", proc->pid, thread->pid, (u64)cookie, death); if (death =3D=3D NULL) { diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c index 979c96b74cad..d5ed64543bbf 100644 --- a/drivers/android/binder_alloc.c +++ b/drivers/android/binder_alloc.c @@ -81,7 +81,7 @@ static void binder_insert_free_buffer(struct binder_alloc= *alloc, new_buffer_size =3D binder_alloc_buffer_size(alloc, new_buffer); =20 binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC, - "%d: add free buffer, size %zd, at %pK\n", + "%d: add free buffer, size %zd, at %p\n", alloc->pid, new_buffer_size, new_buffer); =20 while (*p) { @@ -572,7 +572,7 @@ static struct binder_buffer *binder_alloc_new_buf_locke= d( } =20 binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC, - "%d: binder_alloc_buf size %zd got buffer %pK size %zd\n", + "%d: binder_alloc_buf size %zd got buffer %p size %zd\n", alloc->pid, size, buffer, buffer_size); =20 /* @@ -748,7 +748,7 @@ static void binder_free_buf_locked(struct binder_alloc = *alloc, ALIGN(buffer->extra_buffers_size, sizeof(void *)); =20 binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC, - "%d: binder_free_buf %pK size %zd buffer_size %zd\n", + "%d: binder_free_buf %p size %zd buffer_size %zd\n", alloc->pid, buffer, size, buffer_size); =20 BUG_ON(buffer->free); --- base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8 change-id: 20260107-restricted-pointers-binder-8ed32869f6d8 Best regards, --=20 Thomas Wei=C3=9Fschuh