🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: muc.lists.freebsd.bugs
7 messages
7 total messages Started by bugzilla-noreply Sat, 28 Nov 2026 19:32
[Bug 301240] arm64: panic "ncpus is 0 with non-zero map" in kern_membarrier -> smp_rendezvous_cpus when building lang/dotnet
#843
Author: bugzilla-noreply
Date: Sat, 28 Nov 2026 19:32
71 lines
4180 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301240

            Bug ID: 301240
           Summary: arm64: panic "ncpus is 0 with non-zero map" in
                    kern_membarrier -> smp_rendezvous_cpus when building
                    lang/dotnet
           Product: Base System
           Version: 15.1-RELEASE
          Hardware: arm64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: szczepan@szczepan.net

While building lang/dotnet (dotnet-10.0.14) from ports on an arm64 VM (Oracle
Cloud Free Tier / Ampere A1), the host panics and reboots after a few minutes
(even seconds) of compilation.

Environment:
- uname -a:
  FreeBSD amper 15.1-RELEASE-p7 FreeBSD 15.1-RELEASE-p7
releng/15.1-n283696-bb03631fe3b7 GENERIC arm64

- CPUs:
  hw.ncpu: 2
  kern.smp.maxcpus: 1024

- Port: lang/dotnet (dotnet-10.0.14, bootstrap SDK 10.0.12)

Note on bootstrap workaround:
The 10.0.12 bootstrap SDK fails to start on this FreeBSD 15.x host due to a
missing LLVM 21 libc++ symbol (`_ZNSt3__113__hash_memoryEPKvm` in
`libhostfxr.so`). To run the bootstrap SDK during the build, `libc++.so.1` from
FreeBSD 14.5-RELEASE was supplied to the bootstrap binary via libmap.conf.

Panic output (captured from OCI serial console):
panic: ncpus is 0 with non-zero map
cpuid = 0
time = 1795886357
KDB: stack backtrace:
#0 0xffff000000583de8 at kdb_backtrace+0x60
#1 0xffff00000052ce60 at vpanic+0x1b0
#2 0xffff00000052ccac at panic+0x48
#3 0xffff00000059a358 at smp_rendezvous_cpus+0x3ac
#4 0xffff0000004fc594 at kern_membarrier+0x67c
#5 0xffff000000950e08 at do_el0_sync+0x664
#6 0xffff0000009261ac at handle_el0_sync+0x4c
Uptime: 7m31s

Steps to reproduce:
1. On an arm64 FreeBSD 15.x VM, supply `libc++.so.1` from FreeBSD 14.5-RELEASE
so the `lang/dotnet` bootstrap SDK can execute.
2. Run `make` in `/usr/ports/lang/dotnet`.
3. Within several minutes, .NET's `membarrier(2)` calls trigger the kernel
panic above.

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
[Bug 301240] arm64: panic "ncpus is 0 with non-zero map" in kern_membarrier -> smp_rendezvous_cpus when building lang/dotnet
#844
Author: bugzilla-noreply
Date: Sat, 28 Nov 2026 19:51
15 lines
2584 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301240

--- Comment #1 from sec <szczepan@szczepan.net> ---
In `sys/kern/kern_membarrier.c`, `kern_membarrier()` appears to populate a
`cpuset_t` with an out-of-range or inactive CPU bit (e.g., `NOCPU` / 255 on
arm64 where MAXCPU >= 256) and passes it to `smp_rendezvous_cpus()`

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
[Bug 301240] arm64: panic "ncpus is 0 with non-zero map" in kern_membarrier -> smp_rendezvous_cpus when building lang/dotnet
#846
Author: bugzilla-noreply
Date: Sun, 29 Nov 2026 22:20
16 lines
2549 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301240

Mark Linimon <linimon@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |crash

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
[Bug 301240] arm64: panic "ncpus is 0 with non-zero map" in kern_membarrier -> smp_rendezvous_cpus when building lang/dotnet
#860
Author: bugzilla-noreply
Date: Mon, 30 Nov 2026 15:50
19 lines
2673 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301240

Gleb Popov <arrowd@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arrowd@FreeBSD.org

--- Comment #2 from Gleb Popov <arrowd@FreeBSD.org> ---
The bootstrap problem mentioned in this PR is now fixed.

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
[Bug 301240] arm64: panic "ncpus is 0 with non-zero map" in kern_membarrier -> smp_rendezvous_cpus when building lang/dotnet
#861
Author: bugzilla-noreply
Date: Mon, 30 Nov 2026 19:00
33 lines
3182 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301240

Konstantin Belousov <kib@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kib@FreeBSD.org

--- Comment #3 from Konstantin Belousov <kib@FreeBSD.org> ---
This should fix it, can you confirm?

diff --git a/sys/kern/kern_membarrier.c b/sys/kern/kern_membarrier.c
index 0c8f4b843473..465c50900126 100644
--- a/sys/kern/kern_membarrier.c
+++ b/sys/kern/kern_membarrier.c
@@ -70,6 +70,8 @@ membarrier_action_seqcst_sync_core(void *arg __unused)
 static void
 do_membarrier_ipi(cpuset_t *csp, void (*func)(void *))
 {
+  if (CPU_COUNT(csp) == 0)
+     return;
   atomic_thread_fence_seq_cst();
   smp_rendezvous_cpus(*csp, smp_no_rendezvous_barrier, func,
       smp_no_rendezvous_barrier, NULL);

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
[Bug 301240] arm64: panic "ncpus is 0 with non-zero map" in kern_membarrier -> smp_rendezvous_cpus when building lang/dotnet
#865
Author: bugzilla-noreply
Date: Mon, 30 Nov 2026 22:36
37 lines
3169 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301240

--- Comment #4 from commit-hook@FreeBSD.org ---
A commit in branch main references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=162dcf946b157d529ed37a2c57ca18b25434c2ec

commit 162dcf946b157d529ed37a2c57ca18b25434c2ec
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-11-30 18:58:19 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-11-30 22:35:31 +0000

    membarrier(2): do not call smp_rendezvous_cpus() with an empty mask

    If the caller migrates while the mask is computed and no other thread
    of the process is running, the mask is empty, and smp_rendezvous_cpus()
    panics.

    PR:     301240
    Fixes:  4a69fc16a583 ("Add membarrier(2)")
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week

 sys/kern/kern_membarrier.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
[Bug 301240] arm64: panic "ncpus is 0 with non-zero map" in kern_membarrier -> smp_rendezvous_cpus when building lang/dotnet
#870
Author: bugzilla-noreply
Date: Tue, 01 Dec 2026 12:32
14 lines
2448 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301240

--- Comment #5 from sec <szczepan@szczepan.net> ---
testing build with the patch applied, so far host didn't crashed, so looks
good.

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads