* Re: [PATCH v6 28/28] ntsync: No longer depend on BROKEN.
@ 2024-12-11 22:17 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2024-12-11 22:17 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20241209185904.507350-29-zfigura@codeweavers.com>
References: <20241209185904.507350-29-zfigura@codeweavers.com>
TO: Elizabeth Figura <zfigura@codeweavers.com>
TO: Arnd Bergmann <arnd@arndb.de>
TO: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
TO: Jonathan Corbet <corbet@lwn.net>
TO: Shuah Khan <skhan@linuxfoundation.org>
CC: linux-kernel@vger.kernel.org
CC: linux-api@vger.kernel.org
CC: wine-devel@winehq.org
CC: "André Almeida" <andrealmeid@igalia.com>
CC: Wolfram Sang <wsa-dev@sang-engineering.com>
CC: Arkadiusz Hiler <ahiler@codeweavers.com>
CC: Peter Zijlstra <peterz@infradead.org>
CC: Andy Lutomirski <luto@kernel.org>
CC: linux-doc@vger.kernel.org
CC: linux-kselftest@vger.kernel.org
CC: Randy Dunlap <rdunlap@infradead.org>
CC: Ingo Molnar <mingo@redhat.com>
CC: Will Deacon <will@kernel.org>
CC: Waiman Long <longman@redhat.com>
CC: Boqun Feng <boqun.feng@gmail.com>
CC: Elizabeth Figura <zfigura@codeweavers.com>
Hi Elizabeth,
kernel test robot noticed the following build warnings:
[auto build test WARNING on cdd30ebb1b9f36159d66f088b61aee264e649d7a]
url: https://github.com/intel-lab-lkp/linux/commits/Elizabeth-Figura/ntsync-Introduce-NTSYNC_IOC_WAIT_ANY/20241210-031155
base: cdd30ebb1b9f36159d66f088b61aee264e649d7a
patch link: https://lore.kernel.org/r/20241209185904.507350-29-zfigura%40codeweavers.com
patch subject: [PATCH v6 28/28] ntsync: No longer depend on BROKEN.
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: microblaze-randconfig-r073-20241210 (https://download.01.org/0day-ci/archive/20241212/202412120618.cqaPBBkL-lkp@intel.com/config)
compiler: microblaze-linux-gcc (GCC) 14.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202412120618.cqaPBBkL-lkp@intel.com/
smatch warnings:
drivers/misc/ntsync.c:1083 ntsync_wait_all() warn: potential spectre issue 'q->entries' [r] (local cap)
vim +1083 drivers/misc/ntsync.c
e48f54281af61c1 Elizabeth Figura 2024-12-09 1049
e48f54281af61c1 Elizabeth Figura 2024-12-09 1050 static int ntsync_wait_all(struct ntsync_device *dev, void __user *argp)
e48f54281af61c1 Elizabeth Figura 2024-12-09 1051 {
e48f54281af61c1 Elizabeth Figura 2024-12-09 1052 struct ntsync_wait_args args;
e48f54281af61c1 Elizabeth Figura 2024-12-09 1053 struct ntsync_q *q;
e48f54281af61c1 Elizabeth Figura 2024-12-09 1054 int signaled;
e48f54281af61c1 Elizabeth Figura 2024-12-09 1055 __u32 i;
e48f54281af61c1 Elizabeth Figura 2024-12-09 1056 int ret;
e48f54281af61c1 Elizabeth Figura 2024-12-09 1057
e48f54281af61c1 Elizabeth Figura 2024-12-09 1058 if (copy_from_user(&args, argp, sizeof(args)))
e48f54281af61c1 Elizabeth Figura 2024-12-09 1059 return -EFAULT;
e48f54281af61c1 Elizabeth Figura 2024-12-09 1060
e48f54281af61c1 Elizabeth Figura 2024-12-09 1061 ret = setup_wait(dev, &args, true, &q);
e48f54281af61c1 Elizabeth Figura 2024-12-09 1062 if (ret < 0)
e48f54281af61c1 Elizabeth Figura 2024-12-09 1063 return ret;
e48f54281af61c1 Elizabeth Figura 2024-12-09 1064
e48f54281af61c1 Elizabeth Figura 2024-12-09 1065 /* queue ourselves */
e48f54281af61c1 Elizabeth Figura 2024-12-09 1066
e48f54281af61c1 Elizabeth Figura 2024-12-09 1067 mutex_lock(&dev->wait_all_lock);
e48f54281af61c1 Elizabeth Figura 2024-12-09 1068
e48f54281af61c1 Elizabeth Figura 2024-12-09 1069 for (i = 0; i < args.count; i++) {
e48f54281af61c1 Elizabeth Figura 2024-12-09 1070 struct ntsync_q_entry *entry = &q->entries[i];
e48f54281af61c1 Elizabeth Figura 2024-12-09 1071 struct ntsync_obj *obj = entry->obj;
e48f54281af61c1 Elizabeth Figura 2024-12-09 1072
e48f54281af61c1 Elizabeth Figura 2024-12-09 1073 atomic_inc(&obj->all_hint);
e48f54281af61c1 Elizabeth Figura 2024-12-09 1074
e48f54281af61c1 Elizabeth Figura 2024-12-09 1075 /*
e48f54281af61c1 Elizabeth Figura 2024-12-09 1076 * obj->all_waiters is protected by dev->wait_all_lock rather
e48f54281af61c1 Elizabeth Figura 2024-12-09 1077 * than obj->lock, so there is no need to acquire obj->lock
e48f54281af61c1 Elizabeth Figura 2024-12-09 1078 * here.
e48f54281af61c1 Elizabeth Figura 2024-12-09 1079 */
e48f54281af61c1 Elizabeth Figura 2024-12-09 1080 list_add_tail(&entry->node, &obj->all_waiters);
e48f54281af61c1 Elizabeth Figura 2024-12-09 1081 }
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1082 if (args.alert) {
24ce2f869ab8577 Elizabeth Figura 2024-12-09 @1083 struct ntsync_q_entry *entry = &q->entries[args.count];
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1084 struct ntsync_obj *obj = entry->obj;
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1085
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1086 dev_lock_obj(dev, obj);
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1087 list_add_tail(&entry->node, &obj->any_waiters);
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1088 dev_unlock_obj(dev, obj);
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1089 }
e48f54281af61c1 Elizabeth Figura 2024-12-09 1090
e48f54281af61c1 Elizabeth Figura 2024-12-09 1091 /* check if we are already signaled */
e48f54281af61c1 Elizabeth Figura 2024-12-09 1092
e48f54281af61c1 Elizabeth Figura 2024-12-09 1093 try_wake_all(dev, q, NULL);
e48f54281af61c1 Elizabeth Figura 2024-12-09 1094
e48f54281af61c1 Elizabeth Figura 2024-12-09 1095 mutex_unlock(&dev->wait_all_lock);
e48f54281af61c1 Elizabeth Figura 2024-12-09 1096
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1097 /*
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1098 * Check if the alert event is signaled, making sure to do so only
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1099 * after checking if the other objects are signaled.
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1100 */
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1101
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1102 if (args.alert) {
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1103 struct ntsync_obj *obj = q->entries[args.count].obj;
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1104
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1105 if (atomic_read(&q->signaled) == -1) {
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1106 bool all = ntsync_lock_obj(dev, obj);
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1107 try_wake_any_obj(obj);
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1108 ntsync_unlock_obj(dev, obj, all);
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1109 }
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1110 }
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1111
e48f54281af61c1 Elizabeth Figura 2024-12-09 1112 /* sleep */
e48f54281af61c1 Elizabeth Figura 2024-12-09 1113
e48f54281af61c1 Elizabeth Figura 2024-12-09 1114 ret = ntsync_schedule(q, &args);
e48f54281af61c1 Elizabeth Figura 2024-12-09 1115
e48f54281af61c1 Elizabeth Figura 2024-12-09 1116 /* and finally, unqueue */
e48f54281af61c1 Elizabeth Figura 2024-12-09 1117
e48f54281af61c1 Elizabeth Figura 2024-12-09 1118 mutex_lock(&dev->wait_all_lock);
e48f54281af61c1 Elizabeth Figura 2024-12-09 1119
e48f54281af61c1 Elizabeth Figura 2024-12-09 1120 for (i = 0; i < args.count; i++) {
e48f54281af61c1 Elizabeth Figura 2024-12-09 1121 struct ntsync_q_entry *entry = &q->entries[i];
e48f54281af61c1 Elizabeth Figura 2024-12-09 1122 struct ntsync_obj *obj = entry->obj;
e48f54281af61c1 Elizabeth Figura 2024-12-09 1123
e48f54281af61c1 Elizabeth Figura 2024-12-09 1124 /*
e48f54281af61c1 Elizabeth Figura 2024-12-09 1125 * obj->all_waiters is protected by dev->wait_all_lock rather
e48f54281af61c1 Elizabeth Figura 2024-12-09 1126 * than obj->lock, so there is no need to acquire it here.
e48f54281af61c1 Elizabeth Figura 2024-12-09 1127 */
e48f54281af61c1 Elizabeth Figura 2024-12-09 1128 list_del(&entry->node);
e48f54281af61c1 Elizabeth Figura 2024-12-09 1129
e48f54281af61c1 Elizabeth Figura 2024-12-09 1130 atomic_dec(&obj->all_hint);
266531700b4e125 Elizabeth Figura 2024-12-09 1131
266531700b4e125 Elizabeth Figura 2024-12-09 1132 put_obj(obj);
266531700b4e125 Elizabeth Figura 2024-12-09 1133 }
266531700b4e125 Elizabeth Figura 2024-12-09 1134
e48f54281af61c1 Elizabeth Figura 2024-12-09 1135 mutex_unlock(&dev->wait_all_lock);
e48f54281af61c1 Elizabeth Figura 2024-12-09 1136
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1137 if (args.alert) {
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1138 struct ntsync_q_entry *entry = &q->entries[args.count];
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1139 struct ntsync_obj *obj = entry->obj;
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1140 bool all;
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1141
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1142 all = ntsync_lock_obj(dev, obj);
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1143 list_del(&entry->node);
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1144 ntsync_unlock_obj(dev, obj, all);
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1145
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1146 put_obj(obj);
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1147 }
24ce2f869ab8577 Elizabeth Figura 2024-12-09 1148
266531700b4e125 Elizabeth Figura 2024-12-09 1149 signaled = atomic_read(&q->signaled);
266531700b4e125 Elizabeth Figura 2024-12-09 1150 if (signaled != -1) {
266531700b4e125 Elizabeth Figura 2024-12-09 1151 struct ntsync_wait_args __user *user_args = argp;
266531700b4e125 Elizabeth Figura 2024-12-09 1152
266531700b4e125 Elizabeth Figura 2024-12-09 1153 /* even if we caught a signal, we need to communicate success */
8492d88b692b51d Elizabeth Figura 2024-12-09 1154 ret = q->ownerdead ? -EOWNERDEAD : 0;
266531700b4e125 Elizabeth Figura 2024-12-09 1155
266531700b4e125 Elizabeth Figura 2024-12-09 1156 if (put_user(signaled, &user_args->index))
266531700b4e125 Elizabeth Figura 2024-12-09 1157 ret = -EFAULT;
266531700b4e125 Elizabeth Figura 2024-12-09 1158 } else if (!ret) {
266531700b4e125 Elizabeth Figura 2024-12-09 1159 ret = -ETIMEDOUT;
266531700b4e125 Elizabeth Figura 2024-12-09 1160 }
266531700b4e125 Elizabeth Figura 2024-12-09 1161
266531700b4e125 Elizabeth Figura 2024-12-09 1162 kfree(q);
266531700b4e125 Elizabeth Figura 2024-12-09 1163 return ret;
266531700b4e125 Elizabeth Figura 2024-12-09 1164 }
266531700b4e125 Elizabeth Figura 2024-12-09 1165
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v6 00/28] NT synchronization primitive driver
@ 2024-12-09 18:58 Elizabeth Figura
2024-12-09 18:59 ` [PATCH v6 28/28] ntsync: No longer depend on BROKEN Elizabeth Figura
0 siblings, 1 reply; 4+ messages in thread
From: Elizabeth Figura @ 2024-12-09 18:58 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman, Jonathan Corbet, Shuah Khan
Cc: linux-kernel, linux-api, wine-devel, André Almeida,
Wolfram Sang, Arkadiusz Hiler, Peter Zijlstra, Andy Lutomirski,
linux-doc, linux-kselftest, Randy Dunlap, Ingo Molnar,
Will Deacon, Waiman Long, Boqun Feng, Elizabeth Figura
This patch series implements a new char misc driver, /dev/ntsync, which is used
to implement Windows NT synchronization primitives.
NT synchronization primitives are unique in that the wait functions both are
vectored, operate on multiple types of object with different behaviour (mutex,
semaphore, event), and affect the state of the objects they wait on. This model
is not compatible with existing kernel synchronization objects or interfaces,
and therefore the ntsync driver implements its own wait queues and locking.
This patch series is rebased against the "char-misc-next" branch of
gregkh/char-misc.git.
== Background ==
The Wine project emulates the Windows API in user space. One particular part of
that API, namely the NT synchronization primitives, have historically been
implemented via RPC to a dedicated "kernel" process. However, more recent
applications use these APIs more strenuously, and the overhead of RPC has become
a bottleneck.
The NT synchronization APIs are too complex to implement on top of existing
primitives without sacrificing correctness. Certain operations, such as
NtPulseEvent() or the "wait-for-all" mode of NtWaitForMultipleObjects(), require
direct control over the underlying wait queue, and implementing a wait queue
sufficiently robust for Wine in user space is not possible. This proposed
driver, therefore, implements the problematic interfaces directly in the Linux
kernel.
This driver was presented at Linux Plumbers Conference 2023. For those further
interested in the history of synchronization in Wine and past attempts to solve
this problem in user space, a recording of the presentation can be viewed here:
https://www.youtube.com/watch?v=NjU4nyWyhU8
== Performance ==
The performance measurements described below are copied from earlier versions of
the patch set. While some of the code has changed, I do not currently anticipate
that it has changed drastically enough to affect those measurements.
The gain in performance varies wildly depending on the application in question
and the user's hardware. For some games NT synchronization is not a bottleneck
and no change can be observed, but for others frame rate improvements of 50 to
150 percent are not atypical. The following table lists frame rate measurements
from a variety of games on a variety of hardware, taken by users Dmitry
Skvortsov, FuzzyQuils, OnMars, and myself:
Game Upstream ntsync improvement
===========================================================================
Anger Foot 69 99 43%
Call of Juarez 99.8 224.1 125%
Dirt 3 110.6 860.7 678%
Forza Horizon 5 108 160 48%
Lara Croft: Temple of Osiris 141 326 131%
Metro 2033 164.4 199.2 21%
Resident Evil 2 26 77 196%
The Crew 26 51 96%
Tiny Tina's Wonderlands 130 360 177%
Total War Saga: Troy 109 146 34%
===========================================================================
== Patches ==
The intended semantics of the patches are broadly intended to match those of the
corresponding Windows functions. For those not already familiar with the Windows
functions (or their undocumented behaviour), patch 27/28 provides a detailed
specification, and individual patches also include a brief description of the
API they are implementing.
The patches making use of this driver in Wine can be retrieved or browsed here:
https://repo.or.cz/wine/zf.git/shortlog/refs/heads/ntsync5
== Previous versions ==
No changes were made from v5 other than rebasing on top of the 6.13-rc1
char-misc-next tree.
I would like to repeat a question from the last round of review, though. Two
changes were suggested related to API design, which I did not make because the
APIs in question were already released in upstream Linux. However, the driver is
also completely nonfunctional and hidden behind BROKEN, so would this be
acceptable anyway? The changes in question are:
* rename NTSYNC_IOC_SEM_POST to NTSYNC_IOC_SEM_RELEASE (matching the NT
terminology instead of POSIX),
* change object creation ioctls to return the fds directly in the return value
instead of through the args struct. I would also still appreciate a
clarification on the advice in [1], which is why I didn't do this in the first
place.
[1] https://docs.kernel.org/driver-api/ioctl.html#return-code
* Link to v5: https://lore.kernel.org/lkml/20240519202454.1192826-1-zfigura@codeweavers.com/
* Link to v4: https://lore.kernel.org/lkml/20240416010837.333694-1-zfigura@codeweavers.com/
* Link to v3: https://lore.kernel.org/lkml/20240329000621.148791-1-zfigura@codeweavers.com/
* Link to v2: https://lore.kernel.org/lkml/20240219223833.95710-1-zfigura@codeweavers.com/
* Link to v1: https://lore.kernel.org/lkml/20240214233645.9273-1-zfigura@codeweavers.com/
* Link to RFC v2: https://lore.kernel.org/lkml/20240131021356.10322-1-zfigura@codeweavers.com/
* Link to RFC v1: https://lore.kernel.org/lkml/20240124004028.16826-1-zfigura@codeweavers.com/
Elizabeth Figura (28):
ntsync: Introduce NTSYNC_IOC_WAIT_ANY.
ntsync: Introduce NTSYNC_IOC_WAIT_ALL.
ntsync: Introduce NTSYNC_IOC_CREATE_MUTEX.
ntsync: Introduce NTSYNC_IOC_MUTEX_UNLOCK.
ntsync: Introduce NTSYNC_IOC_MUTEX_KILL.
ntsync: Introduce NTSYNC_IOC_CREATE_EVENT.
ntsync: Introduce NTSYNC_IOC_EVENT_SET.
ntsync: Introduce NTSYNC_IOC_EVENT_RESET.
ntsync: Introduce NTSYNC_IOC_EVENT_PULSE.
ntsync: Introduce NTSYNC_IOC_SEM_READ.
ntsync: Introduce NTSYNC_IOC_MUTEX_READ.
ntsync: Introduce NTSYNC_IOC_EVENT_READ.
ntsync: Introduce alertable waits.
selftests: ntsync: Add some tests for semaphore state.
selftests: ntsync: Add some tests for mutex state.
selftests: ntsync: Add some tests for NTSYNC_IOC_WAIT_ANY.
selftests: ntsync: Add some tests for NTSYNC_IOC_WAIT_ALL.
selftests: ntsync: Add some tests for wakeup signaling with
WINESYNC_IOC_WAIT_ANY.
selftests: ntsync: Add some tests for wakeup signaling with
WINESYNC_IOC_WAIT_ALL.
selftests: ntsync: Add some tests for manual-reset event state.
selftests: ntsync: Add some tests for auto-reset event state.
selftests: ntsync: Add some tests for wakeup signaling with events.
selftests: ntsync: Add tests for alertable waits.
selftests: ntsync: Add some tests for wakeup signaling via alerts.
selftests: ntsync: Add a stress test for contended waits.
maintainers: Add an entry for ntsync.
docs: ntsync: Add documentation for the ntsync uAPI.
ntsync: No longer depend on BROKEN.
Documentation/userspace-api/index.rst | 1 +
Documentation/userspace-api/ntsync.rst | 398 +++++
MAINTAINERS | 9 +
drivers/misc/Kconfig | 1 -
drivers/misc/ntsync.c | 989 +++++++++++-
include/uapi/linux/ntsync.h | 39 +
tools/testing/selftests/Makefile | 1 +
.../selftests/drivers/ntsync/.gitignore | 1 +
.../testing/selftests/drivers/ntsync/Makefile | 7 +
tools/testing/selftests/drivers/ntsync/config | 1 +
.../testing/selftests/drivers/ntsync/ntsync.c | 1407 +++++++++++++++++
11 files changed, 2850 insertions(+), 4 deletions(-)
create mode 100644 Documentation/userspace-api/ntsync.rst
create mode 100644 tools/testing/selftests/drivers/ntsync/.gitignore
create mode 100644 tools/testing/selftests/drivers/ntsync/Makefile
create mode 100644 tools/testing/selftests/drivers/ntsync/config
create mode 100644 tools/testing/selftests/drivers/ntsync/ntsync.c
base-commit: cdd30ebb1b9f36159d66f088b61aee264e649d7a
--
2.45.2
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v6 28/28] ntsync: No longer depend on BROKEN.
2024-12-09 18:58 [PATCH v6 00/28] NT synchronization primitive driver Elizabeth Figura
@ 2024-12-09 18:59 ` Elizabeth Figura
2024-12-12 4:52 ` kernel test robot
0 siblings, 1 reply; 4+ messages in thread
From: Elizabeth Figura @ 2024-12-09 18:59 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman, Jonathan Corbet, Shuah Khan
Cc: linux-kernel, linux-api, wine-devel, André Almeida,
Wolfram Sang, Arkadiusz Hiler, Peter Zijlstra, Andy Lutomirski,
linux-doc, linux-kselftest, Randy Dunlap, Ingo Molnar,
Will Deacon, Waiman Long, Boqun Feng, Elizabeth Figura
f5b335dc025cfee90957efa90dc72fada0d5abb4 ("misc: ntsync: mark driver as "broken"
to prevent from building") was committed to avoid the driver being used while
only part of its functionality was released. Since the rest of the functionality
has now been committed, revert this.
Signed-off-by: Elizabeth Figura <zfigura@codeweavers.com>
---
drivers/misc/Kconfig | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 09cbe3f0ab1e..fb772bfe27c3 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -517,7 +517,6 @@ config OPEN_DICE
config NTSYNC
tristate "NT synchronization primitive emulation"
- depends on BROKEN
help
This module provides kernel support for emulation of Windows NT
synchronization primitives. It is not a hardware driver.
--
2.45.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v6 28/28] ntsync: No longer depend on BROKEN.
2024-12-09 18:59 ` [PATCH v6 28/28] ntsync: No longer depend on BROKEN Elizabeth Figura
@ 2024-12-12 4:52 ` kernel test robot
2024-12-12 7:18 ` Arnd Bergmann
0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2024-12-12 4:52 UTC (permalink / raw)
To: Elizabeth Figura, Arnd Bergmann, Greg Kroah-Hartman,
Jonathan Corbet, Shuah Khan
Cc: oe-kbuild-all, linux-kernel, linux-api, wine-devel,
André Almeida, Wolfram Sang, Arkadiusz Hiler, Peter Zijlstra,
Andy Lutomirski, linux-doc, linux-kselftest, Randy Dunlap,
Ingo Molnar, Will Deacon, Waiman Long, Boqun Feng,
Elizabeth Figura
Hi Elizabeth,
kernel test robot noticed the following build errors:
[auto build test ERROR on cdd30ebb1b9f36159d66f088b61aee264e649d7a]
url: https://github.com/intel-lab-lkp/linux/commits/Elizabeth-Figura/ntsync-Introduce-NTSYNC_IOC_WAIT_ANY/20241210-031155
base: cdd30ebb1b9f36159d66f088b61aee264e649d7a
patch link: https://lore.kernel.org/r/20241209185904.507350-29-zfigura%40codeweavers.com
patch subject: [PATCH v6 28/28] ntsync: No longer depend on BROKEN.
config: i386-randconfig-002-20241212 (https://download.01.org/0day-ci/archive/20241212/202412121219.EQhUbN0S-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241212/202412121219.EQhUbN0S-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412121219.EQhUbN0S-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from include/linux/spinlock.h:60,
from include/linux/wait.h:9,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from drivers/misc/ntsync.c:11:
In function 'check_copy_size',
inlined from 'copy_from_user' at include/linux/uaccess.h:207:7,
inlined from 'setup_wait' at drivers/misc/ntsync.c:903:6:
>> include/linux/thread_info.h:259:25: error: call to '__bad_copy_to' declared with attribute error: copy destination size is too small
259 | __bad_copy_to();
| ^~~~~~~~~~~~~~~
vim +/__bad_copy_to +259 include/linux/thread_info.h
b0377fedb652808 Al Viro 2017-06-29 248
9dd819a15162f8f Kees Cook 2019-09-25 249 static __always_inline __must_check bool
b0377fedb652808 Al Viro 2017-06-29 250 check_copy_size(const void *addr, size_t bytes, bool is_source)
b0377fedb652808 Al Viro 2017-06-29 251 {
c80d92fbb67b2c8 Kees Cook 2021-06-17 252 int sz = __builtin_object_size(addr, 0);
b0377fedb652808 Al Viro 2017-06-29 253 if (unlikely(sz >= 0 && sz < bytes)) {
b0377fedb652808 Al Viro 2017-06-29 254 if (!__builtin_constant_p(bytes))
b0377fedb652808 Al Viro 2017-06-29 255 copy_overflow(sz, bytes);
b0377fedb652808 Al Viro 2017-06-29 256 else if (is_source)
b0377fedb652808 Al Viro 2017-06-29 257 __bad_copy_from();
b0377fedb652808 Al Viro 2017-06-29 258 else
b0377fedb652808 Al Viro 2017-06-29 @259 __bad_copy_to();
b0377fedb652808 Al Viro 2017-06-29 260 return false;
b0377fedb652808 Al Viro 2017-06-29 261 }
6d13de1489b6bf5 Kees Cook 2019-12-04 262 if (WARN_ON_ONCE(bytes > INT_MAX))
6d13de1489b6bf5 Kees Cook 2019-12-04 263 return false;
b0377fedb652808 Al Viro 2017-06-29 264 check_object_size(addr, bytes, is_source);
b0377fedb652808 Al Viro 2017-06-29 265 return true;
b0377fedb652808 Al Viro 2017-06-29 266 }
b0377fedb652808 Al Viro 2017-06-29 267
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v6 28/28] ntsync: No longer depend on BROKEN.
2024-12-12 4:52 ` kernel test robot
@ 2024-12-12 7:18 ` Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2024-12-12 7:18 UTC (permalink / raw)
To: kernel test robot, Elizabeth Figura, Greg Kroah-Hartman,
Jonathan Corbet, Shuah Khan
Cc: oe-kbuild-all, linux-kernel, linux-api, wine-devel,
André Almeida, Wolfram Sang, Arkadiusz Hiler, Peter Zijlstra,
Andy Lutomirski, linux-doc, linux-kselftest, Randy Dunlap,
Ingo Molnar, Will Deacon, Waiman Long, Boqun Feng
On Thu, Dec 12, 2024, at 05:52, kernel test robot wrote:
> Hi Elizabeth,
>
> kernel test robot noticed the following build errors:
>
> [auto build test ERROR on cdd30ebb1b9f36159d66f088b61aee264e649d7a]
>
> url:
> https://github.com/intel-lab-lkp/linux/commits/Elizabeth-Figura/ntsync-Introduce-NTSYNC_IOC_WAIT_ANY/20241210-031155
> base: cdd30ebb1b9f36159d66f088b61aee264e649d7a
> All errors (new ones prefixed by >>):
>
> In file included from include/linux/spinlock.h:60,
> from include/linux/wait.h:9,
> from include/linux/wait_bit.h:8,
> from include/linux/fs.h:6,
> from drivers/misc/ntsync.c:11:
> In function 'check_copy_size',
> inlined from 'copy_from_user' at include/linux/uaccess.h:207:7,
> inlined from 'setup_wait' at drivers/misc/ntsync.c:903:6:
>>> include/linux/thread_info.h:259:25: error: call to '__bad_copy_to' declared with attribute error: copy destination size is too small
> 259 | __bad_copy_to();
> | ^~~~~~~~~~~~~~~
I looked up the function from the github URL above and found
int fds[NTSYNC_MAX_WAIT_COUNT + 1];
const __u32 count = args->count;
struct ntsync_q *q;
__u32 total_count;
__u32 i, j;
if (args->pad || (args->flags & ~NTSYNC_WAIT_REALTIME))
return -EINVAL;
if (args->count > NTSYNC_MAX_WAIT_COUNT)
return -EINVAL;
total_count = count;
if (args->alert)
total_count++;
if (copy_from_user(fds, u64_to_user_ptr(args->objs),
array_size(count, sizeof(*fds))))
return -EFAULT;
which looks correct to me, as it has appropriate
range checking on args->count, but I can see how
the warning may be a result of checking 'args->count'
instead of 'count'.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-12-12 7:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-11 22:17 [PATCH v6 28/28] ntsync: No longer depend on BROKEN kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2024-12-09 18:58 [PATCH v6 00/28] NT synchronization primitive driver Elizabeth Figura
2024-12-09 18:59 ` [PATCH v6 28/28] ntsync: No longer depend on BROKEN Elizabeth Figura
2024-12-12 4:52 ` kernel test robot
2024-12-12 7:18 ` Arnd Bergmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.