From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 E88532FE0F for ; Mon, 22 Jun 2026 06:55:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782111359; cv=none; b=IBOt7wNq3xiJ2iNvocTpToCe16q6YAEyXMw04aarlL9cXAAqAEEBNTekhALLXFnh0go+0w6FBySVrC4K16dvEKFqGYrmmUWgxWY6nEbg5X8d1ruMIbz3vPD27UnU4giesi1zCDUzosCbVBLlQEPJ/a66Fld3iYmPz/MSES6qocI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782111359; c=relaxed/simple; bh=LobeI6BatW/+X4E0fI8DO3vMW5iN/E/V97YIWdhrcDo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Sislyva+c1GkU9WNtucAlRLDw1BKIj38eLMQAL3V/lUMwfU0GWW7KvSYZ0yuagh9oVjHcz3t6qYfWSnEwY8j1nLMA483SXFtRqslSHnUQeZzhmQ5UNhQ/TGWyn+JpXFvwtqWeakTrw2NTjBO7fyOfzCYY+4RPi7gdtuGrnt23RY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=Nm0B2Ypz; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="Nm0B2Ypz" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-491609cdd8fso23779795e9.2 for ; Sun, 21 Jun 2026 23:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1782111355; x=1782716155; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=NCxlVcySBiicleY7qeBVFRSV3oYj70sPP3NaBi6h7e4=; b=Nm0B2Ypz81abGlsvNG2lcGu/zGwU32M0N0wHb+9yD0EcOtmilFrEaBPJg97+6dgYL0 dfCHZs3De6KoFbaPEI8MI6EPlb/IkefgmBJoVUBuaDu5VGcPBRypngohK3MJzwf0dSwb pXF1W3w4mZgPH9rK72KB4+UA61HiRdhEuUlghg47wjMiqCtiuR7qqhB3N8+IZ/FCqOcA ZfImPLZssmMbzqeDjpd8/kPQh3q8xaxm++Xn4jDob0AXe6TqfWNXSFzJAVXuVNwRq5UC D05YEMigCNxLEG/oLuIrFroi/76Ppt3mQ3VYc/pbt71TJleGJ3G1l9wS+zYlaID8Ixvn 9eNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782111355; x=1782716155; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NCxlVcySBiicleY7qeBVFRSV3oYj70sPP3NaBi6h7e4=; b=Pyx86b7x7lCRgaOtvAJjO0QSD3Ax3HB8hjrj1bNLZr0uDGbCymfRDQ2YzR/NywKKWC dFNlrU85LjPR00y8zclgY/0nvCpQ4xhpzJeL4V1o/zyS8nN3CVkGDhWlFJXNk3PyIXps 7AmJ8SiiD7ECro/WPL4Waa2dME2T466dAQAT3xqrV7130AJz7wkLUgVL2dTOqGUPRYCv 3Q+SJ27hZ9fxgTzioYzN0FTgO21hM+bFTHHx6sOGtglz3eWpwMk69DOnfAoBSba1ZDSz PYB/7lhG/BBMHQ8hv2Rp/cZuRcC/+qhWbLWtUCXN0SgBWJbIoiL+7dfKZm/VvdODjj13 gCTg== X-Forwarded-Encrypted: i=1; AFNElJ/NNN+e80ZG3eN7rchfe3IZRQH/XvczCJ3DN0L6xtWJBJQCTJQ44lX6+VHGmyvn1gOc3Rr3tFBkS6Stzz4=@vger.kernel.org X-Gm-Message-State: AOJu0YzfcR85XU4D6fD53BYAbLYJvUJPCtrpa7PnMdVFsuGtUiY9d1TN 58wpw0NNLosQJ4chBfIYR93SKcllMN3imSE4toA8AIttKrFMoGnarF5ynydBMUd3lpI= X-Gm-Gg: AfdE7ckMP0fKanhSIGZgpxTHkEqBOnNY1RbQM//OvEXDcxJCKY0ltwzanZ2zITp02H2 vtFf/p2HD8WApIJuuaAo6jilWfvxiLdpYQApsxJz87Ah2tfJGHDYpBic0mWpfEqzXK7SIN0khdP jp6d+Ku5J039cxkFXb7ZUdzrtyvIagtzonox3N8twbDHj30LHTIv+1650fPPMc5gdkbnRde5CEH ZD3B/vkR6UaN1ovPcoFWohbfURMRkvKidsVsssXFGEC0BOZdEMwstKfFU+XqDVf5ZLUvfmqp5UI 0p0C2lxSHY+YeX6S+tPuR+eW0+p7R81NkPgsR3NxATduQFJwngEva3dPJPhT9Sm0l36nfcqO2hP qUD/XVi9JOCHnweGbNPXs/Ild/VArpmnDzfkVk7dobklb0o0z+uvWdzOy4+yoXi1gzjd55eYXkI lgIdt31VUIneDud9YeU8FeEPQWZxqgt+/s2hxU2VXjO/lWuwtwOq5z2asfa8naA/0/SazRQvVZG RB+mdxLm62VItl3H5k5AeIt92hQ8humXYR8RjahL0whWN1sBnXw+5tMTG6FwlT0T8BgZQ== X-Received: by 2002:a05:600c:e555:10b0:490:e5c1:b8c6 with SMTP id 5b1f17b1804b1-49240dfd165mr151460045e9.8.1782111355381; Sun, 21 Jun 2026 23:55:55 -0700 (PDT) Received: from ?IPV6:2a00:1028:838d:271e:8e3b:4aff:fe4c:a100? (dynamic-2a00-1028-838d-271e-8e3b-4aff-fe4c-a100.ipv6.o2.cz. [2a00:1028:838d:271e:8e3b:4aff:fe4c:a100]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4923fd30078sm269910715e9.7.2026.06.21.23.55.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 21 Jun 2026 23:55:54 -0700 (PDT) Message-ID: <31db63df-0a81-45db-97de-67bbe1a1be2a@suse.com> Date: Mon, 22 Jun 2026 08:55:54 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] module: annotate failed-module stats list traversal To: Runyu Xiao Cc: mcgrof@kernel.org, da.gomez@kernel.org, samitolvanen@google.com, linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260621091905.3555074-1-runyu.xiao@seu.edu.cn> Content-Language: en-US From: Petr Pavlu In-Reply-To: <20260621091905.3555074-1-runyu.xiao@seu.edu.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 6/21/26 11:19 AM, Runyu Xiao wrote: > read_file_mod_stats() dumps dup_failed_modules while holding > module_mutex, but the loop uses list_for_each_entry_rcu() without > telling lockdep about that non-RCU protection. > > The same list is already traversed in try_add_failed_module() with > lockdep_is_held(&module_mutex) as the RCU-list lockdep condition. Use > the same condition for the debugfs stats dump so CONFIG_PROVE_RCU_LIST > can see the documented protection. > > This was found by our static analysis tool and then manually reviewed > against the current tree. The dynamic triage evidence is a > target-matched CONFIG_PROVE_RCU_LIST warning; the change is limited > to documenting the existing protection contract. > > This is a lockdep annotation cleanup. It does not change the list > lifetime or serialization rules. > > Signed-off-by: Runyu Xiao > --- > kernel/module/stats.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/kernel/module/stats.c b/kernel/module/stats.c > index 3ba0e98b3c91..79c227a72a21 100644 > --- a/kernel/module/stats.c > +++ b/kernel/module/stats.c > @@ -382,7 +382,8 @@ static ssize_t read_file_mod_stats(struct file *file, char __user *user_buf, > mutex_lock(&module_mutex); > > > - list_for_each_entry_rcu(mod_fail, &dup_failed_modules, list) { > + list_for_each_entry_rcu(mod_fail, &dup_failed_modules, list, > + lockdep_is_held(&module_mutex)) { > if (WARN_ON_ONCE(++count_failed >= MAX_FAILED_MOD_PRINT)) > goto out_unlock; > len += scnprintf(buf + len, size - len, "%25s\t%15lu\t%25s\n", mod_fail->name, The same fix was posted previously in: https://lore.kernel.org/linux-modules/e4za26n3jj3366oqt47hdwfze2rvsyjcujjhjj4jvbtihkleg6@kxasstqoia22/ -- Cheers, Petr