git: 626cbd464814 - main - linux(4): Handle incorrect FUTEX_CLOCK_REALTIME option bit.

Dmitry Chagin dchagin at FreeBSD.org
Thu Jul 29 09:59:01 UTC 2021


The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=626cbd4648141929502b953111dc8a71d550c7e8

commit 626cbd4648141929502b953111dc8a71d550c7e8
Author:     Dmitry Chagin <dchagin at FreeBSD.org>
AuthorDate: 2021-07-29 09:55:33 +0000
Commit:     Dmitry Chagin <dchagin at FreeBSD.org>
CommitDate: 2021-07-29 09:55:33 +0000

    linux(4): Handle incorrect FUTEX_CLOCK_REALTIME option bit.
    
    Return ENOSYS if the FUTEX_CLOCK_REALTIME option bit is specified for an
    inappropriate futex operation.
    
    MFC after:              2 weeks
---
 sys/compat/linux/linux_futex.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c
index fcac2eba4956..5f18c93b0988 100644
--- a/sys/compat/linux/linux_futex.c
+++ b/sys/compat/linux/linux_futex.c
@@ -224,6 +224,12 @@ linux_futex(struct thread *td, struct linux_futex_args *args)
 	args->clockrt = args->op & LINUX_FUTEX_CLOCK_REALTIME;
 	args->op = args->op & ~LINUX_FUTEX_CLOCK_REALTIME;
 
+	if (args->clockrt &&
+	    args->op != LINUX_FUTEX_WAIT_BITSET &&
+	    args->op != LINUX_FUTEX_WAIT_REQUEUE_PI &&
+	    args->op != LINUX_FUTEX_LOCK_PI2)
+		return (ENOSYS);
+
 	switch (args->op) {
 	case LINUX_FUTEX_WAIT:
 		args->val3 = FUTEX_BITSET_MATCH_ANY;


More information about the dev-commits-src-main mailing list