From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 463193DEFE7 for ; Wed, 5 Aug 2026 19:15:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785957326; cv=none; b=a/XPIyBRgQpcmsIJ2zwU18plSHXYnMrB0LufQlx8uUOGjpQhF3T1hBIC1GmZn2edSMZfKcvDVarDQpTHpM+lxWmTQKodn0JuNI9f8LfliYgpR9r7rIeXuu6znSxgRN+MJzl1z+yDIFZh0r61qwDDI1d+SJBwgv/aCE9QuKAQx7w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785957326; c=relaxed/simple; bh=qBOhmuZWnCOO6cEqbrIcWSbSvOFI6cPahRdg3JWl7sI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XIshGityS6lmDm68kYNG2hCQWyglrazB6FDoviqRPWFP6e5cJN9TE/8qAcciRziPmVNL/46r4HpMQi76I7d0hy8dMRsNy7ibhkkgWwbvv94FgI21Vwviw9sCNsXERo6UPLsw6AqYAZFAGRQwk1gfNK5Ldlob0hQimMVA8wxbEuw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=t1P2GeX3; arc=none smtp.client-ip=209.85.128.43 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=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="t1P2GeX3" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-49557167508so12660065e9.1 for ; Wed, 05 Aug 2026 12:15:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1785957320; x=1786562120; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=IgDUz1mwBjwKeSTBZbWMAC274nF2JO5FiqJPNXQBRTE=; b=t1P2GeX3ldsmSWITj4rxwbIt+irJ/ksc8+tAWvgMpRSM1oRkEit+t7MlLBT2+0LkAF A+JTOYcPlj64iM7zI9Y8yvG9FMkxMPV9wH3trRQxo6yq6f6nvCEIJaTzrLiGRRUy2rcx EI11VJ5Jl7w3wViKIeJERSbouokZ27JCd0GwKwcwsoKhLlY912CGsBzf63hyi8FBbwIg QGzkbueBR92ng5D9p9Z6WJ4R+tquhPprdVpYhBWJj5VsTTmS4rK5dwflnP3fVHJlhn+M AFnYwJ4G/rPxwMt9lww+Y90IqVzWD2Kay0oi/uidk2JPsOyuMy23Aua4kRyvFraiR/bd f31g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785957320; x=1786562120; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=IgDUz1mwBjwKeSTBZbWMAC274nF2JO5FiqJPNXQBRTE=; b=ehvJkY2Hb+WOXpa/a2/kMlWRut6beM+WouqxQiV/RHpGuhR7y/p6G/DTfophX/eBas JSH6Wc6uiLDvQF7Ky/5xEi+i+aMsrq5wIqX+hPdXH6NFksmyG4FY3zhd9jDyrHGHOK9S 8slDxuuCV4/wV1S8rSi0G4z6/EVtlEFQT/nZFKH+rCAGnEDNGmpD53ogz1SUa17CXeo1 1bJin6CGkTvUJ+RWrfIOttZpvoe6Gt5Xd1EEOGBLGZCLyQ59+hv7elmA29YvP+ztgb5S Pr4pnYlrDbyqULucmyp1UJyU1t5+71Q+kElSYKafzB1Q/T5S6QxNMR634VQTpIRi7Yjs Y9HQ== X-Forwarded-Encrypted: i=1; AHgh+RpU6XMhPMTbo5/hFjJfrGmCSgDPDtzd84jcy13+253rdmL91yb0LQPOLpBReTbat9raQUjZeRLfBgjauvw=@vger.kernel.org X-Gm-Message-State: AOJu0Yy3mVVHBgKeeOKzyBLxA5K1bzJ4u62kopU0aiIwrmfdgtnHJSn5 pNuQ5VngnwnHq9tldCF4qIMB6FZtEcAkkHdIMkw55l6LIdQrsZvL2+NkoOblwZHf1w== X-Gm-Gg: AR+sD12HyF3/ZeP4DdiEtwS+GuUAo0QQWLVpNch9SeCMnsAtVIL7KP+9uZUDh/K38lr JzBnqr6HXRtFfH+S9TBThdRURUejCGPRllXGB9X6FLmtzWqgLMyAAqKp36err02xg65JI7KsBTV 7supZlaGrBArKcB1TaxXhORmmmyOo2D0sHO8oQLlKju8O5/YskwvzuuiDqPcinbUTJSrnUmHEmN /sQizMo8r58Uw/u0BKTJAErWRtO8CnGbDO4g/6wKjg+hn8nQrJIZBBZ4gehRBQLHuCQquP+eeis seLwpNc7YKutKH3F+VbCV5sO3dAZJd1yu+XFfh0mJuYRuqsryLbK+8YZ/sunpZ1YuiQ/4wOAqaw dt2Y8IAJDc1vHpeHOqVg9dN2V2N29LL9Prcx+8KBvgiXc4/iTORIacG0r/VGRw0JmbjqDlAkWNv LKmZNQ5B7lnmzHAByyUPA+FyZ7RO3PTqrfaOWsoflXuGH3RcDkCZTZQQd5uQkwcF6cr9uHkwNgc 917ZCo2LQeCrpg4Y2bL8LhhwlMrMwcX X-Received: by 2002:a05:600c:138a:b0:498:943:ccc0 with SMTP id 5b1f17b1804b1-4994e714d8fmr115961675e9.6.1785957319636; Wed, 05 Aug 2026 12:15:19 -0700 (PDT) Received: from google.com (135.91.155.104.bc.googleusercontent.com. [104.155.91.135]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4994e99319bsm59638565e9.3.2026.08.05.12.15.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2026 12:15:19 -0700 (PDT) Date: Wed, 5 Aug 2026 20:15:15 +0100 From: Vincent Donnefort To: rostedt@goodmis.org, mhiramat@kernel.org, linux-trace-kernel@vger.kernel.org Cc: mathieu.desnoyers@efficios.com, kernel-team@android.com, linux-kernel@vger.kernel.org, syzbot+e0cc44465d6bae735679@syzkaller.appspotmail.com Subject: Re: [PATCH] ring-buffer: Prevent subbuf order change when resizing is disabled Message-ID: References: <20260805153225.2096152-1-vdonnefort@google.com> 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=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Aug 05, 2026 at 05:36:51PM +0100, Vincent Donnefort wrote: > On Wed, Aug 05, 2026 at 04:32:24PM +0100, Vincent Donnefort wrote: > > Because ring_buffer_subbuf_order_set() frees buffer pages, we can't > > allow it when risizing is disabled. A non-consuming reader is at risk of > > use-after-free (rb_advance_iter()). > > > > Return -EBUSY on resize_disabled, matching ring_buffer_resize() > > behaviour. > > > > Fixes: f9b94daa542a ("ring-buffer: Set new size of the ring buffer sub page") > > Reported-by: syzbot+e0cc44465d6bae735679@syzkaller.appspotmail.com > > Signed-off-by: Vincent Donnefort > > > > diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c > > index 8e2485bb3aa8..414bca2121a7 100644 > > --- a/kernel/trace/ring_buffer.c > > +++ b/kernel/trace/ring_buffer.c > > @@ -7358,7 +7358,7 @@ int ring_buffer_subbuf_order_set(struct trace_buffer *buffer, int order) > > > > cpu_buffer = buffer->buffers[cpu]; > > > > - if (cpu_buffer->mapped) { > > + if (atomic_read(&cpu_buffer->resize_disabled)) { > > Ha, my bad I forgot that mapped is not just "user-space mapped" but also > "range-mapped". > > However probably the best is just to record_disable range mapped buffers in > rb_allocate_cpu_buffer()... especially ring_buffer_resize() doesn't use > cpu_buffer->mapped I am also looking at the other findings from Sashiko. I believe some are legit. > > > err = -EBUSY; > > goto error; > > } > > > > base-commit: 075b74841bd0065a3bda3440873c747938e69b68 > > -- > > 2.55.0.571.g244d577d93-goog > > > > -- > Vincent -- Vincent