From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa2-f12.google.com (mail-oa2-f12.google.com [74.125.231.76]) (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 07DF457EDA7 for ; Wed, 23 Sep 2026 20:56:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.76 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790196989; cv=none; b=YNIn5aUvy+Wk4FHs0HATFE9ZAbW93lMafV8m4T6UPyrazF7zoli7HIDUNt6bGtrO9QleccHTqhrstzchgyNps1xuaJSh2XvcAHW55NjYiCr9nUOSrujaPF800G5HlNTW6Jql5LP8v7CIDhQ4olx8uar6nmWxrZs5+NIR7+8e6xc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790196989; c=relaxed/simple; bh=KoXj6lDz/zEBfEDePNaRooRZZ1oXmLqh7Vi2llPxlvI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oiPkIAWsCvLD5qQtB3zlLlIZN0wTFVBUOuIM5e+2goUWUFBaBxmDcHeTpFPhCudkDaCSfRrP+Nmd1RMMz2moOJxAAPJQdTV9CXNnmkCsFQixVetD/Gd8pFViynpqTFhYiKRwqsTsYkm0gCOdQ3ubYgJ3uQC1jM7J/u61OylR6BA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fqwLqlw6; arc=none smtp.client-ip=74.125.231.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fqwLqlw6" Received: by mail-oa2-f12.google.com with SMTP id 586e51a60fabf-46dae65dc5cso714321fac.1 for ; Wed, 23 Sep 2026 13:56:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790196986; x=1790801786; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=bEO8AN5y0124ULpZTldBK8ZJ7R24pfDL+mJFB6JEsyI=; b=fqwLqlw6d03aME8cU8AmS5XrMcGsj5tF/xzaSYCrAyY5H2efou4ii7em5vceKC2bFT qsm6ag6iTvXLPKPf+EfX87N60/w6hwi/47psV36isZegpRgZlW4YlNb+JymVcG9uW2L8 +BIH98YrZ2DmA8SflRP28V23sHBApbPXXov3PrU6v+VlVbBjXLHFhB+AP1ApU5WDBdMm 0umZJmqEYgvCxGdKaxtMEu20mNWotX69GPc9pI4p8PVPJoyORZ6r3KeNG0rL4RlUYJzj wsIMFV+GeEUO4Uw0lQZo8K1DG02jF4KFdw2fuXhrAWPJLIGHLYXFeiSKRkYIU8tyoyHI XR8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790196986; x=1790801786; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=bEO8AN5y0124ULpZTldBK8ZJ7R24pfDL+mJFB6JEsyI=; b=DgHYeBfPl3WutffXOo5HEClTW0ODtsu2fAItJBUbXdu8IdUgaFwBDxA4NoNBeZb3sF p6Z5MUQ/X0yGO29ZpjfGPTx9luK5BKB7CHfiPUlO28jxPH/h8Jna30mnMJGeIyuPyURw Fkq1/nO87c6wO9vOxRysBkuVxlWio1VT38vjir/jqVKPLjefz7KqlKVGlg6HjvokdjCf K8fzrhB/r3i48amlmR6XZBYTIiVbqpQAg4ROBiAow0Bz9sbMhtAiXHoyJj71yGI6lEdG PE+bR4XSkdPOCZfFluLPz4rQ2SSAcbAcqn3xfYJ4UhAv6FOxWYPA1d/ZDxpWijE3Gi0h 3e1A== X-Forwarded-Encrypted: i=1; AKwUvBxVqPrLKgdR59E39VnQr1COkWeOZbVCMJm2d3jcRH0ibKQQnBwBCKhKMGxogLJWX7n4eGimeeDUdPBEyDk=@vger.kernel.org X-Gm-Message-State: AFuF++krsBXFAYGcxfE1aQJ6/+zJG29SbLmlTk3MTdO3u0LXYoaLEkHL ja0b2ZW9NTmzJGkn5LbcbsDpnMFGvDr93HDPKthb03K4CZ1REsnOsFcJMjUIHCf1 X-Gm-Gg: AYBFou0r2jeRH6Vi7vgssWhKTMmaVHZt543QmkiG5t/Wk38ZcS1A8xduXUTBieYv3mX 9N4ql5UeKX6QZv8SWl2p9BHaHSUSUttAKGD+AdMwSUwAHVpFzwqW+Rxa8EP23rmVi/lJ+FEq7JF ybA44bG4JH7JZAc1KNqCNLBaTT6BoR1XABRWeebVMm900IxYY73hKlDemFt75OtptKrnVIAsmzk aOOI9Sb78gNnJdgvgrU5vCFPoJ8KuL65DQu11y7R89weoZFBR3h4DSjck2BD6d1Ah9dN0iImkbz eQe/dZ7fGr9gLT13FFjYERWyfP2cMN0lgv7ViPS8Zr4JBVkbHPPhWHY2SCYVa13rdAEhw49kbqc gT8GWz7D4lM/nplEVtPZb2Aoyxiy1jSv1wWTYAG07zmcG8xrE0004deZWnZ/udt+vgyRiQkUNGI 7tH+zjwleeDW/BNH7Xi9MUweXwRhwJEdQ6F7fJsZyr5rT8vmY4RRtUcxG0/erUOHERbIAkjyAc3 HEhp5s64X+bLp34nS1VEe3BCFohZWmIn1ulP+EA X-Received: by 2002:a05:6808:159b:b0:4d6:9293:9b53 with SMTP id 5614622812f47-4d72ef56171mr358627b6e.59.1790196985628; Wed, 23 Sep 2026 13:56:25 -0700 (PDT) Received: from archlinux.lan ([136.34.156.120]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-81603ad0f20sm4498893a34.9.2026.09.23.13.56.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2026 13:56:25 -0700 (PDT) From: Danish Khateeb To: Willy Tarreau , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Danish Khateeb , stable@vger.kernel.org Subject: [PATCH 1/2] tools/nolibc: fix WIFSIGNALED() for status 0 Date: Wed, 23 Sep 2026 15:56:21 -0500 Message-ID: <20260923205622.1123270-2-danishkhateeb03@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260923205622.1123270-1-danishkhateeb03@gmail.com> References: <20260923205622.1123270-1-danishkhateeb03@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit WIFSIGNALED() needs the subtraction to wrap around for status 0, so that only 1 to 0xff, a terminating signal with or without the core dump flag, pass the check. But status is an int, and 0 - 1 is -1, which is less than 0xff. A child that exits with 0 is therefore reported as both exited and killed, and a caller that tests WIFSIGNALED() first sees "killed by signal 0". Make the subtraction unsigned, as musl does in the same macro. Fixes: 8c934d4822c7 ("tools/nolibc: add helpers for wait() signal exits") Cc: stable@vger.kernel.org # v6.4+ Assisted-by: LLM Signed-off-by: Danish Khateeb --- tools/include/nolibc/types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/include/nolibc/types.h b/tools/include/nolibc/types.h index 8f3cb18df7f1..4373bd8a5b5f 100644 --- a/tools/include/nolibc/types.h +++ b/tools/include/nolibc/types.h @@ -119,7 +119,7 @@ struct timeval { #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) #define WIFEXITED(status) (((status) & 0x7f) == 0) #define WTERMSIG(status) ((status) & 0x7f) -#define WIFSIGNALED(status) ((status) - 1 < 0xff) +#define WIFSIGNALED(status) ((status) - 1U < 0xff) /* standard exit() codes */ #define EXIT_SUCCESS 0 -- 2.55.0