From patchwork Wed Jul 31 22:14:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Mak X-Patchwork-Id: 13749312 Received: from mx0a-00273201.pphosted.com (mx0a-00273201.pphosted.com [208.84.65.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D86116C86D; Wed, 31 Jul 2024 22:35:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=208.84.65.16 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722465359; cv=fail; b=BqbhRVYko+GCChqndplqctRWLmCDR0lvBf1O7aqPRrHGJd2IO1Av0EnJYK3lQgtiCnqgNgsWHijywuADFr1M35bHmX1v5D3vjgasZe6Bosx1q++u3LUU+KyMNIPQ72pIEZ/VM2KpkJ+xOLwDmtxfCJCd2m51dAUXnUGTklzXggk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722465359; c=relaxed/simple; bh=ma1ebKw1c7G5LLa8DR7fD8peTxkvxIASwEiE/Bt+JPU=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=frWiR4P332ZsiEnverJtLqObBXAoOksOxe96Kt0U+taNgl7resvHWoOKHXnzx8cU/jrwungpw00/LUIizjy5WKReVcofBZXInOWixpiA6jIOU1mjfCku9rBAfkP05Cs31U+HRrDwIRoSTEO+qFTnr0LnUzohHIycT4ozvSvMUxc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=juniper.net; spf=pass smtp.mailfrom=juniper.net; dkim=pass (2048-bit key) header.d=juniper.net header.i=@juniper.net header.b=FA3YRJav; dkim=fail (0-bit key) header.d=juniper.net header.i=@juniper.net header.b=YRnS9tRK reason="key not found in DNS"; arc=fail smtp.client-ip=208.84.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=juniper.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=juniper.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=juniper.net header.i=@juniper.net header.b="FA3YRJav"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=juniper.net header.i=@juniper.net header.b="YRnS9tRK" Received: from pps.filterd (m0108159.ppops.net [127.0.0.1]) by mx0a-00273201.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46VE9d93016978; Wed, 31 Jul 2024 15:14:17 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=juniper.net; h= content-id:content-transfer-encoding:content-type:date:from :message-id:mime-version:subject:to; s=PPS1017; bh=YflLRIY8DI4aO nDtpKIdHMlIeX9xbOo9BxY47Q3hTZc=; b=FA3YRJavQesdmoJjqmh/qOSleM+7z ZUXKYDAVheHNps1OPbz7caIwzjroKUpvftByLuIQkZZXtZ6EBqPy1+4ESephvHDO 7PzwQqRwOR8mLYLCPl5gVcXScmWgBbeCTkcjegtyhJ3WlHQh8I7UXK+rik9FdC0s SpOsCvSPBfjkGYVFQA7NU3WkNvZGIIu0if5JmpbNjXzvXfLYtaPB6yOKcG2qeOJJ Wmu/U/4ipZ2yX6enLNNpd1lHChsnadSGk4G3id+/5Nx9qXDhgXIOqo2UhyMaDx41 UIPdEMw3E5WiNZlRJxFISr+dJog7epwjts/sIipAv7AwCLfhaQSafqgsg== Received: from cy4pr05cu001.outbound.protection.outlook.com (mail-westcentralusazlp17010007.outbound.protection.outlook.com [40.93.6.7]) by mx0a-00273201.pphosted.com (PPS) with ESMTPS id 40mxussq3d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 31 Jul 2024 15:14:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=unmyrvE//DFsr5AiOdskbe6iiBzx6aa1aPC8BlHwgWxgyNXpHaJV40JUoKNuzVtUtQV096Kx/Vqm1gDQ4PECFxPFv0Ahc7EXtOFIV3ewVk9ntcn1vQp8OVXB2KIfI9FeSFD8bpzRHanyRQ4371D6f6jHOid8/wv4WNb27kXpBdyWkFBTO+Shk0mi9DSxB9m/GAUlkVM2X9HTskLgidkpQK+y44mFx2zJr1fv+Fomuitzi7oUIpd9SLolIjMZVKbksTOqQX/9ricjItBIHBKOJipluOXT6vTxuQxeAKFpjfBoA53CdQrDF9qp/Rb6iYy+R2fez3R2Glb3cIy7aVbccA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YflLRIY8DI4aOnDtpKIdHMlIeX9xbOo9BxY47Q3hTZc=; b=vzxDdKe8l72cICbyDOwwbbJP/ATjkKcxMT9eXwLB1QpwP7Pbpzu18dlQjkLhxuqjpQDRKHjtgzOwUtpNvhmTWb7JgbXTvkt1cR12/jx1CtR7Pqr7tFAnkcV0DEP+dBnOD/Pf4lE9vmAMoID/DnD5rZUFaxypJADu69hZJbU44D7VXsMmlSYqnQtW1F9sdbchIbS9UUJm8OU+zOV7VuQXOwCtTmOYBxcCibWcdWCBSHb8KSv1BB/RVKDiXGRAxF2PQBA7MgAXJR3RLswzTnERfg8jDwxih4QEeju8c/mGM2/XDg7+klNZpEap1lEPweMG1+ctDoCdwZstOahVzkbuoQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=juniper.net; dmarc=pass action=none header.from=juniper.net; dkim=pass header.d=juniper.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=juniper.net; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YflLRIY8DI4aOnDtpKIdHMlIeX9xbOo9BxY47Q3hTZc=; b=YRnS9tRKV0sgOI+A968lcWoQmRu2BLsnhcgaZmI1hKHXf36PFlEsZAusGhMZJhBMzctocdGqjQP00LO6835FePNM7nEt26sNJT+SBkc5zOeQcGdVF25lTIkhAzllNeXvziNiWv0jJcmkyWBe+wK/vSd93Igd7R8YyVgBT8NWBL8= Received: from BYAPR05MB6743.namprd05.prod.outlook.com (2603:10b6:a03:78::26) by SJ2PR05MB10356.namprd05.prod.outlook.com (2603:10b6:a03:557::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.19; Wed, 31 Jul 2024 22:14:15 +0000 Received: from BYAPR05MB6743.namprd05.prod.outlook.com ([fe80::12f7:2690:537b:bacf]) by BYAPR05MB6743.namprd05.prod.outlook.com ([fe80::12f7:2690:537b:bacf%6]) with mapi id 15.20.7807.026; Wed, 31 Jul 2024 22:14:15 +0000 From: Brian Mak To: Alexander Viro , Christian Brauner , Jan Kara , Eric Biederman , Kees Cook , "linux-fsdevel@vger.kernel.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: [RFC PATCH] binfmt_elf: Dump smaller VMAs first in ELF cores Thread-Topic: [RFC PATCH] binfmt_elf: Dump smaller VMAs first in ELF cores Thread-Index: AQHa45b6H7qt2DxWIUm3KHixJZvP5w== Date: Wed, 31 Jul 2024 22:14:15 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BYAPR05MB6743:EE_|SJ2PR05MB10356:EE_ x-ms-office365-filtering-correlation-id: eca11b77-1aa5-464d-410f-08dcb1ae1d23 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|366016|1800799024|376014|38070700018; x-microsoft-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ieFpS/gIDCwrtZM/sQHgCHKu0KiB5AA2T2sp4V5Nc/0yGD43hwMoZVp+t662B8JIhtQUmL3MfwLYyEXQjTIDuRpCxXhLtKFkQm1ofltWqizc5k8fEyA/Z9WB79BOsoMQlgQvec5/uzzmTnoPdfzf2E5iJqYqJdHK5bot/fBWoeLU7hCI3P+c2pjdC6SNICZjbzxbJ5NSVh4M2rideGG5B04QMpI41Q0zaIbKz5kgllmOGloLooeTkQBkRozzXAxE9Z/OnGHHKJQ5MpQiEkUlNvX4OD9KIk1H1JdOGX8uDLhFlx4GhP6y4wnvaeF9BPBoXwIqBg1gHG+sHanOA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR05MB6743.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: adEd+BMlz+TJvP1HvXUcOCMc7qh8qM4qXRQUOX+myLis3BBZQ9bRlKSQO7MnvK3YnbgBK0dUznfxuhpxB1tzdghXqO8s4N48YlJ20z6/r9hlC8UEGHzonIoyDeG5R+YCnysa0SM8rvE0cTD9TYsRCZ8Ui6BLdskqWxucv6KzH+ByoABuJIm9Yb6vm+EofcxnlqutFuzj6fDoF3kQiGHHM5pV479M/PUbzrJjPlsrJl0hK/8e4eBpHpugvfyh4S/WDYnVTe7qOgucU6Nl/Y35wSk3RW2rlzlzg5PTHzBYmoxSFIKiWVf64fiKhhzY6BRDbLAEgSlSf5F5Xd2h/AQksjIn0sntbXrdhFv49wVWwlXC7elJQmg6OTCz4bH3p4786oLPweitWMNC1xFrB8OqgJxXMR5sr4isFIxq4qBe0Yw6u9IHOeKOQmtSF1af0gIuk6yGP9KRCg0lqVb4e6LYWLFcRtix1tfXtq68SFsWaSO3ARE2grhFPiM0s000U0UOf0yKFgTvVUg7wv+OyY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D9394895817721668CD1B3@namprd05.prod.outlook.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: juniper.net X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR05MB6743.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: eca11b77-1aa5-464d-410f-08dcb1ae1d23 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Jul 2024 22:14:15.0865 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: bea78b3c-4cdb-4130-854a-1d193232e5f4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: WjHPvamN6l8U2OKkYXHYju5A8UluCyD/ofQh3GA2r6d5ejCQ0+3GmqdRVk3oJGoJe/ISJ0OJScfQGTWzxUk54Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR05MB10356 X-Proofpoint-ORIG-GUID: vYo-ZZqU-OVkY9aLgfGgBKuVvcMJlDV6 X-Proofpoint-GUID: vYo-ZZqU-OVkY9aLgfGgBKuVvcMJlDV6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-31_10,2024-07-31_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_spam_notspam policy=outbound_spam score=0 spamscore=0 suspectscore=0 clxscore=1011 impostorscore=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 mlxlogscore=745 mlxscore=0 phishscore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2407310156 Large cores may be truncated in some scenarios, such as daemons with stop timeouts that are not large enough or lack of disk space. This impacts debuggability with large core dumps since critical information necessary to form a usable backtrace, such as stacks and shared library information, are omitted. We can mitigate the impact of core dump truncation by dumping smaller VMAs first, which may be more likely to contain memory for stacks and shared library information, thus allowing a usable backtrace to be formed. We implement this by sorting the VMAs by dump size and dumping in that order. Signed-off-by: Brian Mak --- Hi all, My initial testing with a program that spawns several threads and allocates heap memory shows that this patch does indeed prioritize information such as stacks, which is crucial to forming a backtrace and debugging core dumps. Requesting for comments on the following: Are there cases where this might not necessarily prioritize dumping VMAs needed to obtain a usable backtrace? Thanks, Brian Mak fs/binfmt_elf.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) base-commit: 94ede2a3e9135764736221c080ac7c0ad993dc2d diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 19fa49cd9907..d45240b0748d 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -37,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -1990,6 +1992,22 @@ static void fill_extnum_info(struct elfhdr *elf, struct elf_shdr *shdr4extnum, shdr4extnum->sh_info = segs; } +static int cmp_vma_size(const void *vma_meta_lhs_ptr, const void *vma_meta_rhs_ptr) +{ + const struct core_vma_metadata *vma_meta_lhs = *(const struct core_vma_metadata **) + vma_meta_lhs_ptr; + const struct core_vma_metadata *vma_meta_rhs = *(const struct core_vma_metadata **) + vma_meta_rhs_ptr; + + if (vma_meta_lhs->dump_size < vma_meta_rhs->dump_size) + return -1; + if (vma_meta_lhs->dump_size > vma_meta_rhs->dump_size) + return 1; + return 0; +} + +static bool sort_elf_core_vmas = true; + /* * Actual dumper * @@ -2008,6 +2026,7 @@ static int elf_core_dump(struct coredump_params *cprm) struct elf_shdr *shdr4extnum = NULL; Elf_Half e_phnum; elf_addr_t e_shoff; + struct core_vma_metadata **sorted_vmas = NULL; /* * The number of segs are recored into ELF header as 16bit value. @@ -2071,11 +2090,27 @@ static int elf_core_dump(struct coredump_params *cprm) if (!dump_emit(cprm, phdr4note, sizeof(*phdr4note))) goto end_coredump; + /* Allocate memory to sort VMAs and sort if needed. */ + if (sort_elf_core_vmas) + sorted_vmas = kvmalloc_array(cprm->vma_count, sizeof(*sorted_vmas), GFP_KERNEL); + + if (!ZERO_OR_NULL_PTR(sorted_vmas)) { + for (i = 0; i < cprm->vma_count; i++) + sorted_vmas[i] = cprm->vma_meta + i; + + sort(sorted_vmas, cprm->vma_count, sizeof(*sorted_vmas), cmp_vma_size, NULL); + } + /* Write program headers for segments dump */ for (i = 0; i < cprm->vma_count; i++) { - struct core_vma_metadata *meta = cprm->vma_meta + i; + struct core_vma_metadata *meta; struct elf_phdr phdr; + if (ZERO_OR_NULL_PTR(sorted_vmas)) + meta = cprm->vma_meta + i; + else + meta = sorted_vmas[i]; + phdr.p_type = PT_LOAD; phdr.p_offset = offset; phdr.p_vaddr = meta->start; @@ -2111,7 +2146,12 @@ static int elf_core_dump(struct coredump_params *cprm) dump_skip_to(cprm, dataoff); for (i = 0; i < cprm->vma_count; i++) { - struct core_vma_metadata *meta = cprm->vma_meta + i; + struct core_vma_metadata *meta; + + if (ZERO_OR_NULL_PTR(sorted_vmas)) + meta = cprm->vma_meta + i; + else + meta = sorted_vmas[i]; if (!dump_user_range(cprm, meta->start, meta->dump_size)) goto end_coredump; @@ -2128,10 +2168,26 @@ static int elf_core_dump(struct coredump_params *cprm) end_coredump: free_note_info(&info); kfree(shdr4extnum); + kvfree(sorted_vmas); kfree(phdr4note); return has_dumped; } +#ifdef CONFIG_DEBUG_FS + +static struct dentry *elf_core_debugfs; + +static int __init init_elf_core_debugfs(void) +{ + elf_core_debugfs = debugfs_create_dir("elf_core", NULL); + debugfs_create_bool("sort_elf_core_vmas", 0644, elf_core_debugfs, &sort_elf_core_vmas); + return 0; +} + +fs_initcall(init_elf_core_debugfs); + +#endif /* CONFIG_DEBUG_FS */ + #endif /* CONFIG_ELF_CORE */ static int __init init_elf_binfmt(void) @@ -2144,6 +2200,10 @@ static void __exit exit_elf_binfmt(void) { /* Remove the COFF and ELF loaders. */ unregister_binfmt(&elf_format); + +#if defined(CONFIG_ELF_CORE) && defined(CONFIG_DEBUG_FS) + debugfs_remove(elf_core_debugfs); +#endif } core_initcall(init_elf_binfmt);