From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) (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 3051642E01F for ; Mon, 11 May 2026 16:53:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778518402; cv=none; b=To2jnSndrd6XQaTlgjYesHAHDpfGFIIGdIrwsqZ5BOxFuRiVqUXgp2OAjAaGkn8ih9g/LL1xkxHn0zI7ymIRCPeBCkxDGHHEIaajMqh/6W30qlcD6cdndlzvoEllbHAwCJQofP7540V9ZTtaCTnFkAkCegZ+beZG7wpjbxjg64M= 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.54 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-f54.google.com with SMTP id 006d021491bc7-685017d0fbcso2495185eaf.3 for ; Mon, 11 May 2026 09:53:20 -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=QTuSLVfkQQKcy+gFqkHG8VNc+SpDeikKb+iX7LWlsVtEY23Mi61uUWV1sgq7eB5FNF cW4chhm9mBNe4CaIhZifHx89StXsFKR5774PF90PuzSA4LnpeplVBylUdypkEFsoADaO UfhN9V1VFLQrja3Yt75VRgnDgI30I4kZoy4jK1ovpI/wG+j2/Q6It0Az6/RHcFCS5YUU jPshjrb04yGiW98ywarph0T+GfbCepA5dVxIss0Xitlf8NJwPxywwHeZ5dag2SeyIBDc 5vNLpFiezeUMNpjzD8YYK8K3caduUChS4nQsQeSIJO7ZUSiOG5GZAjtRSWkOnWDo3T4P 8OYw== X-Forwarded-Encrypted: i=1; AFNElJ8dQu88vNifLxkYS3p0EL3L2Sg2h80QP3xK/48gezMhL0Ho3bLVLT0JTZ+T9exYzStGMffuotqlKISQRJk=@vger.kernel.org X-Gm-Message-State: AOJu0YxIyeR+2veN81bvo9ZD0mQw8OnJVpNz63rTLqrBmIcucRKGKRls +82pdh0S3pvecBSwwq5PMHv1IGcXdOkSrB0TTW12vuyHz+4ToI7+51j0 X-Gm-Gg: Acq92OEt720UH6mSXOVsYn1X0fcLDBgAhF3kUcO/H5nOWKMSp3RpCxXe9HMaAvC8Oku cyoSchez0vvOOWbzOFhWcYaeQY6ybq4HGm59nTcqa0OhR66CU/2XS39NoVBycdIkUkN4wUI+Alo 6mekdFS5Z+5CvPIvyKMrrHFrbqwHAKv/92VPaDOcoSbHOTMHr93ELAXrD1gKLrNkR5KAR45elo8 HK8b1DNqIQnDtNLEncb6UUrHuL68809up/PK5Fv2a23OkIKqiZu8zJ3rm3Cgt/MsiYh+YzMRG1q ci4Z34iwsKICAnnds1qaIpKlYi71lu4V8v+t9QbAqogFFuTtJljEXVM/tcMw/GqZiepkLj1G7e4 wun3A0rQFIwaZniaPGiVuA9vrZPsFjSvqPIkc3iSseqEAv5RTWitjE8RMdYHJNCjEWlyQX3zGzv CreepfdgXxlzNhZX1VVSku0fz2ej6fcmhJUIAS1rEf08JpfbzRsyp4p/XNmiGnV48w5grmXwsPd h2RAvFqZ4t4i9V3c/EipMZBaDP+yuIfA9IHPzk= 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: linux-kernel@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