From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796052986; b=hnMBTo51IZx61W6IyxbYcUNdqf9mpAU6QKIRFMaMqHTVlsFTm6sJs13Ft7y7rXBcY7Ls ZSE5meKAE0dvSbEBMqPpiXlDJXShwbNfvnQ71Bmd8Z/o74A7+e+f4biSDJ2kUaaDo5sx/ 1to8laeR4jQtNkc+JwxfQixg+V9rqjBggwivuVW2AC9vGyTDgObSWxcl9Vzp51DxBMIlI +mzTWKDEDSG84TdYEHc29RbyEhZGjLzJDHWnN/XPfCgwCIK1qpSljZ2rfL144RdWgVoeh +ofkQRrHqXCPD3J5kRLTSvnwvaBukQHuPend2in5yxa+zFxCrbizVdYfJ3gpis2+V/g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796052986; h=Received:DKIM-Signature:Date:Message-ID:From:To:Cc:Subject: In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=zd6U171lvDBkQ4+e44+AcF9+z0kwIzWceR+pVjosR44=; b=HJKCME5gt+W9Ld9CZqMgX89E4K3Is4L8dPwlm0r/HxzEPnqk2bAP9r/496ofBIAqDEAU dqShWPiPhgsD+z6ov8Cbo7UrvnffE3agdgLMCS22Ibwj5WbyN/RsDkQJ8vyqqfgcaOmlj BEQ5U0QiCBWmZ6pC8vfzI0ij32xPPWrRYiwEo91VHHrZ4XWpV/z8BiSx+B1YxtO7HTqDe onPwAzXTzYrzqlpGZpn45EmQaiAZ/Rk+zUaYYm+TEkal/0ThR2R1IanOrj+RpPwNg1f2u 5Fczx2QNLTBE9/4jHyRGuuQDMdRVwsBJBaxGo0SlZ1G6LsNqSVVv4AABC+JEdFIq47w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=D7e43+wi; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9A0A606A320; Mon, 30 Nov 2026 15:36:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=D7e43+wi Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DFEE1F00896; Mon, 30 Nov 2026 15:36:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796052986; bh=zd6U171lvDBkQ4+e44+AcF9+z0kwIzWceR+pVjosR44=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=D7e43+wiiet+IYh90GdviwpxPc8EOcaZCa+qQDiPAv+2LRQNMpr/9tODZvWW8DuJo xdV0dcRX9SFUl99FttMU0LjdqbjNdVj5oxG0neFMZ9jeQ5BlaKb/7QomzmBf3elmBV v1THEc937J7mBWgJWPmSJ7Av3RgxK9FA6KJiZuZlVOJQGQNjNP219NR0uCXCATmyPU l0eY8Vk7VJ/nLjhaNqk77xDun5QEXUx2mf7aCwZFKigjrDd7draRj27ucSemSmM8P5 vaFHMuojskYXTZkUGsVKv/qxAoHRhIFdUWCG/3ZALdYUr+tQVl57tNlCjaAF3i0UFV kw5JKO7e6hxwA== Date: Mon, 30 Nov 2026 05:36:25 -1000 Message-ID: <9a62510c0dd0fe29ed5a40e89aa80e83@kernel.org> From: Tejun Heo To: Andrea Righi Cc: David Vernet , Changwoo Min , Masoud Aghasi , sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH sched_ext/for-7.4-fixes] sched_ext: Fix unbounded format string reads in the bstr kfuncs In-Reply-To: <20261130075303.1261456-1-arighi@nvidia.com> References: <20261130075303.1261456-1-arighi@nvidia.com> X-Mailing-List: sched-ext@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello, Andrea. On Mon, Nov 30, 2026 at 08:53:03AM +0100, Andrea Righi wrote: > @@ -11513,11 +11535,11 @@ __bpf_kfunc void scx_bpf_dump_bstr(char *fmt, unsigned long long *data, > } > > /* append the formatted string to the line buf */ > - ret = __bstr_format(sch, buf->data, buf->line + dd->cursor, > + ret = __bstr_format(sch, buf->data, buf->fmt, buf->line + dd->cursor, > sizeof(buf->line) - dd->cursor, fmt, data, data__sz); The reentrancy that sashiko pointed out reproduces. With an fexit program on bpf_bprintf_prepare() calling scx_bpf_dump() on the dump CPU and the outer call passing no args, bstr_printf() runs the inner format on NULL bin_args: KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] RIP: 0010:strlen+0x25/0x70 Call Trace: bstr_printf+0x182/0x8d0 __bstr_format+0x12e/0x1b0 scx_bpf_dump_bstr+0xe2/0x310 bpf_prog_1088b804fb0352ba_bstr_dump+0x117/0x1ce bpf__sched_ext_ops_dump+0x48/0xa4 scx_dump_state+0x4b9/0xe00 scx_disable_irq_workfn+0x7b/0xf0 Without the patch, the same test only loses dump lines, so the oops is new with the shared buf->fmt. scx_kfunc_ids_no_tracing was added in this cycle and this is headed to stable, so can you close it in this patch instead of a follow-up? Thanks. -- tejun