From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from plesk.hostmyservers.fr (plesk.hostmyservers.fr [45.145.164.37]) (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 A7EAE33B6E1; Wed, 12 Nov 2025 16:11:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.145.164.37 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762963907; cv=none; b=DeHlJE70UGa9iX+g7SdvCINOoqYYux9uN993rjSc0QJjoQnioHqFyjfnogk3qIWpMGwHskMrpMrS3+E08xc1NU6Sshisa3elorh23b1aer2KfjTQ+MGVYlvs2YeGoLdagI3ATs0OsxgF1FOo7yVE0r+Rfspycn2Jx6PWWawX2mQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762963907; c=relaxed/simple; bh=EBnKUP1MlXQmMXoo++IL/jgxbadEJQGUpo3RwDwduVA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=gITMbNe3ULMW5USD5YIL0shyZGrNiZD2u9BY40eHazV6ke6SgcW6pncy0wu7il9nC4BZg5s+DDqrFtBmA+vIPgTqapM0Rd3HmHdKiMcFmSjGnL1l/vf9azFybb2y99aiSIcYcfVcdATew7t4rNyxzcH4gUjzRBxeQi7P4OP/N6Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=arnaud-lcm.com; spf=pass smtp.mailfrom=arnaud-lcm.com; arc=none smtp.client-ip=45.145.164.37 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=arnaud-lcm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arnaud-lcm.com Received: from [192.168.9.28] (54-240-197-239.amazon.com [54.240.197.239]) by plesk.hostmyservers.fr (Postfix) with ESMTPSA id A2DB340A66; Wed, 12 Nov 2025 16:11:42 +0000 (UTC) Authentication-Results: Plesk; spf=pass (sender IP is 54.240.197.239) smtp.mailfrom=contact@arnaud-lcm.com smtp.helo=[192.168.9.28] Received-SPF: pass (Plesk: connection is authenticated) Message-ID: Date: Wed, 12 Nov 2025 16:11:41 +0000 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 bpf-next v3] bpf: Clamp trace length in __bpf_get_stack to fix OOB write To: Brahmajit Das , David Laight Cc: syzbot+d1b7fa1092def3628bd7@syzkaller.appspotmail.com, andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org, daniel@iogearbox.net, eddyz87@gmail.com, haoluo@google.com, john.fastabend@gmail.com, jolsa@kernel.org, kpsingh@kernel.org, linux-kernel@vger.kernel.org, martin.lau@linux.dev, netdev@vger.kernel.org, sdf@fomichev.me, song@kernel.org, syzkaller-bugs@googlegroups.com, yonghong.song@linux.dev References: <691231dc.a70a0220.22f260.0101.GAE@google.com> <20251111081254.25532-1-listout@listout.xyz> <20251112133546.4246533f@pumpkin> Content-Language: en-US From: "Lecomte, Arnaud" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-PPP-Message-ID: <176296390367.5293.6044545848476434680@Plesk> X-PPP-Vhost: arnaud-lcm.com On 12/11/2025 14:47, Brahmajit Das wrote: > On 12.11.2025 13:35, David Laight wrote: >> On Tue, 11 Nov 2025 13:42:54 +0530 >> Brahmajit Das wrote: >> > ...snip... >> Please can we have no unnecessary min_t(). >> You wouldn't write: >> x = (u32)a < (u32)b ? (u32)a : (u32)b; >> >> David >> >>> copy_len = trace_nr * elem_size; >>> >>> ips = trace->ip + skip; > Hi David, > > Sorry, I didn't quite get that. Would prefer something like: > trace_nr = (trace_nr <= num_elem) ? trace_nr : num_elem; min_t is a min with casting which is unnecessary in this case as trace_nr and num_elem are already u32. > The pre-refactor code. >