Bug 273662 - [Linuxulator]: 3rd party linux binary segfaults after upgrading to 14.0-BETA1, ran flawlessly on 13.2-RELEASE
Summary: [Linuxulator]: 3rd party linux binary segfaults after upgrading to 14.0-BETA1...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 14.0-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: Dmitry Chagin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-09 17:42 UTC by Vedran Miletic
Modified: 2023-09-16 08:31 UTC (History)
2 users (show)

See Also:


Attachments
VS Code Remote - SSH server-side kdump (454.93 KB, application/x-xz)
2023-09-11 10:43 UTC, Vedran Miletic
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vedran Miletic 2023-09-09 17:42:06 UTC
All packages were reinstalled after upgrading from 13.2-RELEASE-p3 to 14.0-BETA1 according to best practices described in the Handbook.

I have linux_base-c7 installed on my system using pkg.

The binary I want to run is Pandoc 3.1.7 from GitHub: https://github.com/jgm/pandoc/releases/tag/3.1.7 (the archive I use is pandoc-3.1.7-linux-amd64.tar.gz)

$ tar xvf pandoc-3.1.7-linux-amd64.tar.gz
$ ./pandoc-3.1.7/bin/pandoc
pandoc: internal error: timerfd_create: Invalid argument
(GHC version 9.6.2 for x86_64_alpine_linux)
Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug
Abort (core dumped)

The resulting pandoc.core is too large to be attached, but I can upload it if necessary.

This is a regression as on 13.2-RELEASE-p3 this binary and others ran flawlessly.
Comment 1 Mina Galić freebsd_triage 2023-09-09 19:44:41 UTC
you can open that core file in gdb, and show us a backtrace, that should be enough. provided gdb doesn't crash
Comment 2 Vedran Miletic 2023-09-09 21:21:47 UTC
% gdb pandoc-3.1.7/bin/pandoc pandoc.core
GNU gdb (GDB) 13.1 [GDB v13.1 for FreeBSD]
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd14.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from pandoc-3.1.7/bin/pandoc...
(No debugging symbols found in pandoc-3.1.7/bin/pandoc)
[New LWP 101065]

warning: Unexpected size of section `.reg/101065' in core file.

warning: Unexpected size of section `.reg-xstate/101065' in core file.
Core was generated by `./pandoc-3.1.7/bin/pandoc'.
Program terminated with signal SIGABRT, Aborted.

warning: Unexpected size of section `.reg/101065' in core file.

warning: Unexpected size of section `.reg-xstate/101065' in core file.
#0  0x0000000000000043 in ?? ()
(gdb)
Comment 4 Vedran Miletic 2023-09-11 09:58:48 UTC
Sounds great. Will this be included in BETA2?

I know this is a long shot, but any chance this might also fix VS Code Remote - SSH over Linuxulator, which also got broken between 13.2-RELEASE and 14.0-BETA?
Comment 5 Dmitry Chagin freebsd_committer freebsd_triage 2023-09-11 10:19:15 UTC
(In reply to Vedran Miletic from comment #4)
> Sounds great. Will this be included in BETA2?

MFC is 13.09, BETA2 start to 15.09, perhaps 

> I know this is a long shot, but any chance this might also fix VS Code Remote - SSH over Linuxulator, which also got broken between 13.2-RELEASE and 14.0-BETA?

hmm, could you please ktrace/kdump it? ie ktrace -di /pathtobin, then kdump -HAR -m 64
Comment 6 Vedran Miletic 2023-09-11 10:32:32 UTC
How would I do that if VS Code is SSH-ing and running executables for me? I tried setting

RemoteCommand /usr/bin/ktrace -di /compat/linux/usr/bin/bash

instead of

RemoteCommand /compat/linux/usr/bin/bash

in .ssh/config, but SSH hangs with

debug1: Sending command: /usr/bin/ktrace -di /compat/linux/usr/bin/bash
debug1: pledge: fork
Comment 7 Vedran Miletic 2023-09-11 10:35:44 UTC
Never mind, RequestTTY force does the job.
Comment 8 Vedran Miletic 2023-09-11 10:43:00 UTC
Created attachment 244767 [details]
VS Code Remote - SSH server-side kdump
Comment 9 Dmitry Chagin freebsd_committer freebsd_triage 2023-09-11 11:16:27 UTC
looks like this one https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273414

could you please test https://people.freebsd.org/~dchagin/nc.patch ?
Comment 10 Vedran Miletic 2023-09-11 21:10:55 UTC
(In reply to Dmitry Chagin from comment #9)
I would just have to rebuild the kernel, right? The world from BETA1 would be OK?
Comment 11 Dmitry Chagin freebsd_committer freebsd_triage 2023-09-12 07:12:11 UTC
(In reply to Vedran Miletic from comment #10)
sure
Comment 12 commit-hook freebsd_committer freebsd_triage 2023-09-12 07:50:31 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=3c93ba3d7f7cf0d61f6b98c08319c729a6d31d71

commit 3c93ba3d7f7cf0d61f6b98c08319c729a6d31d71
Author:     Vico Chen <vico.chern_qq.com>
AuthorDate: 2023-09-05 08:53:02 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-09-12 07:47:54 +0000

    linux(4): Convert flags in timerfd_create

    The timerfd is introduced in FreeBSD 14, and the Linux ABI timerfd is
    also moved to FreeBSD native timerfd, but it can't work well as Linux
    TFD_CLOEXEC and TFD_NONBLOCK haven't been converted to FreeBSD
    TFD_CLOEXEC and TFD_NONBLOCK.

    Reviewed by:            dchagin, jfree
    PR:                     273662
    Differential revision:  https://reviews.freebsd.org/D41708
    MFC after:              1 week

    (cherry picked from commit aadc14bceb4e94f5b75a05de96cd9619b877b030)

 sys/compat/linux/linux_event.c | 9 +++++++--
 sys/compat/linux/linux_event.h | 3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)
Comment 13 Vedran Miletic 2023-09-12 08:56:25 UTC
(In reply to Dmitry Chagin from comment #11)
Very good, will give it a shot then.

(In reply to commit-hook from comment #12)
Good news. Eagerly waiting for BETA2.
Comment 14 commit-hook freebsd_committer freebsd_triage 2023-09-12 16:44:27 UTC
A commit in branch releng/14.0 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=80b763d4a539854d43535b2f9dcd0b2f739a6502

commit 80b763d4a539854d43535b2f9dcd0b2f739a6502
Author:     Vico Chen <vico.chern_qq.com>
AuthorDate: 2023-09-05 08:53:02 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-09-12 16:43:20 +0000

    linux(4): Convert flags in timerfd_create

    The timerfd is introduced in FreeBSD 14, and the Linux ABI timerfd is
    also moved to FreeBSD native timerfd, but it can't work well as Linux
    TFD_CLOEXEC and TFD_NONBLOCK haven't been converted to FreeBSD
    TFD_CLOEXEC and TFD_NONBLOCK.

    Approved by:            re (gjb)
    Reviewed by:            dchagin, jfree
    PR:                     273662
    Differential revision:  https://reviews.freebsd.org/D41708
    MFC after:              1 week

    (cherry picked from commit aadc14bceb4e94f5b75a05de96cd9619b877b030)
    (cherry picked from commit 3c93ba3d7f7cf0d61f6b98c08319c729a6d31d71)

 sys/compat/linux/linux_event.c | 9 +++++++--
 sys/compat/linux/linux_event.h | 3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)
Comment 15 Vedran Miletic 2023-09-16 08:31:45 UTC
The original issue is fixed in 14.0-BETA2.

(In reply to Dmitry Chagin from comment #11)
VS Code Remote - SSH also seems to work now without any extra patches.