ish-app / ish-app/ish

Race on lock owner

Open
#781 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
20.5k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

Didn't look at this much, but

```
WARNING: ThreadSanitizer: data race (pid=60527)
Read of size 8 at 0x000100121568 by thread T13 (mutexes: write M991771789040377880, write M965876331701207728):
#0 deliver_signal_unlocked (ish:x86_64+0x10001c7f6)
#1 send_signal (ish:x86_64+0x10001d084)
#2 itimer_notify (ish:x86_64+0x100016c92)
#3 timer_thread (ish:x86_64+0x100067729)

Previous write of size 8 at 0x000100121568 by thread T15 (mutexes: write M3840):
#0 unlock (ish:x86_64+0x100019c9a)
#1 futex_put (ish:x86_64+0x1000193ea)
#2 futex_wake (ish:x86_64+0x1000194c5)
#3 sys_futex (ish:x86_64+0x100019661)
#4 handle_interrupt (ish:x86_64+0x100004976)
#5 task_run_current (ish:x86_64+0x100007705)
#6 task_thread (ish:x86_64+0x100007821)
```

```console
(lldb) image lookup -a 0x10001c7f6
Address: ish[0x000000010001c7f6] (ish.__TEXT.__text + 109446)
Summary: ish`deliver_signal_unlocked + 774 at signal.c:78:55
(lldb) image lookup -a 0x100019c9a
Address: ish[0x0000000100019c9a] (ish.__TEXT.__text + 98346)
Summary: ish`unlock + 442 at sync.h:62:17
(lldb) image lookup -a 0x1000193ea
Address: ish[0x00000001000193ea] (ish.__TEXT.__text + 96122)
Summary: ish`futex_put + 122 at futex.c:54:5
```

Seems like there is a race on the lock's owner in `deliver_signal_unlocked` when the `trylock` fails but we check it anyways.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the ThreadSanitizer trace in signal.c:78, then inspect the lock handling in sync.h:62 and futex.c:54. Reproduce the race under ThreadSanitizer and trace how deliver_signal_unlocked observes the lock owner after trylock fails. Done means the race is resolved and the sanitizer no longer reports it.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.