From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA5D62C1586 for ; Fri, 5 Jun 2026 18:47:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780685236; cv=none; b=Q/iLnRk0hHKS/MBcCFCGLQb9gYuDpU24yXYDp1k++HPvxwrKqg8E6ZvyVkng6oZMdyGhFz91uoudPPGQByWOMjlMhJMa8KzkZrQ236pBGQma3sfnBlEKYD6G0vx1sWa/PzihIAeg5x4Vi6ZRY8mlkMnJ2XSD0UiA8Goz7w4n8Ic= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780685236; c=relaxed/simple; bh=hh2fxulvbeP3VLqzPB8TzOEMWV0XnFlu6zRLYgMqGMk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=aIfLQlmiP394EKWTRbGGaIuB27WWSqwiApA1RYBiyVnZkeA34HLUS9HFtsWqgX1LBNfy4Ozt2B6WQP1JYKyzXjBePg1pWmpTTqkxxGSrZxLs2ir8mZSCqsbqhXyPtlU0851Nh23L4/4BnP2QTfNtuptGy8Eu6H0hgLEGU71SeYQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=trailofbits.com; spf=pass smtp.mailfrom=trailofbits.com; dkim=pass (2048-bit key) header.d=trailofbits.com header.i=@trailofbits.com header.b=eqrA+og2; arc=none smtp.client-ip=209.85.222.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=trailofbits.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=trailofbits.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=trailofbits.com header.i=@trailofbits.com header.b="eqrA+og2" Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-915906a4becso265019685a.2 for ; Fri, 05 Jun 2026 11:47:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trailofbits.com; s=google; t=1780685234; x=1781290034; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/+S2kWEshBEYxE+NdQGsuy2b/BvshYmz+oEVLgRMUss=; b=eqrA+og2dUL8MihOw6szF5oav20ngMCtJInk/Xa6y+DZ++AuCc2LC+jZdiPJM+yu8x dx3lvYylgZivc342EYJE6fCGeWNOJvYp5BTrmxo8SPSe+r+ENuQEDa/pAdgioZHDlKoq OVsNjLtpjdxyViBKX8b8hyjCbyHMepRHeJEwhoB0e1brVXNRH5c384SNG9pTRR2BZAMb ExWRn0jBk3wEcDPlMhxxiZpemr/dyawl5G+TNFyO5nR5VcL6KafnM9Cbj1sFpoy+OUb1 A1ESPrnBUJlFvtndy3fAXf06MfmQooxFJSh+8cUH8h3VyZ2YpUydllcBvpcMGmLJEAZs PF9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780685234; x=1781290034; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/+S2kWEshBEYxE+NdQGsuy2b/BvshYmz+oEVLgRMUss=; b=n5qfKAQGQLAB6wIc5gwhXT0vwXIZ5Fnd4zJKTuVhKPvlH8kUijgAmhCtFK5ZJnDtpq JGK1PRegUwE4LVx1Zbr526ClX/Hnbxqvda3F/tRrNMlcUIelxHuWKe8uTbAluF6r8/io coapYCjN/EX2zTSnArFfrfzd7HvoYhTmRHQjUOPUjbSqVet43Gzrhnhu3LiTNa9qJ0F1 cLqcfqRCfmr9jov4XxmK0rkdvd2xeXswCZlvyHsd9r38HPKQdkszY7iUoN4KdvOod3dD f+apZc73klkFK/RmgJrDeLf/ImZQmjcSAvWJyWWG/57PycDLUodNL7HgI4PN8FiUEdym 6oNw== X-Forwarded-Encrypted: i=1; AFNElJ/SQRwbw7O1/ldgFyuqQTRMj/x8DyYTNMOW/fENi4U+Hlezdwzx0r/0UnD8I/QIsh32EUOqBRMp2ntqUz8=@vger.kernel.org X-Gm-Message-State: AOJu0YyK6k1rc+IW3diXQL0cbjTnzsEpszNl82zBfjTpsviH4JXi3oBT PR56xR6KEvq7bGAvSCqW6frpnuXTlAYeTOMIqdIpOKmtUglR8Y5ximVq8o8muzJtNzfcgBA/Z5e I/4IIv/4= X-Gm-Gg: Acq92OHE2S7t6dfcbBMCsNMNcCnZpCXgX4+0LQOUBZvt9U0YMIHzN6X5J8FOtgCbGpG TkD+NcrYNk0gFDrATsmKmRsd4KaRq/Lenk99uHQaNTOJob5oYi9v4vNqdHDv3J4o6Qp5UK6FXIm Uqvd9lE5kf+FfFZ8DgiQghjS0d7uH+U8J4MxSiFQXSFsvIyL6YDQdpIpVdNve9tMhzxkT2fmOM7 mq87o6BYECQ2Fd6Zc3M6klk5L+QmDMvx8gfMzrWuPZo90wJQoVYRex2xy0FERrIu4TEA6Fz5gE+ eXwDoV+JOIFu3NuxNr+Shzu4pWIqqSp4umO0E49/kpl3sZlv8Ad8OAFlPkPqTIHDA5+Y3jON2Ps U8GK+my5whqYZbhGDqoFRqx3gMd6j7vHvF1eAyzK0lCrx7oFROAOxMuRtI7kV9bxW2VrIaJJ1s5 K+xjSTOXgAeglCOo/Sk+4puJE96cdm/cYFg6IiyQ== X-Received: by 2002:a05:620a:29c3:b0:915:75ba:179e with SMTP id af79cd13be357-915a9da93d0mr897537085a.30.1780685233948; Fri, 05 Jun 2026 11:47:13 -0700 (PDT) Received: from localhost ([161.35.96.86]) by smtp.gmail.com with UTF8SMTPSA id af79cd13be357-9158a381abfsm981175085a.27.2026.06.05.11.47.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Jun 2026 11:47:13 -0700 (PDT) From: Samuel Moelius To: Davidlohr Bueso Cc: Samuel Moelius , "Paul E. McKenney" , Josh Triplett , linux-kernel@vger.kernel.org (open list:TORTURE-TEST MODULES) Subject: [PATCH] locking/locktorture: reject zero resolved worker threads Date: Fri, 5 Jun 2026 18:47:05 +0000 Message-ID: <20260605184705.2490765-1-sam.moelius@trailofbits.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit locktorture checks for a zero-worker configuration before it resolves the default reader count. For reader-capable lock types, a user can pass nwriters_stress=0 and leave nreaders_stress at its default -1. This bypasses the early check, then derives the default real reader count from the real writer count, leaving both resolved counts at zero. The module can then load successfully, optionally creating helper threads such as the stats thread, but no lock-torture worker threads. Reject the resolved zero-worker state after reader defaults have been applied. Assisted-by: Codex:gpt-5.5-cyber-preview Signed-off-by: Samuel Moelius --- kernel/locking/locktorture.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c index e618bcf75e2d..7d553ecd3fab 100644 --- a/kernel/locking/locktorture.c +++ b/kernel/locking/locktorture.c @@ -1320,6 +1320,13 @@ static int __init lock_torture_init(void) cxt.nrealreaders_stress = cxt.nrealwriters_stress; } + if (cxt.nrealwriters_stress == 0 && + cxt.nrealreaders_stress == 0) { + pr_alert("lock-torture: must run at least one locking thread\n"); + firsterr = -EINVAL; + goto unwind; + } + if (nreaders_stress) { cxt.lrsa = kmalloc_objs(*cxt.lrsa, cxt.nrealreaders_stress); -- 2.43.0