qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: make check-functional failures with --enable-rust: unsafe precondition(s) violated: NonNull::new_unchecked
Date: Fri, 7 Mar 2025 18:29:04 +0000	[thread overview]
Message-ID: <CAFEAcA9iepVWQVAsdeGAWDkXVrOLK_dq1cdiceVdwozGuwsYXw@mail.gmail.com> (raw)
In-Reply-To: <CAFEAcA8ozGhFJWc41M6ziB3mPtEQ_bpWcQTCj1Ue_W66-MYf2w@mail.gmail.com>

On Fri, 7 Mar 2025 at 18:24, Peter Maydell <peter.maydell@linaro.org> wrote:
> thread '<unnamed>' panicked at core/src/panicking.rs:221:5:
> unsafe precondition(s) violated: NonNull::new_unchecked requires that
> the pointer is non-null
> stack backtrace:
>    0: rust_begin_unwind
>              at
> /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:662:5
>    1: core::panicking::panic_nounwind_fmt::runtime
>              at
> /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/panicking.rs:112:18
>    2: core::panicking::panic_nounwind_fmt
>              at
> /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/panicking.rs:122:5
>    3: core::panicking::panic_nounwind
>              at
> /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/panicking.rs:221:5
>    4: core::ptr::non_null::NonNull<T>::new_unchecked::precondition_check
>              at
> /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/ub_checks.rs:70:21
>    5: core::ptr::non_null::NonNull<T>::new_unchecked
>              at
> /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/ub_checks.rs:77:17
>    6: qemu_api::qom::Owned<T>::from
>              at ./rust/qemu-api/libqemu_api.rlib.p/structured/qom.rs:741:19
>    7: pl011_create
>              at ./../../rust/hw/char/pl011/src/device.rs:716:24
>    8: vexpress_common_init
>              at ./../../hw/arm/vexpress.c:647:5

The backtrace suggests that the rust version of pl011_create()
isn't able to handle being passed in a NULL chr. This is
permitted and means "don't connect up a chardev to the device's
chr property" which in turn means "you don't have a chardev
backend" (and all the C qemu_chr_fe_* functions happily accept
NULL and interpret it as "just do nothing").

-- PMM


  reply	other threads:[~2025-03-07 18:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07 18:24 make check-functional failures with --enable-rust: unsafe precondition(s) violated: NonNull::new_unchecked Peter Maydell
2025-03-07 18:29 ` Peter Maydell [this message]
2025-03-07 21:53 ` Philippe Mathieu-Daudé

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=CAFEAcA9iepVWQVAsdeGAWDkXVrOLK_dq1cdiceVdwozGuwsYXw@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.
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 NNTP newsgroup(s).