From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1660072-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 56380159C9B
	for <garchives@archives.gentoo.org>; Fri,  9 Aug 2024 10:06:26 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id A517D2BC0A8;
	Fri,  9 Aug 2024 10:06:25 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 8783B2BC0A8
	for <gentoo-commits@lists.gentoo.org>; Fri,  9 Aug 2024 10:06:25 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id A521E3430B6
	for <gentoo-commits@lists.gentoo.org>; Fri,  9 Aug 2024 10:06:24 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 048EE1EBF
	for <gentoo-commits@lists.gentoo.org>; Fri,  9 Aug 2024 10:06:22 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1723197978.15a415c49a6aeadf8c098df646643f990aa62b6a.sam@gentoo>
Subject: [gentoo-commits] proj/pax-utils:master commit in: /
X-VCS-Repository: proj/pax-utils
X-VCS-Files: dumpelf.c fuzz-ar.c paxinc.h
X-VCS-Directories: /
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 15a415c49a6aeadf8c098df646643f990aa62b6a
X-VCS-Branch: master
Date: Fri,  9 Aug 2024 10:06:22 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: eda0703f-b4ef-4a05-b071-468029aa2a01
X-Archives-Hash: 95e59e20b4a028c338053a6bb7eeb158

commit:     15a415c49a6aeadf8c098df646643f990aa62b6a
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 26 04:54:20 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Aug  9 10:06:18 2024 +0000
URL:        https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=15a415c4

fuzzer: fix unused setting on argc & argv

At some point the compiler changed to not propagate argument attributes
from the prototype to the definition.  Add a hacky macro to insert it
by default instead to avoid need for (void) casts.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
(cherry picked from commit 6508649486444d20636d1ff15df7db7302f3c46c)
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dumpelf.c | 2 --
 fuzz-ar.c | 3 ---
 paxinc.h  | 9 +++++++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dumpelf.c b/dumpelf.c
index 15058ee..1eb7e62 100644
--- a/dumpelf.c
+++ b/dumpelf.c
@@ -579,8 +579,6 @@ static void parseargs(int argc, char *argv[])
 #if PAX_UTILS_LIBFUZZ
 int LLVMFuzzerInitialize(int *argc, char ***argv)
 {
-	(void)argc;
-	(void)argv;
 	(void)parseargs;
 	security_init(false);
 	return 0;

diff --git a/fuzz-ar.c b/fuzz-ar.c
index 360194f..eadcdee 100644
--- a/fuzz-ar.c
+++ b/fuzz-ar.c
@@ -15,9 +15,6 @@ static int fd;
 
 int LLVMFuzzerInitialize(int *argc, char ***argv)
 {
-	(void)argc;
-	(void)argv;
-
 	fd = memfd_create("fuzz-input.a", MFD_CLOEXEC);
 	if (fd == -1)
 		errp("memfd_create() failed");

diff --git a/paxinc.h b/paxinc.h
index b2d2b50..0d10c21 100644
--- a/paxinc.h
+++ b/paxinc.h
@@ -112,9 +112,14 @@ const char *strfileperms(const char *fname);
 #define PTR_ALIGN_DOWN(base, size) ((__typeof__(base))ALIGN_DOWN((uintptr_t)(base), (size)))
 #define PTR_ALIGN_UP(base, size)   ((__typeof__(base))ALIGN_UP  ((uintptr_t)(base), (size)))
 
-/* Support for libFuzzer: https://llvm.org/docs/LibFuzzer.html */
+/*
+ * Support for libFuzzer: https://llvm.org/docs/LibFuzzer.html
+ * No headers define this API, so we have to do it ourselves.
+ */
 #if PAX_UTILS_LIBFUZZ
-int LLVMFuzzerInitialize(__unused__ int *argc, __unused__ char ***argv);
+int LLVMFuzzerInitialize(int *argc, char ***argv);
+/* Attributes on the prototype are ignored, so hack the definition. */
+#define LLVMFuzzerInitialize(c, v) LLVMFuzzerInitialize(__unused__ c, __unused__ v)
 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
 #endif