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.133.124]) by passt.top (Postfix) with ESMTP id 28F3F5A004E for ; Tue, 06 Aug 2024 13:43:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722944599; 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: in-reply-to:in-reply-to:references:references; bh=RoZtGTMR5BB0KyzVesTodvOPKPFvyfTwJ+GXZqljhjE=; b=dEtvHD2LJ5sptAF6Cpu166qo9uTR1tpEjHFUgKmuMntPRtmY31XHVcmnlQj6ngnsQyGBaC pQ+VIfkd0lFc348EE/4XUNa5hEo3W1wkkzbydnujK3UobJyOrGuSy4Qa390vrFInK5GvId KNT10mNhJOD2LmIC98wjnCBeV8BCUvs= Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-302-hkY9G0pAOZa_QsTaaPb0cg-1; Tue, 06 Aug 2024 07:43:17 -0400 X-MC-Unique: hkY9G0pAOZa_QsTaaPb0cg-1 Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-1fd774c3b8eso61605115ad.0 for ; Tue, 06 Aug 2024 04:43:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722944596; x=1723549396; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=RoZtGTMR5BB0KyzVesTodvOPKPFvyfTwJ+GXZqljhjE=; b=jKi2SGP315wpOH70hWTU6fiXU//W2c8lij2Z5Ky56/8I8Eh7MwYI1O8I08OgdE7km8 UM7BGF/QMHnHRcBWa4xRkHNfUwkFzBP7ZvhnexOcHcakwXx5kAFzVIIaqyng3tshPrL4 t8hP+EBGAbmilKHTXi9kwelZPXbR1Fjg63qC3M4cZh7+1PBGAMdE/eTdHu53oamDzBdT c8Zdcjqtk26KWThhbLZhj8ec1qcPmchs1gtwCFiRl8puJouSwhaFpjo7XIBrsQs/hkHM AaGTKkTWo2ktvGrm/4oeGOh6WN0PGF2KMxW6MK5BRdl2lN0SetNpv/NxAI+/asWKg0Iz Orvg== X-Forwarded-Encrypted: i=1; AJvYcCV7t0mk5tEA5JRBhDPx6dzid1c6MAsO+TKrjAzdrGUNf8Gen70hv19ltrzjJGk++rgTiq6rWzqmDYt0FK2vV6/ihsV3 X-Gm-Message-State: AOJu0YwrO/Fh0QGFApICGjcg+fjxvdOArGT2IdRBXY0DNGfFsau6yMlx xs9F1lC6SNzNDK8rqtYGz3k8iZxsI1NJaNnXIXHSVPpZLVO5mmzecf1CkYBtrNZQeS3HhJDmYm/ 8dxzxYRAabz9igLVkBigqe0sR5l3qu2Tse2zeKFYkOuOMZCZ88A== X-Received: by 2002:a17:902:e5cb:b0:1fb:6ea1:6e with SMTP id d9443c01a7336-1ff5240bc5fmr224157485ad.9.1722944596510; Tue, 06 Aug 2024 04:43:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHH3KHpz2hULy1nrpfbUBNzyMMKW4hYRHBHNB9JzU0Hz9pk3gvIz7n7ARLyJnC2MZTgBhdg6g== X-Received: by 2002:a17:902:e5cb:b0:1fb:6ea1:6e with SMTP id d9443c01a7336-1ff5240bc5fmr224157115ad.9.1722944596038; Tue, 06 Aug 2024 04:43:16 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7b7654bf852sm5714650a12.90.2024.08.06.04.43.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Aug 2024 04:43:15 -0700 (PDT) Date: Tue, 6 Aug 2024 13:43:12 +0200 From: Stefano Brivio To: Laurent Vivier Subject: Re: [PATCH] util: In ASSERT(), use "fprintf(stderr, ...)" rather than err(...) Message-ID: <20240806134312.7db47e59@elisabeth> In-Reply-To: References: <20240805141027.1502569-1-lvivier@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: YERFL557T3NCBU4CGFMDXWVGXYZQCHOD X-Message-ID-Hash: YERFL557T3NCBU4CGFMDXWVGXYZQCHOD X-MailFrom: sbrivio@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: David Gibson , 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: On Tue, 6 Aug 2024 11:27:40 +0200 Laurent Vivier wrote: > On 06/08/2024 02:27, David Gibson wrote: > > 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. > > > > I don't know what, but there is something that prevent passts to generate a core dump > (I tried abort(), (char *)0 = 0, it works with a simple program, not with passt). This: isolation.c:374: prctl(PR_SET_DUMPABLE, 0); > Moreover, if we use gdb it doesn't stop on the syscall but exit and we cannot locate the > exit point. And as strace doesn't report the syscall that generates the SIGSYS, it makes > hard to find which one it is. This is probably caused by the seccomp filter instead. You could skip applying that by commenting this out: if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) || prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog)) die_perror("Failed to apply seccomp filter"); and find out which system call causes that... maybe we could add it to the 'make valgrind' target, then, or add a 'make debug' one. It's just important to clearly show that users should *not* use any such target for regular operation. -- Stefano