From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) (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 C16F630AD02 for ; Fri, 27 Feb 2026 03:07:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.66 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772161670; cv=none; b=EyX/rvfDNcNySPRJgBJNolokXmBf5IL61MKu8yT5Z8O+/cih+2fzPFM7TuOa19c1OS7Z3azzOpVf9wToqq8wsIxIoGHjwcWHOuaSK8a56WClvego9G/ll5Kh408dgMjx1ExeL1DKO8qFJEqAlrqtWjOJ4fRDXqcIt19itNHoxw8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772161670; c=relaxed/simple; bh=UfIO6iEvg4LSZ2tM/9QdtbtzJvPbNDjmpvuy9g9cfYs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=N/jPW7hcWFuuvhhZsusdTJOQgqDwfqEEDnho+gehYSrOD2Jz6gcmzrITtjTUH8DnG6yegbdYlFdRP/VmSi1xWXjTi4NgGH7E893fRI4Xn/nuvcRHQVwiifQUZoRgMd9JspX/bQq+12OXM8gCHNhbgZUp7Gb9tPkJjE8Ph1VCXdY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dfKNwL1U; arc=none smtp.client-ip=209.85.128.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dfKNwL1U" Received: by mail-wm1-f66.google.com with SMTP id 5b1f17b1804b1-4836f363ad2so18171115e9.1 for ; Thu, 26 Feb 2026 19:07:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772161667; x=1772766467; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cZ15nmfEjKhKNDymehMp1pFL/Nll2gZNYk6Iw5DCQDw=; b=dfKNwL1UdcWV9iDP+xWlWGPnKabIWH7j4q5U7XVz9/tPolfvFTtzTvwtaqW/PwuzHn lX8PK8WzYYHq26muM95vAZoJeXZDXXYZpq4ivKe9wAp4CCOfAdIajqbhmc2N1bXANSJs l7CpOrcjugZibdnJLaKrWcfg0Qh1TeD+Ju7j1oFAaPaz4bEfrpPuTO9r/XaVNZxJUyMN /U/i3gVnUvfwCUef8CcrYgjdcthIAC4aE6wRni+evyRcjekjl94eUrOkcU7nykwzt/zH 14A0HtecDU1ys4d3yyoBWXyZ/jf/7y+qYt9rl6jgN0KCV8yZLmkwdb0oLvBMe75pYwGO c1MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772161667; x=1772766467; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=cZ15nmfEjKhKNDymehMp1pFL/Nll2gZNYk6Iw5DCQDw=; b=fMiQbqcL5ybach+zC9IDmFtI2KK4ovJjFnswjAkQt4kpSSEn+rsZjFqcWW8ahYEewo jnsPyigaY34ICsH5mgMLJZ4quTZ8U+QlFHAPBtX0sIJ73Yhzd1IVmmSyYfli6xv8OG1p RW2cLcN4aM5sc++NI6+tnOik3OVu/hVhgJu8rDNmkXZDOWogPqge0StkEiKOKW/GARVV G3nnBBD31zTNRr9THTFq31RgaL2UedcAevqoBnVCGIPkhqC7qDtmrDImFxuTNTjZnDch XYCD3fmN3sQuBUaykknJT+0X5SI8mObfGcNrnFeFHoi5EkFW4a/hUy8vJwiVcE2nLXkG cMMw== X-Gm-Message-State: AOJu0Yyr/8NL/SJlbWYj6qHUn3Z7j3qCWFeYAesmQMBgg0YrRZZuzZDt 7/HtuCO9xGpseZIfnlDG+a3qIi38bB903r0wNK7NskwTb2aPJP5CSyFx X-Gm-Gg: ATEYQzyiBWC5AsaxictFmxSzLZBSaLHnry5ImVpFdSTY4//5/HfVuZ41RMVUScfM60K yiOBp8jk4AArkcsLNTRZWZDp/vJDkdrGXa538YvaQyd5D72Yy+eCv5R7yEBuCFqhuGqUwvnlpOJ peDjbzAv8swB2z4IqKqnxF4Sxs6rnOeia70xTTxZzl9SCj1AULIWoaDhbOb0zyFs4A7/ITNWETD ooWPKPvop43eYlTdSAlr0BnEa6UgOXfBcDRhrqhV5IEFhWZgZfE1/VzMThOGk/GJ93AEFmX8+rR GIbHt98EgkQT53t5k54lCdkNkgyIhsYccns6Eq76WB578qWyLb4z98xNakJkIFEnaYTKAa/lr1n 77oL7n8P/G/MT7hYNGRMwHxrXeaUv5YGGZ260d5Ta0auKsxR0Ze4yshmhYAdHnX+ey8e8bACV48 7eKgkw2guzTqkkuJeSsGyrLOAkm/4wMeNB39dOKeXVrTHM3wTYqg== X-Received: by 2002:a05:600c:c490:b0:477:63b5:7148 with SMTP id 5b1f17b1804b1-483c9bb65ffmr14190225e9.6.1772161666981; Thu, 26 Feb 2026 19:07:46 -0800 (PST) Received: from lima-ubuntu.hz.ali.com ([47.246.98.215]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-483c3b89c99sm77439065e9.15.2026.02.26.19.07.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 19:07:46 -0800 (PST) From: Qing Wang To: rostedt@goodmis.org Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com, mhiramat@kernel.org, syzbot+3b5dd2030fe08afdf65d@syzkaller.appspotmail.com, syzkaller-bugs@googlegroups.com, wangqing7171@gmail.com Subject: Re: [syzbot] [trace?] WARNING in tracing_buffers_mmap_close (3) Date: Fri, 27 Feb 2026 11:07:37 +0800 Message-Id: <20260227030737.1089041-1-wangqing7171@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260226115229.7111b070@gandalf.local.home> References: <20260226115229.7111b070@gandalf.local.home> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Fri, 27 Feb 2026 at 00:52, Steven Rostedt wrote: > OK, so the issue is that the ring buffer was mapped, then the process that > mapped it forked duplicating the mappings. And then on exit (or unmap), > the first one to unmap the buffer will cause the ring buffer to think it > was fully unmapped causing the next one to unmap to trigger the error. > > > > + */ > > +void ring_buffer_map_user_mapped_inc(struct trace_buffer *buffer, int cpu) > > Let's call this ring_buffer_map_dup() to be consistent with ring_buffer_map(). > > inc would expect a dec, but dup() is more of what it is doing. > > > +{ > > + struct ring_buffer_per_cpu *cpu_buffer; > > + > > + if (!cpumask_test_cpu(cpu, buffer->cpumask)) > > + return; > > I wonder if this fails we should warn. As it should never be called unless > it was successfully mapped. > > > + > > + cpu_buffer = buffer->buffers[cpu]; > > + > > + guard(mutex)(&cpu_buffer->mapping_lock); > > + > > + if (cpu_buffer->user_mapped) > > + __rb_inc_dec_mapped(cpu_buffer, true); > > Probably should also warn if user_mapped is not set. Again, this should not > ever not be mapped if we get here. > > -- Steve Thanks for your suggestion. I sent a patch [0] and looking forward to your review. [0] https://lore.kernel.org/all/20260227025842.1085206-1-wangqing7171@gmail.com/ -- Best regards, Qing