From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 527D45A004F for ; Tue, 06 Aug 2024 02:43:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1722904993; bh=7BTYkfN7n4fsanAswa03FoKHm9T7GDO2JuJ1e5tsHtE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Nbi4KNFYSEPCZRi5rosZmayrfSlhRhj/tBiG9AQMFiM1cc1Eva0xen504M2k9HSOf POuLdbO6a26iOLdDIuNPYfL7hC3R9vgniPWEtMjZTgcgfJODRHZsRDLXQsE0r4FH3i QZTy+V2lxLRNs0Uklvla3sT0ohnqFNoJDGFTCDzZr+2O1TBtfr7cvGl3a6CmJm6GYP DVIWSGhZvMyzTgmwFVtVyKPgQr1SaLDsms2b9/UttmW0BYGTX9PUDubEyELwgFIx7P Zj9bdoad3OQOgJo3PihN6IxQ2Pz399nmyK6SOEBhVJmMQAeIw0EbIfKlQluXqs5s13 aU1cmuDFll9og== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4WdF0K0DB8z4wbp; Tue, 6 Aug 2024 10:43:13 +1000 (AEST) Date: Tue, 6 Aug 2024 10:27:11 +1000 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH] util: In ASSERT(), use "fprintf(stderr, ...)" rather than err(...) Message-ID: References: <20240805141027.1502569-1-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7wo3bQoOlJgiP61Q" Content-Disposition: inline In-Reply-To: <20240805141027.1502569-1-lvivier@redhat.com> Message-ID-Hash: MJXZDF2SLY3QPFO6L3UHQLRS7NE6WJNZ X-Message-ID-Hash: MJXZDF2SLY3QPFO6L3UHQLRS7NE6WJNZ X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --7wo3bQoOlJgiP61Q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 05, 2024 at 04:10:27PM +0200, Laurent Vivier wrote: > We use our own implementation of assert() because the glic implementation > uses syscalls that aren't in our seccomp filter, see 7a8ed9459dfe > ("Make assertions actually useful"). And we replaced it by an err(), > followed by an abort() (that is also catched by seccomp). I think Stefano's said everything I would on the change itself, but.. > We don't have a coredump or a backtrace but we have at least the > error message... only if logging is enabled. Whether we get a coredump shouldn't be affected by our weird ASSERT() here. If coredumps are enabled (which they're not by default on current distros, AFAICT), we should still get a coredump with the SIGSYS here, just as we would for a SIGABRT. > As this kind of information is needed in any case, replace the "err()" > function by an "fprintf(stderr, ...)". >=20 > Signed-off-by: Laurent Vivier > --- > util.h | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) >=20 > diff --git a/util.h b/util.h > index b7541ce24e5a..b44b4bfdccd7 100644 > --- a/util.h > +++ b/util.h > @@ -13,6 +13,7 @@ > #include > #include > #include > +#include > #include > =20 > #include "log.h" > @@ -67,8 +68,10 @@ > #define ASSERT(expr) \ > do { \ > if (!(expr)) { \ > - err("ASSERTION FAILED in %s (%s:%d): %s", \ > - __func__, __FILE__, __LINE__, STRINGIFY(expr)); \ > + fprintf(stderr, \ > + "ASSERTION FAILED in %s (%s:%d): %s\n", \ > + __func__, __FILE__, __LINE__, \ > + STRINGIFY(expr)); \ > /* This may actually SIGSYS, due to seccomp, \ > * but that will still get the job done \ > */ \ --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --7wo3bQoOlJgiP61Q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmaxbdsACgkQzQJF27ox 2GdjwBAAoGkVfY2RsUthcBzYT1CT+qmmpuYR8rRDCLoNolbI9aA3rq/gOZ5ZqdJ5 +StjS+SmOAFI3GOzdrcIgJpyxp1Ann63Fbuvm4PJgeOY8O1STBaqTRdtV3uebOkX U506ShVOvuiujxSQVndADVVOWPMekzHCtMeAf9rO7O4KIejZ837lLCESwjrlJk42 R/cjvB5+pvM/mUUKVLpa9G0/PUeLn53fQYAe7sRy3c1qxGqdhDjBZYuOAdaoUnOq 2FQwUL8pcSpAAH+QwBbvAD3xCuMaCGphsYn5qiLIePhpQkMo8AR+qUAz/2NWGffn GH0DFzEGcC5RqALSbakdJt8yhFxpWEKsxbP6pngqUTlYHqEdNc6yyP25sX8Ovmrd MrSRatR0LUfk40yKS0Ssrugn4yELqieZi5xnHg5UWDK6o52127dikty5Bc3vHdxu 0FWZo3lGr4DdGSCYni/ZibJjvH0Il36B/pwKn4N8JIfWl2xScrKdb7InA6cLgLXf CFkkOd0CqSiBhZonTNF0ytqZMzSAOx/wHBGrGdTwQPgwpvXkSJTT0MBKGA3LXRpH 65OJTF+FWkpRSqv+UwVw9RKHraRSp81kGnVIQYxT6wQC3OCQXVC0i6SOIQ+J7fP1 ZbhL4V4rfgsXFYg6uXNBOrPT2hXIIZaeDg6SCeA+gb4t1f/eKjQ= =kmbR -----END PGP SIGNATURE----- --7wo3bQoOlJgiP61Q--