Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp141883lqh; Fri, 3 May 2024 16:43:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUy+Z+0hyhic8oHYltIowbxzpyWyVQwpAJCAGMqyGXamMxYfXGgaBmdhsE129KzhjLd3cKh78a8eZCi0BQn3CI4VE3yUHVZ5FJkVTaRzA== X-Google-Smtp-Source: AGHT+IHBDHpCy3Ua57qaE55PPtBrsbtxFAEry0LUtWqOq2iQ595EJIKIgXtXMnh5PKe55AXoGpdp X-Received: by 2002:a05:6a20:f38f:b0:1ad:89cc:aeec with SMTP id qr15-20020a056a20f38f00b001ad89ccaeecmr4327491pzb.9.1714779835094; Fri, 03 May 2024 16:43:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714779835; cv=pass; d=google.com; s=arc-20160816; b=fkFcwdQQK/B+ZRAAmzCNYY0Ub/KYnb6/ctC0GJ4qKTCDLwK3/a67O+ozDhtCl2LPJn i16Pnnk8k7xfpcoryjfp8w1tcuSEaetT3+64RX41Yj0H1RauMGnrp+fLMYxmAIHgWJBw BPZFKY9Mc3JWvXmwbNGW3Octn5rYb7re10WQ4sGpSOi58lfxDJw63F/LtK3IdF1f6stl nrnc1/ODic5DigYsUdjC7hMswuQEIaooDSLTr36eFGKvuevyVLV84PYCJNEQUGDZ+9EI 0XoWJSPlGbCsKLCt93xqoGTxdH3CqRv6quxtlF7Zzgg4boMqB/sp5y7PPI8mxSEnpa3x rv+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hP+dUWCvJXqFCm1BZPWTzdhC4tLQMbPhbpvfeYsuGgg=; fh=jvqhqMqMOVj6V03yFj5ciBx2M80F8hfVjlF9JUYEjXs=; b=n+2tnMGSJVaqekrC5Eg2MWjlQcUpXLXE1ZUXOG7oTb0+X9WO4whJwq0aA9f/12+Ru0 MONwaSgWT0fIDJU4V5Ys7irtOEScxWxJNURHGsFFwLg5QXIsLpzRaI9mVQHUJz7Qyniq n+Xwy96wbDyswPu7zQC6B/HmI/4HAAY0doLbwM9tG/0jvvrRJSBMQqVPkWvfSUq8Tn7w f5xxlVG3eNAfTaI+maPydYNpZM6EW2FnRcxpsPLnu1N8MEifqSsmGWJtXoBgX8I8kY/4 8CH7qZ+IzqnvzQUIuGikSAegzCmCjDH/Z1nVjc3P14rkvrw76eQHXekSTl9QUB8eKigy VKqg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SdYacVJU; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-168423-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168423-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id n8-20020a635c48000000b00604b767a003si3912717pgm.363.2024.05.03.16.43.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 16:43:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-168423-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SdYacVJU; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-168423-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168423-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id ED1AFB2206B for ; Fri, 3 May 2024 23:43:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9472B84E05; Fri, 3 May 2024 23:43:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="SdYacVJU" 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 87AE450297 for ; Fri, 3 May 2024 23:43:39 +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=1714779820; cv=none; b=oQKAyc6RC9hMwiraz7Uz4t75zMHyCoQiK4S3+KIQXz86YlsUP0D0Iw2iPOg9UNnXk/Cl3pEp2exXlpIge7mEW8cSGLneGhUpaR69wDIbJCwvuBdZbytrg2Kb1Uci4IRYWX/PJb/D3xBhjvQQHHa9n91wsHcWHdvg43kglutptjA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714779820; c=relaxed/simple; bh=ktX1OkI7+PiUxrOJuKaZuk+OtoCLIWD+flahzW9oG5E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FWJP3wEOtcS33V9o5TCmB8Ai/GELiTQYuohYUcpr2LabElhIcArcIo+o74/m/otKqtVOFobw9j1AlzuSX3j9ktNkJXoXdgnXtz6opHlmSDpWPiXBdXBg81GFhoeCI0OQjKeSQiQw+37gnq9S8i2PiAQIptU4fz4zvJMYXfB5WZ0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=SdYacVJU; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1ecff927a45so1786255ad.0 for ; Fri, 03 May 2024 16:43:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714779819; x=1715384619; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=hP+dUWCvJXqFCm1BZPWTzdhC4tLQMbPhbpvfeYsuGgg=; b=SdYacVJU97ZnydpaoaSXhhoQH906Qx0WAlrqeufIeFODF2C3vGDGF8AbUBgCSZuZX8 hOnPuMILEFjuxORODyvoDfoTTCCt19fQ6rZxtKnHI3oWsLQid7nufa8sZgwkItz9FQaj hA7X11pCf602lHDNIWE+8I4+6V+/aQTce/LlA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714779819; x=1715384619; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hP+dUWCvJXqFCm1BZPWTzdhC4tLQMbPhbpvfeYsuGgg=; b=VbQiEAjo3OiXrQHbiWswbbyF5ql8+y09g0XG7SFHodVuCwtjwTBlJNquRwi7PyJ/Bg 9cp/fLqyQcDVjXdEGSrjj4n49FinJudoQ33gqNG7fWPKAoxSejp/V8r+b0X14EsO8OiS cGEL1Qo9pRKcY6ktFBcO28iGnOP0aOYqkhNYOVvC7Z08iZQKpgUREOveb5qoWuuUiFwh itflOJ+AeMbum3cb1tqjEAqKIchBc0QhdfnpDkvdzLzXM29DG/kUyMhLCJvTzJZu6Q7t Ptthx49xCe6QRJdEaTRMPs247WP0t331RPlMdOgs0BaVKa1m6LxSiARO3kG61DRFuZWz QacQ== X-Forwarded-Encrypted: i=1; AJvYcCVKKSbEghqhU/CG7SPgv1vbkGeWP2s3/cDwCbkq8ifVcMFmGaJJIzY1bbSICFc4/Pq2DGQuzcAJexuNPRUSJTQMZTWNxwph+7XR+SJY X-Gm-Message-State: AOJu0YxBylIr9bl9XscqEmsn54CX7X5TFhhZITx29q0rpBhpTBGWbLsU dTEvhG162lzSxIkOG60sS/417VyX/PVs2jQKPsSKXxFVhEA0EG8kdqE9jZ4kjg== X-Received: by 2002:a17:902:c948:b0:1eb:61a4:a2bc with SMTP id i8-20020a170902c94800b001eb61a4a2bcmr5466122pla.43.1714779818868; Fri, 03 May 2024 16:43:38 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id c8-20020a170903234800b001e2b4f513e1sm3819248plh.106.2024.05.03.16.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 16:43:38 -0700 (PDT) Date: Fri, 3 May 2024 16:43:37 -0700 From: Kees Cook To: Luis Chamberlain Cc: Allen Pais , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, ebiederm@xmission.com, j.granados@samsung.com, allen.lkml@gmail.com Subject: Re: [PATCH v3] fs/coredump: Enable dynamic configuration of max file note size Message-ID: <202405031634.77B223D8@keescook> References: <20240502235603.19290-1-apais@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, May 03, 2024 at 12:51:00PM -0700, Luis Chamberlain wrote: > Thanks for the cleanups, this is certainly now in the right direction. > Generic long term growth questions below. > > On Thu, May 02, 2024 at 11:56:03PM +0000, Allen Pais wrote: > > Why is this being done? > > We have observed that during a crash when there are more than 65k mmaps > > in memory, the existing fixed limit on the size of the ELF notes section > > becomes a bottleneck. The notes section quickly reaches its capacity, > > I'm not well versed here on how core dumps associate mmaps to ELF notes > section, can you elaborate? Does each new mmap potentially peg > information on ELF notes section? Where do we standardize on this? Does > it also change depending on any criteria of the mmap? This is all in fs/binfmt_elf.c, fill_note_info(). There's a dump for each thread's info, and then fill_files_note() (which is what this code is adjusting) which writes out every filename for any file-map VMAs. The format of NT_FILE record is documented above fill_files_note(). So, it all depends on the count of VMAs and length of filenames. > Depending on the above, we might want to be proactive to get a sense of > when we want to go beyond the new 16 MiB max cap on new mmaps for instance. > How many mmaps can we have anyway too? INT_MAX :) I'm fine with the new 16MiB max for the coredump. If we really need to go beyond this, we might need to avoid building the entire thing in memory, and instead move it all into write_note_info() directly, but I'm not interested in that refactor unless we have an overwhelmingly good reason to do so. -- Kees Cook