From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.53]) (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 2BE944266A0 for ; Mon, 11 May 2026 16:53:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778518402; cv=none; b=V3BPvFgeVJyp83sjoAr7OhQVmyNxvacPKisYJil6/TtOF9GhzPHma7ixFKXBxnz54T0SM9M19xLrpqJbMCLlJBsV2FOujAShTyB6EZOk5aTEyc9vTXt3KmsVWQ02da1JhtlosAa3E5dMTj3QYkvdYbK24MZuarIdhdhcWqELRU0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778518402; c=relaxed/simple; bh=NDr89ZHqjMmSAUjSSYDe/cY3Eiu1jte8P7RxS6azPjU=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=W0Wk2zUCGM6m3b4zm0U2DqG6QZ6vHVVxCvkWjFrylfpLLzYC9UMinAh8J/Iqct/NidyCyMpYvLueGGWxJ556Dr7UERcyELXlLCIeyt+iysGHh7IfqVrNrqeVIkYCLXS8gwgAIH9/zx1QeHvOqFvsvGTEvV1y/TdzETboJecTb5k= 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=ljDLeVW/; arc=none smtp.client-ip=209.85.161.53 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="ljDLeVW/" Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-685017d0fbcso2495184eaf.3 for ; Mon, 11 May 2026 09:53:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778518400; x=1779123200; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=JavA89CInqrRT0axMkoFaX73nwP/5TwmJupoBxqRvFM=; b=ljDLeVW/UM0cgDttn8g3cTL06JrkMAr9PVMUHZx9PVOpYUxTGeS/Mi3jvg38dkJy45 H+HsLHXM+MLVLybFkrw1EqYr53HcoUa3OEI9KsIbEeLB9EYzRGEuxMVzrTWaOGPVK6wu e69zT8HiyPrO1q6kPTejnZJ8gWq4SXVZeAvEoZCZbNsfMu2gC934/RPGwvaW2OjcREpC lOf1sujSjWYhwHEwz2JgzV1TeHIhCpCWUrFN2c8YljUpQtn8ABDCCut1FBnKr2i5SNTH +BnZuRBFDTtkFx876Q9gAMSHmjPi8YU+/IhwbMehVPyFsGOcLT0vRSIARBvS6MXqmWYZ oiLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778518400; x=1779123200; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=JavA89CInqrRT0axMkoFaX73nwP/5TwmJupoBxqRvFM=; b=g2bvlZ0Jji/JbGwVWt9R7uyWVGOHgSVDw2+XNZ5VmnxqATtvvN9BOH6pYI49R+XOy9 ttJDW5ptF7RueffG14J70bcKIgr2unmPpjbXCVYr38QdWC1H1tjeIWW2bQo2gZ5s4uU3 ojkvibhB2D7O9zz4+AIzhqQzQ4b5IIYIdyPTgeApV1D7NVimSbpiobiNtX2/Ce9Y+9tc k3TPoo2EK4i5AbegJYbkL7LRfg0ntnoCmtl5O4jzfsSsgRFm5/T7zW57igtgNtcmex6a PCmwhqYpZqNy6MFqxuA69upNwup6XMm2TMk60vh5gwPWHN6m6RFYRuOJcJtFNtjELXSp 7dFA== X-Forwarded-Encrypted: i=1; AFNElJ/XV7bI4Trvnsgg41FehLDNizVh9rR/xMy/l3mHHUU48N3XXmbBrmtWmv5oEdFzh4Le3R8=@vger.kernel.org X-Gm-Message-State: AOJu0Yx0j6Q608H7tC+vxG2y4hmJmffR3V9rTogTDoiWfxlVRlkkpRM2 dgqOz879BNNpJx2NoL0l9YzacJ42tMFtn38v0y9rm9FQPAXfPW3L1S7j X-Gm-Gg: Acq92OHLjFfE68vb2ypfEYBbSmcc7d9sfQ2RnBfVQp+VdSLdT/X8LixXRa8IgpYfFpO w/9onbNpriSZA34mG9eTXj4n+0iEP0ErSZ+Bqzt1IQFoD3GDLwSnC3vAwK1d6owUqDxFcXe5+wz rXtizFORWeEBspMounujvVNrugqeNL8M8978VjOOAo/qfxnPPCTNPh6XB4WCX0xGEebxnjDWtc2 orqTr4RQDykiDi1nDJKTqHpK1nNquR9raA697AWYr5a4H6LzUX9r50gvTFOO5THdRpS7yaYqxIH zhbeqRExWAjGASz3tPYJmutqY8afaXmqyvl9ftDmGBqZ4hRbk8IVOwdCZ6/uMjjrph2DWV8LlZo suMjcDvBTCzQ5aKvIP4zwb4Oc6HPPKYogPWOlxq4Juc211WQW868cZAQs8hOkfyNlmem0ZM81/k BDRLoPTsyOTB1WlqOdqiYYqv1Rn5EN4niiLDUt15buzFyySFKkQj9SMmqkB6WHmWgJ2/6X0OnUC TKdrvmnBlbDgT3X052sGeTWy24MYuZ4oLA6R5g= X-Received: by 2002:a05:6820:986:b0:694:8b08:b916 with SMTP id 006d021491bc7-69b25c88aecmr8116691eaf.35.1778518399975; Mon, 11 May 2026 09:53:19 -0700 (PDT) Received: from localhost ([2a03:2880:10ff:49::]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-69b25c75d08sm6137740eaf.4.2026.05.11.09.53.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 May 2026 09:53:19 -0700 (PDT) Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 11 May 2026 09:53:17 -0700 Message-Id: Cc: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH bpf-next v13 1/8] bpf: Extend BPF syscall with common attributes support From: "Alexei Starovoitov" To: , , X-Mailer: aerc References: <20260511152817.89191-2-leon.hwang@linux.dev> <810f123d14450d09d147d90dea25ddf5091e636542fcc5729d0594bfbd622757@mail.kernel.org> In-Reply-To: <810f123d14450d09d147d90dea25ddf5091e636542fcc5729d0594bfbd622757@mail.kernel.org> On Mon May 11, 2026 at 9:19 AM PDT, bot+bpf-ci wrote: >> diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h >> index f5639d5ac331..50055ab73649 100644 >> --- a/include/linux/syscalls.h >> +++ b/include/linux/syscalls.h >> @@ -936,7 +936,8 @@ asmlinkage long sys_seccomp(unsigned int op, unsigne= d int flags, >> asmlinkage long sys_getrandom(char __user *buf, size_t count, >> unsigned int flags); >> asmlinkage long sys_memfd_create(const char __user *uname_ptr, unsigned= int flags); >> -asmlinkage long sys_bpf(int cmd, union bpf_attr __user *attr, unsigned = int size); >> +asmlinkage long sys_bpf(int cmd, union bpf_attr __user *attr, unsigned = int size, >> + struct bpf_common_attr __user *attr_common, unsigned int size_common= ); >> asmlinkage long sys_execveat(int dfd, const char __user *filename, >> const char __user *const __user *argv, >> const char __user *const __user *envp, int flags); > > [ ... ] > >> diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/b= pf.h >> index 677be9a47347..16ff0968fc21 100644 >> --- a/tools/include/uapi/linux/bpf.h >> +++ b/tools/include/uapi/linux/bpf.h >> @@ -994,6 +994,7 @@ enum bpf_cmd { >> BPF_PROG_STREAM_READ_BY_FD, >> BPF_PROG_ASSOC_STRUCT_OPS, >> __MAX_BPF_CMD, >> + BPF_COMMON_ATTRS =3D 1 << 16, /* Indicate carrying syscall common attr= s. */ >> }; > > [ ... ] > >> @@ -1500,6 +1501,13 @@ struct bpf_stack_build_id { >> }; >> }; >> >> +struct bpf_common_attr { >> + __u64 log_buf; >> + __u32 log_size; >> + __u32 log_level; >> + __u32 log_true_size; >> +}; >> + > > Should log_buf use __aligned_u64 instead of plain __u64? > > Looking at other pointer-bearing fields in the BPF UAPI, they consistentl= y > use __aligned_u64. For example, the existing BPF_PROG_LOAD log_buf in uni= on > bpf_attr is declared as: > > __aligned_u64 log_buf; /* user supplied buffer */ > > The __aligned_u64 attribute forces 8-byte alignment on all architectures, > including 32-bit systems where native unsigned long long alignment is onl= y > 4 bytes. Without this attribute, struct bpf_common_attr will have differe= nt > layouts between 32-bit and 64-bit ABIs: > > - 32-bit: 20 bytes, 4-byte aligned > - 64-bit: 24 bytes (4 bytes of tail padding), 8-byte aligned > > While the current __sys_bpf() implementation with bpf_check_uarg_tail_zer= o() > and min_t() capped copying handles this gracefully, deviating from the > established BPF UAPI convention could create problems for future extensio= ns. > If another __u64 field is added later, the inter-field offsets would dive= rge > between ABIs. > > Would it be better to use __aligned_u64 log_buf to match union bpf_attr a= nd > preserve identical struct layouts across 32/64-bit ABIs? bot has a point. pw-bot: cr