From nobody Wed Dec 17 04:00:31 2025 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 96F94331A65 for ; Mon, 15 Dec 2025 08:47:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765788471; cv=none; b=svyHBba58U8M4PvdJjWCbC5thCiehztCGcqJ3NkV6srXKntpZEnaGUWMn2jiAKf80yHAnsZIli735Mbbe03Yc0FKxEbroht1gxYkF9Lk7NE2gGpD1ze+oW+RtQoTxnShXu0TKOpb61xaZeFPemDBIWK8wIdMdO9j9D57+YzPa3M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765788471; c=relaxed/simple; bh=ntbk0Qg64mB+eRdow45mqcltJofKTd87yIfqFj6CdOc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bquKCwu5u0MVVYwQK94znCNGvmRHAMlTCuqE4IIDfSjNyvgSndnidnPgP6fpAVIP9SZbJqtMT5yEJi5ay6fxYhC41JAW6nFVSysIf/tIjsvVsSOxy4ARtGrMnqvNJgbcSUiMekd1V8zmI6El+A0FHHBOe0pHNkWMhPGFZLFwNWs= 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=DKXDGl3U; arc=none smtp.client-ip=209.85.214.175 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="DKXDGl3U" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2a07f8dd9cdso18040155ad.1 for ; Mon, 15 Dec 2025 00:47:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765788466; x=1766393266; 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=DKXDGl3ULK1MRRz7LvDLYS2QLxz25vmPAD+Oau0Dfs2njPIN9vPSoLtAkaXLx8kCeY 4cxtgtdCfXiPYaNpohD4P0FYO0Z+GCozgTzeRWY5MiN925srmWukHzQM6BeJEU/Bbl27 RLIIO+B/9gqeFht6PiNRu/EUTHodyAam8rIyKUO8VctuzZRK73sl2PmOwuvPuKYSAlcx k2PUF2n/7LdASaLfwW0KiYIwa5kKcP5PpkhdH4f6eOwA50NN1Aev9XjR5jOd4trH7u9e LDjg6Wriu+gkPN42/YQN0yyK0u+phxsXg+5d47LLEjVaUeGcPtz4RaI2V0rQgWPai2EI gduQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765788466; x=1766393266; 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=CvfqdWc/zeelfl5B0hM8Yirqd+hOl6rxaYEltjWWDIFE9tLJSIqrQjk/IGlIvG+VWn ttc60Nc8vCmaKO88PEkfFnUPDD8mD9Em72p3iFdGxySrw85csYlfE266w5LweiSVZCgc Nzyhvnl2wtzVs/ZNPFOEzf1do69UcY7txzY6gInvxDF98YW3WRPRefe8lB2UdsY3kZ7e xj8EoA8OU396GCtJfOV5zTi54Y7Co9cJWd6c/Dzhm/tNGBDBEgHHzTa/pPcuWUjh05IM qrpaUnjEGrGvPBWweCvA1gI29X5zXw+wqwNLbCLbmRRkomyfZvSvTpb7E3jZWClO3SVB o3yg== X-Forwarded-Encrypted: i=1; AJvYcCVq4xIKNfuX/+rkQjuT2gZYWv8CP5yx4NHJDlXnctcV/e1fK8VW5QWf0HKlG95ZSoyL8UnSe74tnYeWiQI=@vger.kernel.org X-Gm-Message-State: AOJu0YzmPJCguAzK5lOfZGMPHhDESDNVuZwiz5Yk6dIm6rQNGrRQFuRI Myim9wrFcRgP8S5MKQ5dI1IsdQLaqGbPNsTqDU2x8TS8K2dZX4nkeRR/7AmLAA== X-Gm-Gg: AY/fxX4yGBGKlg+fdHJ+YFMwEi2w9JSYQgaAYoD1kcGZHuWL6yHHV6lfNcw0/ohcDr7 VWWOyvU5Omh58C40/dr6SOrgZH/zjyDDKBvAD10I4o8kdlhRFenVst4X8M0h/+3ZWm8KDjFAyG/ boBclqCcrJNDWYPIaLLUcDn456s5rre9gmxDA6OcnGi8AQ7lgzsZc+hAxaIuIuUFB2mEw+451pG 3hfS8AaMRDoB3eljzOzbO/feHThtULgmfo6o5mnYhDfGPn2/UdNN9O3W23JtAaIElqxSJNJAidl KJQBgp9UqXE8XbNcteV3yfV14FCz6mJWZhTy+YFOW2Z2jTLHQ3JLjVjZgIIh6D+UvgXs2YY7D2G LpBy2TlNRsrMyflz59Nua9EF2Bfipgi/VPgZpot8QrLVKwhzWKHy3H0g28agj3rqUOdj1cjDbRq OM9aVC7/4Crx/cmZlJabilj1/X8FbeJA2ebeY= X-Google-Smtp-Source: AGHT+IEPumXAp9HZLmoAIfnYbxYk6w+/T3dU7w+yjiyvqFmWqDIigTjRbVkztYzivR4UDHXsX7nkpA== X-Received: by 2002:a17:903:1109:b0:295:a1a5:bb0f with SMTP id d9443c01a7336-29f23e1e3f4mr96736705ad.18.1765788465873; Mon, 15 Dec 2025 00:47:45 -0800 (PST) Received: from clint-ThinkPad-L14-Gen-2.. ([110.226.180.190]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29eea06b49csm127573265ad.95.2025.12.15.00.47.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Dec 2025 00:47:45 -0800 (PST) From: Clint George To: skhan@linuxfoundation.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, david.hunter.linux@gmail.com, linux-kernel-mentees@lists.linux.dev, khalid@kernel.org, Clint George Subject: [PATCH] kselftest/coredump: use __builtin_trap() instead of null pointer Date: Mon, 15 Dec 2025 14:17:37 +0530 Message-ID: <20251215084737.7504-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