Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jan 2026 06:36:21 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 292496] linux_timer_create error when using LINUX_CLOCK_MONOTONIC
Message-ID:  <bug-292496-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292496

            Bug ID: 292496
           Summary: linux_timer_create error when using
                    LINUX_CLOCK_MONOTONIC
           Product: Base System
           Version: 15.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: andrey.antufyev@yandex.ru
                CC: val@packett.cool

*How to Reproduce*
The bug was discovered while attempting to use PVS-Studio (linux compat).
For testing purposes, I created a primitive script:
https://gist.github.com/darkvision77/2ebebced40d7333626f4a9cade1b2178.
(PVS-Studio is also available in ports: devel/linux-pvs-studio, but it is
currently broken due to this bug.)

Two analyzer diagnostics are expected to be output, but an error occurs on the
affected kernels.

*Affected kernel versions*
Anything above 15.
To be more precise, after commit 108de784513d: review D39270.

*Description*
During execution, linux_timer_create (sys/compat/linux/linux_timer.c) is
called. LINUX_CLOCK_MONOTONIC is used as clock_id.

Further, clock_id is translated into native using linux_to_native_clockid.
Before commit 108de784513d, it returned CLOCK_MONOTONIC and everything worked
fine.

After the commit, linux_to_native_clockid started returning CLOCK_UPTIME. Next,
CLOCK_UPTIME is passed to kern_ktimer_create (sys/kern/kern_time.c), which
returns EINVAL when checking if (clock_id < 0 || clock_id >= MAX_CLOCKS), since
MAX_CLOCKS = 5 and CLOCK_UPTIME is also equal to 5.

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

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-292496-227>