Skip to content

Race Conditions in qutil #238

Open
Open
@insertinterestingnamehere

Description

I'm seeing a handful of thread sanitizer errors about race conditions in the qutil code.

One example: apparently the macro invoked at

INNER_LOOP(qutil_uint_mult_inner, qutil_uis_args, MULT_MACRO)
,
INNER_LOOP(qutil_uint_max_inner, qutil_uis_args, MAX_MACRO)
, and
INNER_LOOP(qutil_uint_min_inner, qutil_uis_args, MIN_MACRO)
includes both a read and a corresponding atomic write from another thread.

Another example:
non-atomic read:

aligned_t cur = *args->furthest_leftwall;

atomic write to the same variable:
tmp = qthread_cas(args->furthest_leftwall, cur, mine);

Similar:

aligned_t cur = *args->furthest_rightwall;

tmp = qthread_cas(args->furthest_rightwall, cur, mine);

Another more unusual one:
The macro invoked at

INNER_LOOP(qutil_int_mult_inner, qutil_is_args, MULT_MACRO)
has a non-atomic write as well as an atomic write to the same variable from a different thread via qthread_syncvar_fill at
UNLOCK_THIS_MODIFIED_SYNCVAR(addr, ret, 0);
.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions