Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit a124b164 authored by Qasim Javed's avatar Qasim Javed
Browse files

Use EFD_SEMAPHORE while creating eventfd for fake timers

A read on the eventfd that underlies a fake timer can currently return a
value greater than 1. This causes us to hit an assert in Alarm::on_fire.
In case of fake timers, the read value from the eventfd can be
legitimately greater than 1. This is because when fake_timerfd_advance
is used to advance the timer, it can result in multiple fake timers
expiring.

Using the EFD_SEMAPHORE flag ensures that the read on the eventfd will
always return 1 as mentioned in the eventfd man page:

"If EFD_SEMAPHORE was specified and the eventfd counter
has a nonzero value, then a read(2) returns 8 bytes
containing the value 1, and the counter's value is
decremented by 1."

Bug: 244188446
Tag: #gd-refactor
Test: gd/fuzz/run --host hci_layer

Change-Id: I71f64d8803f6754540fd1dedc2d04e92d83b0f16
parent 870320d7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment