From nobody Sat Feb 7 16:39:26 2026 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 64C22340DA1 for ; Tue, 16 Dec 2025 11:31:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765884694; cv=none; b=rBghjYCUbkEgE0kPoyokbIY6ALjhT9+ZlBjTytxpZ9yRPFOvoOm3bfskdmdnkJbyUsPF72JJb1o/KiK5jBh5uQjUKFa6nz9K/M17BYUffG4DwzsHuXcQgjaHkWbbpqu70aAqYIS/L3wUXZ0D4sf5ZWWWbhuoODRvLgAT2MODxRg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765884694; c=relaxed/simple; bh=ntbk0Qg64mB+eRdow45mqcltJofKTd87yIfqFj6CdOc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=AsmrhN9+PH2dh8ZxFGo6WPDPHwJ0Xs+RLCr5NUhHVY0IoXMaq55ipzbFu6E1B3FhnTjr7AvmP8CpAJ4/acSyt0sDmfbJEeuAw1g3IZBss63jPi19gkAleNf8Bt7nhXMaxMp7tvGoSkYZwHJe1m7SfqK2wMY0THD4WOm4oEWnFXk= 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=cbIDB6Au; arc=none smtp.client-ip=209.85.214.173 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="cbIDB6Au" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2a0d5c365ceso30158825ad.3 for ; Tue, 16 Dec 2025 03:31:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765884693; x=1766489493; 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=KPjuXZ4/6Ll8iE3Rz28AaFI0svhctDC7vgBQffR8h0U=; b=cbIDB6Aurdo6Qg7jy2rnK0HXpv01qQ+S0FkbLynBIJOAZBf4yQT6qtsiWqe2LcQwqX jDlwmyMXYjhdlwLZ1avjPiSBPEpel9b7dG4cjcsk7BmVrAKaXo3fr4XHczCx+JaO8t5j m4k8fc2oE/Zjn+t+m+wDDXWdD3q6WB9fre4WKsBA7i0Xuq3IxzbEOXj56CViDdiJe4ms N/XU3CtT2WW+20AelN1iXrm0Xtd+0d6AQ9rXNxVOcNx88lZh4dRf2p0uxB+YeDHHln4K mltZ2r4LfEJxxBUUcjwcycnncptdQjUduMqw506STKED0pH+5t5wdrA2ZRWqFvzlwx18 mFbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765884693; x=1766489493; 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=KPjuXZ4/6Ll8iE3Rz28AaFI0svhctDC7vgBQffR8h0U=; b=Bf0q3KYxGXlKeCNeXkK97jap4K3Ziqf6ArovKqYyWXhpnDRuA+9oXzXU7iIqZ13VFR UnjsYECO4nL49zqbMQNvFByjSJFBO4FjoNOYjnUm6cpYEIdpapbl+3+CRSW38dWWJCfD lCJHbczB+XDXJM6ZzACC2CToKDMxZWv5bP3n6pgOXHaeLR4l0sprv5pk3DBSypkxggYI AMSPD9mI7CjLz9E97rRIxfkAof4tr/7w3clintXsbfEj38JEFz3b0KiaE+Z8yrcUNlHj cnrGOU3Dl5k3eG9AisVReZGC46O0imuH4FGtOGz5LyULcVCZ6/dNH8AqlIYPx8QjaZRI Z7Ow== X-Forwarded-Encrypted: i=1; AJvYcCXR6YO6A+7pMAqeOZi3vUWpC/hq8KFJliL7DHEFKmg/eJgOwU0Tqj75BvdnE2sgdGg2AXQ/ZqHuAB53i4o=@vger.kernel.org X-Gm-Message-State: AOJu0YzyWytyfSeplGgXFgQWSa8yrLvlMstwumqVVGzNsSfu0pWEnK9L vTNFn49oFvJfmvYypAL6vhqJ1J7jv340mPZHRiaQNLmTRo2ydAL5n3g7 X-Gm-Gg: AY/fxX5zcTPK3VBhBhBSc7yaeRR6rDhnxaQZV6Qh2Ash8vNDTYDn9NqunAEZXw5ijxp g9q0uknmuAL8/Rp8y80lqizJGDNRiqxUpjF5fvDDZX4EDW1gEKaliFD65jlvUMifl+o2KKWAc84 vENFvaKYeUXd2mB6o7b6SG5AI+PUy9IGQOirrGn/YIFUGY0TrFJzcxKMu/uFPjk3po2JZzMeTrE fyWiSyQ8oIeFU1B74n3R67lF08PfJm25BA11tKMZVOji/9Ba8KDhJMveipCi6xSeCVyYM1mFyPj 9RrlNiCGdCGp1u8w6gAlhcO3ElLRm2pWBNQpwO3GkuducSEFyIMPN/LMUCfi55UEXdnk9SIZ7aw 0Lu5BV/fbcHzCafXQa4mc0m5xgqN6lf+/b/Z5SCkOrXvO4DG/+8uAFav+exmRIkIWt4kUQQHKYr pXSNYUxEYDlT2NI7gZEoHen729E647ex20t40= X-Google-Smtp-Source: AGHT+IErSHd7LCl7veNUggNMiOy8RjvXrn1zvEt+0F4+GSG9YkcBPanzUna8QSO4lmk0MrToIVu23w== X-Received: by 2002:a17:903:3b87:b0:2a0:97be:61a5 with SMTP id d9443c01a7336-2a097be6581mr101276985ad.3.1765884692481; Tue, 16 Dec 2025 03:31:32 -0800 (PST) Received: from clint-ThinkPad-L14-Gen-2.. ([110.226.180.190]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7f7f6900949sm8620678b3a.29.2025.12.16.03.31.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Dec 2025 03:31:32 -0800 (PST) From: Clint George To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, david.hunter.linux@gmail.com, linux-kernel-mentees@lists.linux.dev, skhan@linuxfoundation.org, khalid@kernel.org, Clint George Subject: [PATCH] kselftest/coredump: use __builtin_trap() instead of null pointer Date: Tue, 16 Dec 2025 17:01:24 +0530 Message-ID: <20251216113124.4150-1-clintbgeorge@gmail.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: quoted-printable Content-Type: text/plain; charset="utf-8" Use __builtin_trap() to truly crash the program instead of dereferencing null pointer which may be optimized by the compiler preventing the crash from occurring Signed-off-by: Clint George --- [] Testing: The diff between before and after of running the kselftest test of the module shows no regression on system with x86 architecture Let me know if any more testing is needed to be done [] Error log: ~/Desktop/kernel-dev/linux-v1/tools/testing/selftests/coredump$ make LLVM= =3D1 W=3D1 CC stackdump_test coredump_test_helpers.c:59:6: warning: indirection of non-volatile null poi= nter will be deleted, not trap [-Wnull-dereference] 59 | i =3D *(int *)NULL; | ^~~~~~~~~~~~ coredump_test_helpers.c:59:6: note: consider using __builtin_trap() or qual= ifying pointer with 'volatile' 1 warning generated. CC coredump_socket_test coredump_test_helpers.c:59:6: warning: indirection of non-volatile null poi= nter will be deleted, not trap [-Wnull-dereference] 59 | i =3D *(int *)NULL; | ^~~~~~~~~~~~ coredump_test_helpers.c:59:6: note: consider using __builtin_trap() or qual= ifying pointer with 'volatile' 1 warning generated. CC coredump_socket_protocol_test coredump_test_helpers.c:59:6: warning: indirection of non-volatile null poi= nter will be deleted, not trap [-Wnull-dereference] 59 | i =3D *(int *)NULL; | ^~~~~~~~~~~~ coredump_test_helpers.c:59:6: note: consider using __builtin_trap() or qual= ifying pointer with 'volatile' 1 warning generated. tools/testing/selftests/coredump/coredump_test_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/coredump/coredump_test_helpers.c b/too= ls/testing/selftests/coredump/coredump_test_helpers.c index a6f6d5f2a..5c8adee63 100644 --- a/tools/testing/selftests/coredump/coredump_test_helpers.c +++ b/tools/testing/selftests/coredump/coredump_test_helpers.c @@ -56,7 +56,7 @@ void crashing_child(void) pthread_create(&thread, NULL, do_nothing, NULL); =20 /* crash on purpose */ - i =3D *(int *)NULL; + __builtin_trap(); } =20 int create_detached_tmpfs(void) --=20 2.43.0