Date: Fri, 24 Apr 2020 13:25:02 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r360256 - in stable/12/sys: kern sys Message-ID: <202004241325.03ODP2jc076462@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Fri Apr 24 13:25:02 2020 New Revision: 360256 URL: https://svnweb.freebsd.org/changeset/base/360256 Log: MFC r360140, r360155: kqueue timer/data fixes r360140: kqueue: fix conversion of timer data to sbintime This unbreaks the i386 kqueue timer tests after a recent change switched NOTE_ABSTIME over to using microseconds. Notably, the data argument (which holds useconds) is an int64_t, but we were passing it to timer2sbintime which takes an intptr_t. Perhaps in a previous incarnation, intptr_t would have made sense, but now it just leads to the timestamp getting truncated and subsequently rejected when it no longer fits in an intptr_t. r360155: kevent32: fix the split of data into data1/data2 The current situation results in intermittent breakage if data gets split up with the sign bit set on the data1 half of it, as PAIR32TO64 will then: data1 | (data2 << 32) -> resulting in data1 getting sign-extended when it's implicitly widened and clobbering the result. AFAICT, there's no compelling reason for these to be signed. This was most exposed by flakiness in the kqueue timer tests under compat32 after the ABSTIME test got switched over to using a better clock and microseconds. Modified: stable/12/sys/kern/kern_event.c stable/12/sys/sys/event.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_event.c ============================================================================== --- stable/12/sys/kern/kern_event.c Fri Apr 24 13:24:19 2020 (r360255) +++ stable/12/sys/kern/kern_event.c Fri Apr 24 13:25:02 2020 (r360256) @@ -619,7 +619,7 @@ knote_fork(struct knlist *list, int pid) (NOTE_SECONDS | NOTE_MSECONDS | NOTE_USECONDS | NOTE_NSECONDS) static sbintime_t -timer2sbintime(intptr_t data, int flags) +timer2sbintime(int64_t data, int flags) { int64_t secs; Modified: stable/12/sys/sys/event.h ============================================================================== --- stable/12/sys/sys/event.h Fri Apr 24 13:24:19 2020 (r360255) +++ stable/12/sys/sys/event.h Fri Apr 24 13:25:02 2020 (r360256) @@ -111,7 +111,7 @@ struct kevent32 { #ifndef __amd64__ uint32_t pad0; #endif - int32_t data1, data2; + uint32_t data1, data2; uint32_t udata; /* opaque user data identifier */ #ifndef __amd64__ uint32_t pad1;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004241325.03ODP2jc076462>