Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1588845lqa; Mon, 29 Apr 2024 12:49:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW8/CRIpMwShr5i+rct7Wx7Hg8oRhkFCow+CZ3jIao0SJiH/lJmhbfT09azG0F80yfJXN0UrrfOIjxqQ+BziSSORFB+RG0Ts9DcZCF05Q== X-Google-Smtp-Source: AGHT+IFqrW32mvUe5ARWbFU0D1fakGcsqKE12iE/wIvDBOjW0QIeRaNRwY8HNQypTkqYkuKXjLnS X-Received: by 2002:a05:6a21:33a2:b0:1aa:a6cc:39c5 with SMTP id yy34-20020a056a2133a200b001aaa6cc39c5mr16809235pzb.7.1714420159623; Mon, 29 Apr 2024 12:49:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714420159; cv=pass; d=google.com; s=arc-20160816; b=oEBCu+DaLA1bqHuw0QAsyFUoiik6MUAA717XlLE0sSwDLKsUMnGFvszioe9+uYeMH2 h+sPXrMirGG/I8IUaG57HC8tAodOvIIxpS2gTsEw2lZWG1PJrT3/aMI833qwHBglA8pA rYkdQMMTf4O1nNx65mpDrKJYdINVcwZc+osdsGQ27GLxyq+1qx6ygojjqW7Ce7L+N+7t 2lnjAGHVaw3GkwvoDpYOpkvOYvKxs3l7JyDku6PNsEDTF3/qJEtX2SNMmy8Sc1JqWCwg R5FLzbhSFYv2f1q5l3RTY81NrNIniCt2eq+rX7GKbh2TTTW1W+ECIa93O0cepZyq08Pm R0dg== 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=jxlmAhxfEfZT8bTyeNiSvqaH1zNJ82/SnYCLRCDDuj4=; fh=+AnBKizf2HfQF5Mft3PJDSXx7n+lHxxyDDhD4285d4Q=; b=lfz17SNiBtlNw5kuShGGZfUYL9NXqKAge2mRc0141rdiEuEFtI6yKcI1d7ZfLIzYMg tvz/JPXu8IlwS5bNt8tw8GSwOAZq6D5Eb6oiyqx49SP7gyUtdWUAvx93GHZ/ZdI9PWDz HhDBBki/GXxGWtnbiGpyKThupT755nD9qUghSbadTUthtAvLicCQMGCJJNC1AtgP+y2v 0XIp5eRc4YSkNKw/T3qoOU561CR7F7+cqUjAk2WnJBfwd/c4Tze07mI2HOgV4wCyjZaA oB7YGSk0l7d9/8TvywHjPhTotZZ/VLhEZre1XnAtgLUX6rmu9In2omlHOmfDTo4K27oX huiA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OUtm69vX; 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-162967-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162967-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h190-20020a6383c7000000b0060b5c6f8963si7765688pge.58.2024.04.29.12.49.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 12:49:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162967-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OUtm69vX; 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-162967-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162967-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id EBD382837CF for ; Mon, 29 Apr 2024 19:49:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0C0CB13B5B6; Mon, 29 Apr 2024 19:49:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="OUtm69vX" Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 005A112AAC9 for ; Mon, 29 Apr 2024 19:49:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714420147; cv=none; b=XT/hZlPBatalh5oKLdgAWoeRzu5fyDNs+Lp+ZIQNDnWU+A8slPkVBCrEme0ARKfwGlni5FR6YzLhmxT5vS41yPVPqhgoBTLudst6TpyPKm3yW3SVLlUeQWoVZVEPt7KEVKYNJYib7moLxF4usiDsdNQjF8rU23snQl/aWtjfbrE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714420147; c=relaxed/simple; bh=G5w+y4k/0B/MIhP3OIdnfnaBZzVFiznSU5o3Q+eJJrM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=exeMrZvkIzXy9H35RQ5kTMXGwe7lSsKDjcgMTpAKmqeCaCtgphAeUhyzWE2rAQhYEofdRsJ7EE98dOLXwuIRmu2nQK+68Mw/hmha44hQys0N+asBYdKa4BkYzls662CYiZrGMDTOxNkcBfZOfkvezB5FLEcqNYzTXRB+ZPRMZmE= 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=OUtm69vX; arc=none smtp.client-ip=209.85.214.176 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-f176.google.com with SMTP id d9443c01a7336-1e51398cc4eso44089855ad.2 for ; Mon, 29 Apr 2024 12:49:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714420145; x=1715024945; 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=jxlmAhxfEfZT8bTyeNiSvqaH1zNJ82/SnYCLRCDDuj4=; b=OUtm69vXtxg/bF9L249dalzDtwsmmtcLzd+zQkMs/QcakiD8ydFCtA7GRRQSu1QrRL Qv9yHiwgXQSn/eGX5eMaeDLHMNaj6ZokcYfG2duXxtIAMQPDhWiuf02yjt/l/kmqWShp r0Xf177p1IPZc7ebLfcf7y2P/gQdC3aTCVRNc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714420145; x=1715024945; 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=jxlmAhxfEfZT8bTyeNiSvqaH1zNJ82/SnYCLRCDDuj4=; b=KBdC58P2I6z9YTpMUCdX9DzMhQZBlDxg/9rwbvETXXs7cPd/x8icKry0IjDStJwB9U VsUAnYZbbCkbK7I/hF+MPvvANkHcK+PXvFffpLcGo8fpNoILSGR9z6wfqbjXkVla+o7z NfdgQlL6W+3NX9L0185yfeR+uo0acd1py4H1/VcmFWTJMl56q74fLlfAIqrjmCVow90u O4SiNdShWz9IX5wjdYcJ+uXt14WTazUWAp/cVIUr4jG2R6vUZUY4omlQOxTFS9pIMlAY qj6kjSoSqmelyNHMcyBJ1QWKy4vgiAzp/arhPlYWAZO9VH0r6f49dt8oxMxZX4AIEkch Fx4w== X-Forwarded-Encrypted: i=1; AJvYcCUNMRGRGzCQd5a6uphu9gVGFEAxm/2QkhguBriPOEVV5/WRdSpVBGBMf4NTSKpVb4ByLkG/PlwVQP6hkmTahAaKz5VeXWVgkQGBW5sc X-Gm-Message-State: AOJu0YyFvDW42SMrINLAH1OMkx9guLNsLQnjdcrMUXZLO04wtez6wnx5 SS0n2yqj1dgbA5DR7I75TWY9lWIhGsfrOi8m5i8mNjATvKFyiYqZsoidp/AN8w== X-Received: by 2002:a17:902:ce87:b0:1eb:7285:d6fe with SMTP id f7-20020a170902ce8700b001eb7285d6femr8741775plg.23.1714420145374; Mon, 29 Apr 2024 12:49:05 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id s1-20020a170902ea0100b001e3d2314f3csm20739290plg.141.2024.04.29.12.49.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 12:49:04 -0700 (PDT) Date: Mon, 29 Apr 2024 12:49:04 -0700 From: Kees Cook To: Allen Pais Cc: 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, mcgrof@kernel.org, j.granados@samsung.com Subject: Re: [RFC PATCH] fs/coredump: Enable dynamic configuration of max file note size Message-ID: <202404291245.18281A6D@keescook> References: <20240429172128.4246-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: <20240429172128.4246-1-apais@linux.microsoft.com> On Mon, Apr 29, 2024 at 05:21:28PM +0000, Allen Pais wrote: > Introduce the capability to dynamically configure the maximum file > note size for ELF core dumps via sysctl. This enhancement removes > the previous static limit of 4MB, allowing system administrators to > adjust the size based on system-specific requirements or constraints. Under what conditions is this actually needed? > [...] > diff --git a/kernel/sysctl.c b/kernel/sysctl.c > index 81cc974913bb..80cdc37f2fa2 100644 > --- a/kernel/sysctl.c > +++ b/kernel/sysctl.c > @@ -63,6 +63,7 @@ > #include > #include > #include > +#include > > #include "../lib/kstrtox.h" > > @@ -1623,6 +1624,13 @@ static struct ctl_table kern_table[] = { > .mode = 0644, > .proc_handler = proc_dointvec, > }, > + { > + .procname = "max_file_note_size", > + .data = &max_file_note_size, > + .maxlen = sizeof(unsigned int), > + .mode = 0644, > + .proc_handler = proc_dointvec, > + }, Please don't add new sysctls to kernel/sysctl.c. Put this in fs/coredump.c instead, and name it "core_file_note_size_max". (A "max" suffix is more common than prefixes, and I'd like it clarified that it relates to the coredumper with the "core" prefix that match the other coredump sysctls. -Kees -- Kees Cook