From mboxrd@z Thu Jan 1 00:00:00 1970 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 7FD15C3DA5D for ; Fri, 19 Jul 2024 17:27:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EDF076B0093; Fri, 19 Jul 2024 13:26:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E681E6B0095; Fri, 19 Jul 2024 13:26:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D132D6B0096; Fri, 19 Jul 2024 13:26:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id B2AFE6B0093 for ; Fri, 19 Jul 2024 13:26:59 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 209A3808AA for ; Fri, 19 Jul 2024 17:26:59 +0000 (UTC) X-FDA: 82357182558.07.10EEC98 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf19.hostedemail.com (Postfix) with ESMTP id 14C711A0013 for ; Fri, 19 Jul 2024 17:26:56 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=MfEik9J9; spf=pass (imf19.hostedemail.com: domain of kees@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=kees@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721409961; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=uIBZ9dfAOL/2Ax29cP4ywxZjE4iT5TEBFn2OIOeo+qw=; b=HQxGavJZ8uRVfWDbRIF6jngAK0g4Y4tyFw1La0MVotXECdWg+PhCudkg/qNSGq0cd1o8/f qORZed54YqN9/CegfhcqW0mnvwZaI5m+IXPRQ9M/W+w9GJSjDQ8oOP/cnctP8LtRANlLID TbjOEPGTjTXV3TxpNiq9G9WBd+8qfj4= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=MfEik9J9; spf=pass (imf19.hostedemail.com: domain of kees@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=kees@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721409961; a=rsa-sha256; cv=none; b=wfKwgwYST8zg71V0VUDXpFfvEycNp6iNwo12i72zOoSsYtmptkqmJBcOlaPo6B+7P7RMxg g7twEI/eDnP2lmZ3exNWu18AlUJpEVL6r9xhCoKeadkBVLFg+oEIe8ANYEhcrRkrOMl9Lr ZSsKJAhDrnllSq2OOImK4yxAQCQ9+0Y= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id D5510CE0B2A; Fri, 19 Jul 2024 17:26:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18EE5C4AF0D; Fri, 19 Jul 2024 17:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721410012; bh=H+l5OYKqTBpbRG/P3+uUyAn1lNznpqV4QTSBbCnLoS8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MfEik9J9NYVFgokBAzi5t+13fh2eOTXDuBAgdWbjVjgVEibBQLr3uZb+iXJVUuFjc LSs4gG9l07jY/JjB/NeihAtqW9OsTh76hB7gyMQuEb4uGsK4izs4rQrq9t/Mln58of EHyUlkxXxDOgCfhVximKv+uSxG0D4n5f1t0XaL8mWsvNtXqbPoDgQs6cv+Skr09rg2 W+jpFshQGcBxYGa8u8ws8SQbedCYVCcBl43UYBI7jGcaqPnAN1bbxmJgh2VG1bg2PZ H7eWS3pjWX9+iv7VV74OSKpi+ruKUH3L0bdMDLDtKAVMzFnN7uGvsOgt0glDUNtFg5 K4JWSBN/Yz+QQ== Date: Fri, 19 Jul 2024 10:26:51 -0700 From: Kees Cook To: Roman Kisel Cc: akpm@linux-foundation.org, apais@linux.microsoft.com, ardb@kernel.org, bigeasy@linutronix.de, brauner@kernel.org, ebiederm@xmission.com, jack@suse.cz, 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, apais@microsoft.com, benhill@microsoft.com, ssengar@microsoft.com, sunilmut@microsoft.com, vdso@hexbites.dev Subject: Re: [PATCH v3 0/2] binfmt_elf, coredump: Log the reason of the failed core dumps Message-ID: <202407191026.DC2644DD88@keescook> References: <20240718182743.1959160-1-romank@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240718182743.1959160-1-romank@linux.microsoft.com> X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 14C711A0013 X-Stat-Signature: ksu5ycycscaf7bh74kz7bzhdbectbhny X-Rspam-User: X-HE-Tag: 1721410016-721955 X-HE-Meta: U2FsdGVkX18d6JtJ3zqCIZrzJRs8bhSApKxvzTsTmBj8UMkeakE0k/JprIiRZHvuIPL9mTlBYklcOorkL0EmUvrtwQzN/f1EXyhYzWY4Jc2fsgDEBAnb3ReLTcXzBql38A3b2gzFEjHdTV/tdbPT0fAMWUf2A/wETodP8JWUHZFI5KLu6UK9ZMvA+Af7AMoP3HdzOkaCrP7qgWUuB27TYNJ1+N5bVh4j/6df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fT1QaNUZWfAdxcRQt+9suve6ZxHtl1qJ 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: On Thu, Jul 18, 2024 at 11:27:23AM -0700, Roman Kisel wrote: > 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(-) This looks good to me! I'll put this in -next once the merge window closes. Thanks! -Kees -- Kees Cook