From mboxrd@z Thu Jan 1 00:00:00 1970 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 D30E153E0B for ; Thu, 19 Mar 2026 08:17:18 +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=1773908240; cv=none; b=HdJy3UD7RqNh6rfKFb05YHUOmSvlLktnvg5DQZcEktMnw6WsLGGBLNs79TgHkTVSYP8RRGGBn8eVYHji+LeH5rJ1kPxcBEJhENwJFtKUKSyGdkBkXg06DY6k6kg8XuuxyH5cFGXBt1wKniwsL3/VYYPG8t0OZRWO93q5PQokeFs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773908240; c=relaxed/simple; bh=wICTZLrFWo8YL6mMKIU/9nRwIMDuA2WuGXGuWGrNlu4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GqQIkb756FRV85Gr3eg1jb21odBVn7UuBtfJOGnfKn2j3ZLv7nuosxASPcU1/VDtasuQK8f38Mz8CwLIHKgmF6aMpHDDbKlRZOnVuhno0dA3uosZW0d6NcQAGOxcXNCX/vyB/i48OkWs7Nuno6/sFzPWixRpiOTZ3nMnB7txSrY= 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=WTfOftsI; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=X2yIXoQS; 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="WTfOftsI"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="X2yIXoQS" Date: Thu, 19 Mar 2026 09:17:15 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1773908237; 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: in-reply-to:in-reply-to:references:references; bh=wICTZLrFWo8YL6mMKIU/9nRwIMDuA2WuGXGuWGrNlu4=; b=WTfOftsIOP0EBHcy0AznXHTI/JIHxWgfUbAtjjeFoCZSODsIXa7t9s7q4EuC9B+OTazoGx k2xJIn31fhoPFamTWnxtI4lvZpBqKptk8VynI/rEjQcfjgQ+ZXWEa8a3rxjMsArsPVKBpd yu1MtDmnfjaHUiA8/AaCjKAyBOv9na56xJEj9nGjtj/9i61tJDLpFlS3qIlrS7GT2mKuPB qeya2R3IgfscAfPh/Li7nUrNHMvVKrWXk5fZH7uPAGUsOOmXvuBsphRuG+hm4eDKsJ/FLI 6zUHCXEt9HZ7vYwUEkXYQTm8YeMBVJlgV/5NyhIjxHXxO9f3IqWt+UuBd+vfIA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1773908237; 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: in-reply-to:in-reply-to:references:references; bh=wICTZLrFWo8YL6mMKIU/9nRwIMDuA2WuGXGuWGrNlu4=; b=X2yIXoQSZbJ8q7+qE1Akstf2UG8jo+j2lszxkCzgoS2cDQUboHtSmHZHzA/D9NBkKBPvXt /0VqMjnMcUd/xNBg== From: Sebastian Andrzej Siewior To: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= Cc: Petr Mladek , Kees Cook , Andrew Morton , Steven Rostedt , Andy Shevchenko , Rasmus Villemoes , Sergey Senozhatsky , linux-kernel@vger.kernel.org, John Ogness Subject: Re: [PATCH] lib/vsprintf: Validate sleepable context during restrictred pointer formatting Message-ID: <20260319081715.omCQUybq@linutronix.de> References: <20260317-restricted-pointers-final-v1-1-b4dca0ed6483@linutronix.de> <20260318094555-37b1a6ce-4977-4e54-95f2-2a30bec904e1@linutronix.de> <20260318135936.mGaAlujF@linutronix.de> <20260318151711-95ae5393-908c-40f0-b5fd-e4ddd9de8801@linutronix.de> <20260318145718.vlw3iaYL@linutronix.de> <20260318160034-e7a37291-2536-4864-ae87-357ee134109f@linutronix.de> 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-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20260318160034-e7a37291-2536-4864-ae87-357ee134109f@linutronix.de> On 2026-03-18 16:10:24 [+0100], Thomas Wei=C3=9Fschuh wrote: > That was my plan. My current idea uses a raw 'struct lockdep_map' > without a dummy spinlock, as the spinlock would never be used anyways. > But if the dummy spinlock would be better for some reason, let's use that. just lockdep is fine. It is just annotation & verification at runtime, no actual locking is needed/ intended. > > > > than %pK. According to commit 312b4e226951f ("vsprintf: check real > > > > user/group id for %pK") it is temporary as of 2013. There should be= a > > > > check at open time instead. > > >=20 > > > Doing the check at open time requires some place to store the result > > > of it. The users of %pK I looked at all reused their core datastructu= res > > > as state in seq_file, so finding space for the result from open time > > > would require some non-trivial changes to them. > >=20 > > You could go for the easy solution and return early with -EACCES or so. > > That was the intention according to my understanding. >=20 > My understanding is different. The file should be readable for everybody. > But the actual contents depend on the user reading it. The clean solution > would be to check the user during open() and decide once if the pointers > should be printed raw/hashed/zeroed out. >=20 > The fact that even 13 years later there are no helpers whatsoever for > users to do the checks at open() time and later do the formatting, > probably didn't help the adoption of that scheme. I don't recall needing ever pointer for other reasons than debugging. > Thomas Sebastian