From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B46A3264F4 for ; Wed, 4 Mar 2026 05:47:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772603258; cv=none; b=DFJj06A/ZuG8pEGiEsB7Q584QDU9KALlE516ZcHkvguGB8tCGFVbdOoC/qA2v906yT1vvK0ifOZz6ciab2I/pBZPNdUQELe0DyguRl/VzcwzNxNAPWOKiu3wEJb3Vcl3bOW1Xn7ul2UKYdVI0bn3xXN0D39BzJH/FzsROYl/zOQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772603258; c=relaxed/simple; bh=wn/euQ0njXoXEa3IcAhDUjQJsCU+35ZsymX2391PKDU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=LAJejxVRQ2tCmBxWKpsTZjTLzFwiDEDSOEqU7MWV/XXOqYQlXg9A8jbidb6xc5dAHwpiMc5DiQWZtB20XrR+y686Sxh2UkXIO5E8GXkQO5//WL8LUAvo99lQAvVnCm8Yz3mEpFMML7udWhriNPglJOrdR7jrMx2BociaMNbJXqY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=wR90e6el; arc=none smtp.client-ip=95.215.58.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="wR90e6el" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772603245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9GOvrSPoqklRKTRkSybSArOnZorW/NqBc/2B7NprcZw=; b=wR90e6elpMiEqeZGZ6SwxdssiYTUfmKlhBgt9tMyCWkj5hz2ELG+hVrKpoBsrwKpON9OeT Xzj5CY6226vzQA8VNxac4amUfpKeP1pxT/TLU4Z7m+oFZAgrB2OscoC2ovJWFyl3bh9pQD TwOb2KzwZlIAM3rQBbOg1+KTMUNE5kw= Date: Wed, 4 Mar 2026 13:47:08 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH bpf-next v10 3/8] bpf: Refactor reporting log_true_size for prog_load Content-Language: en-US To: Alexei Starovoitov Cc: bpf , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan , Christian Brauner , Seth Forshee , Yuichiro Tsuji , Andrey Albershteyn , Willem de Bruijn , Jason Xing , Tao Chen , Mykyta Yatsenko , Kumar Kartikeya Dwivedi , Anton Protopopov , Amery Hung , Rong Tao , LKML , Linux API , "open list:KERNEL SELFTEST FRAMEWORK" , kernel-patches-bot@fb.com References: <20260211151115.78013-1-leon.hwang@linux.dev> <20260211151115.78013-4-leon.hwang@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Leon Hwang In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 4/3/26 00:32, Alexei Starovoitov wrote: > On Wed, Feb 11, 2026 at 7:13 AM Leon Hwang wrote: >> [...] >> @@ -6241,7 +6244,11 @@ static int __sys_bpf(enum bpf_cmd cmd, bpfptr_t uattr, unsigned int size, >> err = map_freeze(&attr); >> break; >> case BPF_PROG_LOAD: >> - err = bpf_prog_load(&attr, uattr, size); >> + if (from_user && size >= offsetofend(union bpf_attr, log_true_size)) >> + log_true_size = uattr.user + offsetof(union bpf_attr, log_true_size); > > So you added 'from_user' gating because > you replaced copy_to_bpfptr_offset() with copy_to_user()? > This is a drastic change in behavior and you don't even talk about > it in the commit log. > You said "refactor". This is not a refactoring! > > This is v10. The common_attr feature is useful, but > you really need to think harder about what your patches > are doing. > Refactoring should not introduce any functional changes. If a functional change is involved, it should be factored out of the refactoring commit into a separate commit with an explanation in the commit log. I'll add this to my self-review checklist. The intention of 'from_user' was to replace copy_to_bpfptr_offset() with copy_to_user(), since the log is always copied to the user-space buffer when the log level is not BPF_LOG_KERNEL in kernel/bpf/log.c::bpf_verifier_vlog(). The 'from_user' gating will be dropped in v12 to keep this patch as pure refactoring. Thanks, Leon