public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>, passt-dev@passt.top
Subject: Re: [PATCH] util: In ASSERT(), use "fprintf(stderr, ...)" rather than err(...)
Date: Tue, 6 Aug 2024 13:43:12 +0200	[thread overview]
Message-ID: <20240806134312.7db47e59@elisabeth> (raw)
In-Reply-To: <b5032618-a36b-4f24-9e8d-1f6ec3c715ba@redhat.com>

On Tue, 6 Aug 2024 11:27:40 +0200
Laurent Vivier <lvivier@redhat.com> 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


  reply	other threads:[~2024-08-06 11:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-05 14:10 [PATCH] util: In ASSERT(), use "fprintf(stderr, ...)" rather than err(...) Laurent Vivier
2024-08-05 14:34 ` Stefano Brivio
2024-08-05 15:52   ` Laurent Vivier
2024-08-05 16:12     ` Stefano Brivio
2024-08-06  0:27 ` David Gibson
2024-08-06  9:27   ` Laurent Vivier
2024-08-06 11:43     ` Stefano Brivio [this message]
2024-08-06 12:28     ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240806134312.7db47e59@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).