From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.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 17261239E75 for ; Tue, 2 Jun 2026 12:33:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780403630; cv=none; b=ozqYZA6qWSXqdjeNQq6Q3k+jEzdhj4/qfkbTNvQmI+lNCUlPUbe6KoMhN7uEIY0PRFkWkv0MLgHUewfXA9AMA2f/yimA0xdeq+439YJzibpKDDlNc27beHG6CZRxF4aNex9Is4mA9fRY6727r15M3RJGdMGbrzOqZ+g0os04dwE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780403630; c=relaxed/simple; bh=Dt7ynl7RjMDm10IwkFbV7yaqQ3XCHkv1Jhl7dMLZbl4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BsDvI7GQYVSmfjdeJ+G5EGQiSeq/VJ7w0dPRiXjCTY0wRAcK4yFjKdZBceeKNXi+QVySDDhEWYxyoMFSJ/mHuSnx6AZGqEEef4W4QCQunh9xsoqPSui/6wwatxC+CNJ9/uFvyLKF/GmA+SYuVZhQs1oW5JrPnDDBpACXinSOtqo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=Mjg0KMTz; arc=none smtp.client-ip=209.85.160.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="Mjg0KMTz" Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-5175b6c4e19so15977601cf.0 for ; Tue, 02 Jun 2026 05:33:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1780403626; x=1781008426; 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=3fuMy8ZTlB4sZmM4SRNfS45Rtpr0e2y/Uhs3uZMD108=; b=Mjg0KMTzNzeCi7FV4Cglipctnd4qTRNJBs44FcFTysdYrVy+WlGmP/0GDFu0J+wJ7m R/AuPEohevy1QNUE+WUDGubmJcDZZnffsV7i/Zze94JkqRPhbPdy15Qk6yh0s9q2hu1/ bI7dm1G26H7om23e5xJModDeVrIOi0meO3NUWse+J5lk5WegiPpkj76Qz79IXx4wghAH J1I3OvFvwHvZLYWvaUMDTJFwu8CeiZpFpTAa6VbXuL1p2SxsoyL2H/fX/865+UB4pvvq PhJR1KIiS2V1O2Xw5dcvwmRIXL5LbfWF9nRanp+5gjV4eMn6+GEiDs6cHaCPjs+09FpH tsZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780403626; x=1781008426; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3fuMy8ZTlB4sZmM4SRNfS45Rtpr0e2y/Uhs3uZMD108=; b=MSW6wx8ZfGS9G8FA4LA+d3OLy6R18VJrUkdSs7bhjwq3c+SyUo672i25RyiLQ7zzm9 F3YBK8vOdM/If8c+kvuwtTuFK5Z7zKdtlgsUq/+HkhSWaFa4gVbRRDYWR67NqQYhpWX/ Nc5wl7odq8uqoHnzTAGocILe++vzunYTdwjWEki1YdoitsHrEL2ajsbWj06KVJDRQmay dN9BrZcnb6mHQto8/4pMY6zgARmNTgcslFXNbYF/LzYq8s5TF350hLPmC09LV9xYbiEw rcOhLwXh3o6jKMPkOO/OGAsMvVSx14RLhPqOSL/ErdSivdMqQzrs/TGHVeZgoYzEB4YI SJlA== X-Forwarded-Encrypted: i=1; AFNElJ9F9G/iBg2A8PZaU1kB0VT57nUj0DN7ZeUmFfwueHvOxJCPGbkcVV8q+s5bh+efUpfag5/WwslBwi6gMYVS@vger.kernel.org X-Gm-Message-State: AOJu0YzzXusfl6CjvoO2FG0nGP5ZzgW2u7mHwJ2qTDtbj745N5kz+Gzu DtrvaWo9UfGNj1/Iq//T32o1xIaID5ZcUR7jXJC4HGM8+qSzBn8/oS0E5R57ch91oSQ= X-Gm-Gg: Acq92OG4dFDL4B1WJbhZzZ21u0HJ/kHk/1FNQibURMKNFLwnfDhxErBXadQjQ7BNsWb OaTaoTiKOCb+U+lQs0Wh/LCSKYofmUTIOuZJr7ovZMyXtcNEJ+ZIDokMYC/AbRG35tYeHZiicFp WicLC9NoC9+we2TRM6UWogGA8wFtpZ9ugmzHzlDtu4CPuA4CuJt5tHR3v3KNCFf/y7qp4ZyJUuL u86LBilrqu/iWheEUFkkCZxHwQABw6DVghRarGqhJCW2Evkr8XHNJK8UuMZHWZtTUthObmIqH9e Hqc5D1yzhkOAbfwnqsdekznNJtXZqOdvMFg0tu00rujbvuLi8oqHphtfY46oAQIhLYigmDDMgcx QzlV4jhobnxoyfueYr+ZjSZF4Tsz3Ckep6jY/59YF1QoZjZzstKNGFhdmDuVxCH9C4AZ7IiJKr6 vskynvdKl6lCziz28Cn4E9jajmsXo6s03gKN0CLsjJzNrMgstlVAD67082PlxB8AeB8/MEmmk0w TPFPwDsFzj7HEr7 X-Received: by 2002:a05:622a:190a:b0:509:2527:d789 with SMTP id d75a77b69052e-5173a5c05ecmr228232631cf.6.1780403625864; Tue, 02 Jun 2026 05:33:45 -0700 (PDT) Received: from ziepe.ca (crbknf0213w-47-54-130-67.pppoe-dynamic.high-speed.nl.bellaliant.net. [47.54.130.67]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-51741d6a240sm78686221cf.18.2026.06.02.05.33.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2026 05:33:45 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wUOJU-00000003m5x-3DKO; Tue, 02 Jun 2026 09:33:44 -0300 Date: Tue, 2 Jun 2026 09:33:44 -0300 From: Jason Gunthorpe To: Andy Shevchenko Cc: Kees Cook , Luis Chamberlain , Pengpeng Hou , stable@vger.kernel.org, Petr Pavlu , Richard Weinberger , Anton Ivanov , Johannes Berg , "Rafael J. Wysocki" , Len Brown , Corey Minyard , Gabriel Somlo , "Michael S. Tsirkin" , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Bart Van Assche , Leon Romanovsky , Laurent Pinchart , Hans de Goede , Mauro Carvalho Chehab , Bjorn Helgaas , Hannes Reinecke , "James E.J. Bottomley" , "Martin K. Petersen" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Greg Kroah-Hartman , Jiri Slaby , Alan Stern , Jason Wang , Xuan Zhuo , Eugenio =?utf-8?B?UMOpcmV6?= , Jason Baron , Jim Cromie , Tiwei Bie , Benjamin Berg , Ilpo =?utf-8?B?SsOkcnZpbmVu?= , "David E. Box" , "Maciej W. Rozycki" , Srinivas Pandruvada , Peter Zijlstra , Heiko Carstens , Vasily Gorbik , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Vinod Koul , Frank Li , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Alexander Potapenko , Marco Elver , Dmitry Vyukov , Andrew Morton , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Georgia Garcia , kvm@vger.kernel.org, dmaengine@vger.kernel.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, linux-um@lists.infradead.org, linux-acpi@vger.kernel.org, openipmi-developer@lists.sourceforge.net, qemu-devel@nongnu.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, linux-pci@vger.kernel.org, linux-scsi@vger.kernel.org, linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-serial@vger.kernel.org, linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net, virtualization@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH 01/11] params: bound array element output to the caller's page buffer Message-ID: <20260602123344.GG2487554@ziepe.ca> References: <20260521133315.work.845-kees@kernel.org> <20260521133326.2465264-1-kees@kernel.org> Precedence: bulk X-Mailing-List: linux-modules@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 Tue, Jun 02, 2026 at 02:26:46PM +0300, Andy Shevchenko wrote: > On Thu, May 21, 2026 at 06:33:14AM -0700, Kees Cook wrote: > > > > param_array_get() appends each element's string representation into the > > shared sysfs page buffer by passing buffer + off to the element getter. > > > > That works for getters that only write a small bounded string, but > > param_get_charp() and similar helpers format against PAGE_SIZE from the > > pointer they receive. Once off is non-zero, an element getter can > > therefore write past the end of the original sysfs page buffer. > > > > Collect each element into a temporary PAGE_SIZE buffer first and then > > copy only the remaining space into the caller's page buffer. > > ... > > > + elem_buf = kmalloc(PAGE_SIZE, GFP_KERNEL); > > get_free_page() (or how it is called)? I thought modern mm guidance was to use kmalloc whenever possible and not use get_free_page() unless you intend to use the struct page bits? Jason