threads/180652: compat32 problem in clock_getcpuclockid2

Petr Salinger Petr.Salinger at seznam.cz
Fri Jul 19 12:10:00 UTC 2013


>Number:         180652
>Category:       threads
>Synopsis:       compat32 problem in clock_getcpuclockid2
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-threads
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 19 12:10:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Petr Salinger
>Release:        HEAD
>Organization:
>Environment:
GNU/kFreeBSD 10.0-0-amd64
>Description:
The prototype is

int clock_getcpuclockid2(id_t id, int which, clockid_t *clock_id);

In the first argument so far only pid_t and lwpid_t sizes are passed.

Accroding to sys/_types.h:

typedef __int64_t       __id_t;
typedef __int32_t       __lwpid_t; 
typedef __int32_t       __pid_t;
typedef __int32_t       __clockid_t;

There is no freebsd32_clock_getcpuclockid2 at all.
The 64-bit argument is misplaced in compat32.


>How-To-Repeat:

>Fix:

The PID/TID is encoded in lower 30 bits of clockid.
I.e. whole id_t space cannot be used anyway.

Please either change signature of syscall to

int clock_getcpuclockid2(long id, int which, clockid_t *clock_id);

or provide real

freebsd32_clock_getcpuclockid2 ();


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-threads mailing list