From patchwork Thu Jul 18 18:27:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kisel X-Patchwork-Id: 13736635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B758C3DA49 for ; Thu, 18 Jul 2024 18:27:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 63B836B0082; Thu, 18 Jul 2024 14:27:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F6306B0085; Thu, 18 Jul 2024 14:27:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4DAA66B0088; Thu, 18 Jul 2024 14:27:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 2A67A6B0082 for ; Thu, 18 Jul 2024 14:27:57 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A0A11A179B for ; Thu, 18 Jul 2024 18:27:56 +0000 (UTC) X-FDA: 82353707352.26.681D76E Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by imf21.hostedemail.com (Postfix) with ESMTP id 075E01C002A for ; Thu, 18 Jul 2024 18:27:54 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=linux.microsoft.com header.s=default header.b=GmwrRovv; spf=pass (imf21.hostedemail.com: domain of romank@linux.microsoft.com designates 13.77.154.182 as permitted sender) smtp.mailfrom=romank@linux.microsoft.com; dmarc=pass (policy=none) header.from=linux.microsoft.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721327254; a=rsa-sha256; cv=none; b=xUhWjPw5WxmSf1kpW7sB5Y1kU1UJkh9iZI3kCnT/+Kldc0k4v4mgH+DyACaUBd6h/Bnhhe T7wjAVlgyzw0Irt2foLyBXUAtwnPkjrbuMMR8mIgeoLGmo5LGefQ6qDledjkWSeyeZAFk/ MQqGTAyxK3nBjtCiB7QQi5MBnFXRpw0= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=linux.microsoft.com header.s=default header.b=GmwrRovv; spf=pass (imf21.hostedemail.com: domain of romank@linux.microsoft.com designates 13.77.154.182 as permitted sender) smtp.mailfrom=romank@linux.microsoft.com; dmarc=pass (policy=none) header.from=linux.microsoft.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721327254; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=tWFTp6/TaiSj5baOvog3g4oCKccEeVRvAgRU79qP/5M=; b=6LLurFB/rj2M7RD3mDTv4ws7CAZ4RdU4JXO9trw6PPnMu0lAyGq2cJWslxbZ59x9wl0LJX VveNe8ws9c9fO9D/h6JFw366EXfQDwWdDd5zDYCvWWd47We03AhyRdWM98yKs5mSlAY33I 0bTXwQcr952WwKosY/aKNpkxJBX8ybo= Received: from xps-8930.corp.microsoft.com (unknown [131.107.160.48]) by linux.microsoft.com (Postfix) with ESMTPSA id 8D90920B7165; Thu, 18 Jul 2024 11:27:53 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8D90920B7165 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1721327273; bh=tWFTp6/TaiSj5baOvog3g4oCKccEeVRvAgRU79qP/5M=; h=From:To:Cc:Subject:Date:From; b=GmwrRovv9Ub2VtlQ6cT3eB7EocZLsWfF5u0DytxzSG0N5d4wVIjA+z3VhnjrNgoOl CW3DPk1VsVokqT8nua+nXyNlcOeuZdeHu4GeEIxlgjKuPgXl3DfUw9uOInyOKUEj77 nZqcPck2AAxC70h9ZPh9aMUCrM1z3R78nHnzRmq4= From: Roman Kisel To: akpm@linux-foundation.org, apais@linux.microsoft.com, ardb@kernel.org, bigeasy@linutronix.de, brauner@kernel.org, ebiederm@xmission.com, jack@suse.cz, keescook@chromium.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, nagvijay@microsoft.com, oleg@redhat.com, tandersen@netflix.com, vincent.whitchurch@axis.com, viro@zeniv.linux.org.uk Cc: apais@microsoft.com, benhill@microsoft.com, ssengar@microsoft.com, sunilmut@microsoft.com, vdso@hexbites.dev Subject: [PATCH v3 0/2] binfmt_elf, coredump: Log the reason of the failed core dumps Date: Thu, 18 Jul 2024 11:27:23 -0700 Message-ID: <20240718182743.1959160-1-romank@linux.microsoft.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Stat-Signature: sx4xjen4fiz8u1zp77wgigok99dpmqrc X-Rspamd-Queue-Id: 075E01C002A X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1721327274-562765 X-HE-Meta: U2FsdGVkX18KLC/hZqyYbWC4h9tsZhlGgek1SppnOMPlQYn6IIrwxy99B34/DKEQDqdZOT4RlJe0eyqTKQlsJNvayyaWB5jsdh7VNhEV5iFt05WW3kg7mvaKUJp+rXHV+ijPNbrz8Y7woWAcO76Yu9mEVGQm8HtPAZ8degBNLTdg0cP4o2xTNBel9Q7WaKPvMzHQh2fsajhrBMG++XdsPyzBsownwVrz8dcJJdw8DTb+j5T5jDexZBkMS+QMHo+m1LkB5OOYIdtrCglMd9dJmRVXWonL6RVVFuO2uk0iGu/S1i79FY8/VuEQQr/DEE/xd75qAr8X7AIxmz2gFwVntfHXL4dhJODrwyb5pubVAmqetXJ6DS8SK6W1KZFFFIzaqCQ3MkU5I3ytL/r1UzCJ9/9hlcUuS+4/oO2sjoJKNo+ggiRHwAcRitPLUD5Y6pWWeuWzoJxMT2NUec7sIHHqn7VL82NCaefketyLQAupQM1UsGyfqjrCrKHdg4iolxvLYHFgYpyxN8fmDFwWgZ7S56ESPg4FyKRCqOQ+dhFejoAY3MnCVIuIZwjCBHZzTruCEX/j11GDfW9yrGIhCwV3OPhvi43l9yH1ZaKs2ElHXGmpozD5piL0gEFiN0kQkRB5y3LkdXPka1xoB2GnhwzjTqMuobzJfipzAVFw5JJfHXZV6581HWf8JNQ/1UDpeLkE5QbTBR/56xEjFvb8tjPMh8b++nUjGZKMt5diIXptWketThF3ZDbII8U7UbB1FluNXSb3euv7eVWUNdKpcPgA85mw8elwx44v38JVeI/aFmHlmoloHLLLSZg2w6KvV+AvQcnFoGQgGuPfN1N5miFARE7z97GrpHjvwN3j5AWyuRJqtOqgmooLwGBjGub+KxaG/WLN2F/NAsQz437ZEf00+J7YLiPEvE+aFu4y/EEf/FhNu+wyX18RukDMScAWMktXCrOdF4QRHDsA0JFTmsv JzmNeQDp WxZM/qq/ZxmCNdI4PzkZS7wPomJvkKXyvx/HVL8sJT+Xjr6n6xxZdCADFADjLVgZ+E6PDblImctb9M1sWWv5jscT+Oi2QxTM/baVHzguBtXCoZlK/N0FbInWV46moT1baL6oUJGD7TUJEQIji2kYRnkPWOvzhHIX401A3e6f271RLBxu/Ycmy6g/dRVNPml2zJti/q194GbQqnbmO3X9EUQxCeTm5FOmr15VJ6t2ruvccm10Yyc2+GnK5qo8KncOKM8k3hRwGTTV0eggVH+ESPce4TYoMCa/WOm9A8U4I9W1nUj/qymscgQjdLWM3cocq4iSnoHQS2FA/dMWLDGKsNXI6QXwMOEyD3nqtoEGLCMDddD+1oS3s9aW9CA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: A powerful way to diagnose crashes is to analyze the core dump produced upon the failure. Missing or malformed core dump files hinder these investigations. I'd like to propose changes that add logging as to why the kernel would not finish writing out the core dump file. To help in diagnosing the user mode helper not writing out the entire coredump contents, the changes also log short statistics on the dump collection. I'd advocate for keeping this at the info level on these grounds. For validation, I built the kernel and a simple user space to exercize the new code. [V3] - Standartized the existing logging to report TGID and comm consistently - Fixed compiler warnings for the 32-bit systems (used %zd in the format strings) [V2] https://lore.kernel.org/all/20240712215223.605363-1-romank@linux.microsoft.com/ - Used _ratelimited to avoid spamming the system log - Added comm and PID to the log messages - Added logging to the failure paths in dump_interrupted, dump_skip, and dump_emit - Fixed compiler warnings produced when CONFIG_COREDUMP is disabled [V1] https://lore.kernel.org/all/20240617234133.1167523-1-romank@linux.microsoft.com/ Roman Kisel (2): coredump: Standartize and fix logging binfmt_elf, coredump: Log the reason of the failed core dumps fs/binfmt_elf.c | 48 +++++++++---- fs/coredump.c | 150 +++++++++++++++++++++++++++------------ include/linux/coredump.h | 30 +++++++- kernel/signal.c | 21 +++++- 4 files changed, 188 insertions(+), 61 deletions(-) base-commit: 831bcbcead6668ebf20b64fdb27518f1362ace3a