From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A54A314D3A for ; Thu, 18 Sep 2025 14:06:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758204387; cv=none; b=cliIq7GrTakx1DOHRIKnR0hI8A25pumfvOejIGpCKc8sKj5bwDz6Q9k00ogL31DYNZUqye3K3s7lKqWULLD49JGSCT0i/i+1NeJW9rNQLOEP4ZR9GRwvjh0jprWcGvqVnG9zPADlMDm1BnSFK8nm3uzBPoUx1nJkWbdf4H9bFXM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758204387; c=relaxed/simple; bh=DOVYYkUooifd4WMC9FlK4YiWuUY4p8vtxZ7kRIKV6k8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=BUgCtADXSK5bBwFB0fsYsr9EQo965w+RSeIpMyxDCfDh9oZYCVY2HWhc9CIEZN7NMseKkEBSzRMeoqljB4If+K2cDJF9Vv2+CfAY0X/JLoIIkff+lh9YrNw/9VrjOldOZ/KvS6xcpegKcRxKn4EQAK05e2YK7iiiatxRut8Hw2Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--elver.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=cYMeD3EB; arc=none smtp.client-ip=209.85.221.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--elver.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="cYMeD3EB" Received: by mail-wr1-f73.google.com with SMTP id ffacd0b85a97d-3eb72c3e669so654445f8f.3 for ; Thu, 18 Sep 2025 07:06:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1758204384; x=1758809184; darn=lists.linux.dev; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Oanwb4AvefPzztLhk08gBpEPn5bxbhzZnwvICntunHw=; b=cYMeD3EBxn1pS5FEkkR4+sO0YpON8eFX4zkHC7PKiyyj2cZk+Ub3dS1fl7eX5ZNrR5 uG55UWTWuix8ZEAtKqpyX+WvnjRdvb2IxmFfU8kchU26JIOW5j8BEbcBUECZma9wVvUJ VO7jR32ydM+sqAwB8tueilIpUxTdLXBhPgMKNU553djqSFmJOzs9kNdqViSrcuu12U/B gi8FcsWNmNOGMqLfeOtJAzISfXUesqJYOKH4gaD7LX7quYk+bsMHvbX3CPLK9q6YVekQ 3OldaydFGEv2KD7FF3NLPhxXDBaag/iKMbPP7TsaT7ZAOMOseqsZwRub+N8NFyWySbnc drLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758204384; x=1758809184; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Oanwb4AvefPzztLhk08gBpEPn5bxbhzZnwvICntunHw=; b=ZSVXJAS5gzGg9ZNlFgi0RO1xGUXbFVBSutsYBEPayGfUBOEFfZopRvE9dpePCaDk+o ARwbM2T+EuMlw3846KvQvFEWo2MWly6WhWpQUVOv/jV09Ve6BBHewcSpaqe2EgFdtEY4 PcyS67LKOdR3izHx8I1V1i75gglGtKFA5+nJrW04xyKGRWcLDgEn6A/YIeef+tJPbpre 2sX2cBvdB6fXrbahfxdYEURdXYzJmFPl6kYTrxZCOww1tW0K4cAjqCDKjxwCO0+xOR5f NvWKIaMg5fHT4UytI1kIU+29OsZiNuAv5c9nqwph0lMPJYz1bsXYoTCCjUJntHEs8sZ2 v4BA== X-Forwarded-Encrypted: i=1; AJvYcCU+HtDnoXYN9VL+a972SnAgYPJyQXzX8H4oPr+zE0JuQfvgk8RhrlV+0WQctUQ9uf+Hi23M@lists.linux.dev X-Gm-Message-State: AOJu0Yy6cgETzIJRYzs4+qdiko1Nt8+wriFzpv7JoaojE8R/pZfd7pGZ k3nH7n5Yfvs9xEgmIVPyJ0xv9rGAFB49Kg01zpGb3OJaDD5PVpPP78YxRb7EiQycnsd/vWn9SPp NvQ== X-Google-Smtp-Source: AGHT+IFkViOrkTd7Qf740HpWB1Y+zHZAT/ov2XdutlPI/XGCPUkCb5+91SEAW6LMPzEdlyQcI8JNeQaNOQ== X-Received: from wrbcc13.prod.google.com ([2002:a5d:5c0d:0:b0:3ec:df7a:666]) (user=elver job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:438a:b0:3ec:db18:aa37 with SMTP id ffacd0b85a97d-3ecdfa4b7camr5826204f8f.60.1758204383884; Thu, 18 Sep 2025 07:06:23 -0700 (PDT) Date: Thu, 18 Sep 2025 15:59:32 +0200 In-Reply-To: <20250918140451.1289454-1-elver@google.com> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250918140451.1289454-1-elver@google.com> X-Mailer: git-send-email 2.51.0.384.g4c02a37b29-goog Message-ID: <20250918140451.1289454-22-elver@google.com> Subject: [PATCH v3 21/35] debugfs: Make debugfs_cancellation a capability struct From: Marco Elver To: elver@google.com, Peter Zijlstra , Boqun Feng , Ingo Molnar , Will Deacon Cc: "David S. Miller" , Luc Van Oostenryck , "Paul E. McKenney" , Alexander Potapenko , Arnd Bergmann , Bart Van Assche , Bill Wendling , Christoph Hellwig , Dmitry Vyukov , Eric Dumazet , Frederic Weisbecker , Greg Kroah-Hartman , Herbert Xu , Ian Rogers , Jann Horn , Joel Fernandes , Jonathan Corbet , Josh Triplett , Justin Stitt , Kees Cook , Kentaro Takeda , Lukas Bulwahn , Mark Rutland , Mathieu Desnoyers , Miguel Ojeda , Nathan Chancellor , Neeraj Upadhyay , Nick Desaulniers , Steven Rostedt , Tetsuo Handa , Thomas Gleixner , Thomas Graf , Uladzislau Rezki , Waiman Long , kasan-dev@googlegroups.com, linux-crypto@vger.kernel.org, linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, linux-sparse@vger.kernel.org, llvm@lists.linux.dev, rcu@vger.kernel.org Content-Type: text/plain; charset="UTF-8" When compiling include/linux/debugfs.h with CAPABILITY_ANALYSIS enabled, we can see this error: ./include/linux/debugfs.h:239:17: error: use of undeclared identifier 'cancellation' 239 | void __acquires(cancellation) Move the __acquires(..) attribute after the declaration, so that the compiler can see the cancellation function argument, as well as making struct debugfs_cancellation a real capability to benefit from Clang's capability analysis. Signed-off-by: Marco Elver --- include/linux/debugfs.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index 7cecda29447e..4ee838cf4678 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h @@ -239,18 +239,16 @@ ssize_t debugfs_read_file_str(struct file *file, char __user *user_buf, * @cancel: callback to call * @cancel_data: extra data for the callback to call */ -struct debugfs_cancellation { +struct_with_capability(debugfs_cancellation) { struct list_head list; void (*cancel)(struct dentry *, void *); void *cancel_data; }; -void __acquires(cancellation) -debugfs_enter_cancellation(struct file *file, - struct debugfs_cancellation *cancellation); -void __releases(cancellation) -debugfs_leave_cancellation(struct file *file, - struct debugfs_cancellation *cancellation); +void debugfs_enter_cancellation(struct file *file, + struct debugfs_cancellation *cancellation) __acquires(cancellation); +void debugfs_leave_cancellation(struct file *file, + struct debugfs_cancellation *cancellation) __releases(cancellation); #else -- 2.51.0.384.g4c02a37b29-goog