Bug #83375 Incorrect argument is passed by InnoDB to syscall(SYS_futex)
Submitted: 13 Oct 2016 16:26 Modified: 28 Oct 2016 20:03
Reporter: Sergey Vojtovich Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.7 OS:Linux
Assigned to: CPU Architecture:Any

[13 Oct 2016 16:26] Sergey Vojtovich
Description:
According to futex manual (http://man7.org/linux/man-pages/man2/futex.2.html) third argument of FUTEX_WAKE is number of waiters to wake up.

However InnoDB passes MUTEX_STATE_LOCKED, which is mutex state, see storage/innobase/include/ib0mutex.h:

        /** Wakeup a waiting thread */
        void signal() UNIV_NOTHROW
        {
                syscall(SYS_futex, &m_lock_word, FUTEX_WAKE_PRIVATE,
                        MUTEX_STATE_LOCKED, 0, 0, 0);
        }

How to repeat:
This bug doesn't have user visible effect. By a chance MUTEX_STATE_LOCKED equals to 1, which is expected value. Also this code seem to be disabled in default builds.

Suggested fix:
Replace MUTEX_STATE_LOCKED with 1.
[20 Oct 2016 7:33] MySQL Verification Team
Hello Sergey Vojtovich,

Thank you for the report and feedback.

Thanks,
Umesh
[28 Oct 2016 20:03] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 5.7.17, 8.0.1 release, and here's the changelog entry:

InnoDB passed an invalid argument to syscall(SYS_futex). 

Thank you for the bug report.