Bug 255591 - [linuxlator] qbittorrent kernel panics machine
Summary: [linuxlator] qbittorrent kernel panics machine
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Mark Johnston
URL:
Keywords: crash, regression
Depends on:
Blocks:
 
Reported: 2021-05-04 11:13 UTC by pitwuu
Modified: 2022-10-12 00:50 UTC (History)
2 users (show)

See Also:


Attachments
crash log qbittorrent linuxulator (132.79 KB, text/plain)
2021-05-04 16:03 UTC, pitwuu
no flags Details
workaround patch (1.97 KB, patch)
2021-05-05 11:31 UTC, pitwuu
no flags Details | Diff
patch (2.44 KB, patch)
2021-05-14 14:45 UTC, Mark Johnston
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description pitwuu 2021-05-04 11:13:34 UTC
Some change in -CURRENT caused the machine to kernel panic when running qbittorrent and other Qt applications under the linux emulation.

I will investigate. Does not seem to occur on 13.0.
Comment 1 Edward Tomasz Napierala freebsd_committer freebsd_triage 2021-05-04 12:26:06 UTC
Do you have a backtrace?
Comment 2 pitwuu 2021-05-04 14:53:57 UTC
(In reply to Edward Tomasz Napierala from comment #1)
I don't have one and I don't know how to get one since the machine insta-reboots when I run /usr/bin/qbittorrent. Ideas?
Comment 3 pitwuu 2021-05-04 16:03:04 UTC
Created attachment 224664 [details]
crash log qbittorrent linuxulator
Comment 4 pitwuu 2021-05-04 23:41:36 UTC
The i386 version of the program running in a 32-bit chroot, on amd64 host, does not produce a kernel panic.

My CPU is a ryzen 4600H.

I narrowed down the crash to the various futex_* operations in
`amd64/linux/linux_support.s`. 

Any ideas?
Comment 5 pitwuu 2021-05-05 11:31:28 UTC
Created attachment 224686 [details]
workaround patch

Dirty workaround. Qt applications run now.
I'm not sure if this is correct from a lock integrity point of view.
Comment 6 Mark Johnston freebsd_committer freebsd_triage 2021-05-14 14:45:57 UTC
Created attachment 224945 [details]
patch

It looks like the amd64 futex operations are simply broken with SMAP enabled?  I'm not sure how this ever worked.  Please try the attached patch to confirm, I did not test it.

I'm not sure if your patch is correct either but indeed it would be preferable to implement these ops without custom asm primitives.
Comment 7 pitwuu 2021-05-15 12:56:40 UTC
(In reply to Mark Johnston from comment #6)
Mark's patch resolves the issue. Please pull in.
Comment 8 Mark Johnston freebsd_committer freebsd_triage 2021-05-15 15:29:53 UTC
https://reviews.freebsd.org/D30276
Comment 9 commit-hook freebsd_committer freebsd_triage 2021-05-16 17:44:54 UTC
A commit in branch main references this bug:

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

commit fb580451456aa769daa2f4b2f077e39692f80c62
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-05-16 17:41:41 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-05-16 17:42:08 +0000

    linux: Fix SMAP-enabled futex routines

    Some of them were dereferencing the user pointer before disabling SMAP.

    PR:             255591
    Reviewed by:    kib
    Tested by:      pitwuu@gmail.com
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D30276

 sys/amd64/linux/linux_support.s     | 12 ++++++------
 sys/amd64/linux32/linux32_support.s | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)
Comment 10 commit-hook freebsd_committer freebsd_triage 2021-05-23 16:50:41 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=22d340828e06818fb47e6034aadbd52a01795793

commit 22d340828e06818fb47e6034aadbd52a01795793
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-05-16 17:41:41 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-05-23 16:44:06 +0000

    linux: Fix SMAP-enabled futex routines

    Some of them were dereferencing the user pointer before disabling SMAP.

    PR:             255591
    Reviewed by:    kib
    Tested by:      pitwuu@gmail.com
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit fb580451456aa769daa2f4b2f077e39692f80c62)

 sys/amd64/linux/linux_support.s     | 12 ++++++------
 sys/amd64/linux32/linux32_support.s | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)
Comment 11 commit-hook freebsd_committer freebsd_triage 2021-05-23 16:51:42 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=14cc1326579b24c5eb743a62874fc768d0ca0ab5

commit 14cc1326579b24c5eb743a62874fc768d0ca0ab5
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-05-16 17:41:41 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-05-23 16:43:43 +0000

    linux: Fix SMAP-enabled futex routines

    Some of them were dereferencing the user pointer before disabling SMAP.

    PR:             255591
    Reviewed by:    kib
    Tested by:      pitwuu@gmail.com
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit fb580451456aa769daa2f4b2f077e39692f80c62)

 sys/amd64/linux/linux_support.s     | 12 ++++++------
 sys/amd64/linux32/linux32_support.s | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)