From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id 872195A004F for ; Mon, 05 Aug 2024 16:10:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722867035; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rs+CojcUebm7QDyyar24C6AJC2MdDPtlJURME2igJkM=; b=g6FUQwztn6NXtWR90djmSSEPz86sduCKBa2Xwe9gT/X9VjyzwgEKsUbKjcAgDJKZSQvgB7 EXwgzJh99yn+6DqQk9Q9P9o0IHWOeVALCvZUSC3uJRuALYKXQKd1wC4liMPjRARvfM3l5p /2DL7DpFR9tV68WTKbjPbTV8IGhM19k= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-589-riyl8bkxPOahYXmUELQXLg-1; Mon, 05 Aug 2024 10:10:30 -0400 X-MC-Unique: riyl8bkxPOahYXmUELQXLg-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DD76B1955D53 for ; Mon, 5 Aug 2024 14:10:29 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.39.192.249]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A8A011955D44; Mon, 5 Aug 2024 14:10:28 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH] util: In ASSERT(), use "fprintf(stderr, ...)" rather than err(...) Date: Mon, 5 Aug 2024 16:10:27 +0200 Message-ID: <20240805141027.1502569-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: UT4C27KLPQAH6HWWPIW6JQX2UQIBDRY3 X-Message-ID-Hash: UT4C27KLPQAH6HWWPIW6JQX2UQIBDRY3 X-MailFrom: lvivier@redhat.com 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: Laurent Vivier 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: 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). We don't have a coredump or a backtrace but we have at least the error message... only if logging is enabled. As this kind of information is needed in any case, replace the "err()" function by an "fprintf(stderr, ...)". Signed-off-by: Laurent Vivier --- util.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 #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 \ */ \ -- 2.45.2