From nobody Sun Dec 14 19:25:51 2025 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 0176C43AB7; Sat, 19 Apr 2025 10:46:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745059591; cv=none; b=hQan3nmk5C9OCCT63YUu7nV/WIOcjPXV77dE3XFL88bRZOfxgfnb7zKcmdcLJQ0+TNuS/h463mJmy1YTev8IXlLeBdxmvLb/iZ4yazdr1sHVBOLo25XML7vEKphlQUgYMjKWNYQ55CWOCY3rD3jsve7Q7p/UbTJbzXbA5Y7m9Z8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745059591; c=relaxed/simple; bh=2U/dcRwTExJtAZorNzJrHaFvZx2GCTS0zbAPO75QNGQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k/XVKNdLyV8JoUq+TNhthfukEQ38QrPlo4Yp26JuHGkZYPay+X+PAj0omvy6kczT0OkQU3v4XZhmiBLwGNYaXupXpaA9Ox5jSs5HtboA3dMcWhXf9yqrOjD1kT5XQ5UjSbJt8xbAzoDcWGb+EWWTHyw/0aq6VR5g7Iun0/utQxE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=aGLfPhYR; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="aGLfPhYR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1745059587; bh=2U/dcRwTExJtAZorNzJrHaFvZx2GCTS0zbAPO75QNGQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=aGLfPhYRPFnc3C4nO72wONVUzSo3D5O/Qp20l2WjHs9okOO1VrPZ5NZkUHjlZgxaE +be7vAHwXNgegfqabI/ND5KnHk83wh7h6nLsHU4e+YHf7KIQdLhRevYhDcXy7Yub/k WhLgUBmLy0jlxCh2p79FBd+zUL8gAJCIkyAy33iI= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 19 Apr 2025 12:46:21 +0200 Subject: [PATCH v2 4/7] tools/nolibc: properly align dirent buffer Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250419-nolibc-ubsan-v2-4-060b8a016917@weissschuh.net> References: <20250419-nolibc-ubsan-v2-0-060b8a016917@weissschuh.net> In-Reply-To: <20250419-nolibc-ubsan-v2-0-060b8a016917@weissschuh.net> To: Willy Tarreau , "Paul E. McKenney" , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1745059587; l=1186; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=2U/dcRwTExJtAZorNzJrHaFvZx2GCTS0zbAPO75QNGQ=; b=LLSwzT4aqCw37xqmYBxyy4xERUH85Gl5SniRsgsU0Mlm2FsCKfHCT/jBMJLPPhj6oJ1toBgGK FSxV8IStHgHBO+UQTItXv0/rB/8zXuHrhD6NBDKE/If2zPasikIBfnb X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= As byte buffer is overlaid with a 'struct dirent64'. it has to satisfy the structs alignment requirements. Fixes: 665fa8dea90d ("tools/nolibc: add support for directory access") Signed-off-by: Thomas Wei=C3=9Fschuh Acked-by: Willy Tarreau --- tools/include/nolibc/dirent.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/include/nolibc/dirent.h b/tools/include/nolibc/dirent.h index c5c30d0dd6806b1bec2fa8120a3df29aaa201393..946a697e98e4c7bb0970b163ffd= fe0e069b1d160 100644 --- a/tools/include/nolibc/dirent.h +++ b/tools/include/nolibc/dirent.h @@ -7,6 +7,7 @@ #ifndef _NOLIBC_DIRENT_H #define _NOLIBC_DIRENT_H =20 +#include "compiler.h" #include "stdint.h" #include "types.h" =20 @@ -58,7 +59,7 @@ int closedir(DIR *dirp) static __attribute__((unused)) int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) { - char buf[sizeof(struct linux_dirent64) + NAME_MAX + 1]; + char buf[sizeof(struct linux_dirent64) + NAME_MAX + 1] __nolibc_aligned_a= s(struct linux_dirent64); struct linux_dirent64 *ldir =3D (void *)buf; intptr_t i =3D (intptr_t)dirp; int fd, ret; --=20 2.49.0