Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) (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 EDCC52EA754 for ; Tue, 2 Jun 2026 12:33:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780403630; cv=none; b=YmrGqb6KS02p7In2ksWiMeazUzaExdTR189wsK9kcSEju+wRo3bnykJ8BztIgu16QSd4N8bnEu4z4KZMtL3cRGuG0Hkv4yuAk1WknY67sVjHrU+hY4ZvFI8dY7a78qVjFd+aldeEPBwScGXscZ3ObZH5G06ReQYcEBKSf0xWlj4= 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.171 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-f171.google.com with SMTP id d75a77b69052e-5174a34800fso26645711cf.3 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=B2p8nmzOwmgQ3E5bNJMHcH/g46hwiHVs8OexWdAGxaGmn/W88ndxpeDwOQM/i+pAqz Mbw9/sg8IhmMZihSoyvzI1nZydVZ66izWSvC+4AeCRB08b40g9IFfyvwqMRlqpn9nbAk eVxsi/pbVGAlnFmk1thhqv5SIDsyXjhapLW5j9kyyNhrGwVIsjQPSpFBKIW3vG7DgSyo hRrD81haRGpI8OxhoKpL7BXIeV7YL0vc9CBuH8QELOCXwDouu07YlNFgCkuDhlWAGxH0 qPuZKzv/1Uc6r9o6y7mhCFY4TyF6xXwYAoRcV1zYV0o5tCTmPqSBemhEaQ84MCCugOgy RfzA== X-Forwarded-Encrypted: i=1; AFNElJ+JnwjzsZ1zC3m4ZK1fpC3G0mcae6TU4a8ZD5e+i4FzqL3BMXhkhwTq5qEHGs/Darmd7nLEOkzCIOQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwmqB69WHWQws/TH8aZt5OEry/d+d7OvN6jdSufJcM9b8jwoTyp WTvXqxjd0l4CWzZckOXPuVc9V+m/PD0oKwTi9W82Uz2K5jUqSDFQjtBPhQEiQjvDnQQ= X-Gm-Gg: Acq92OFBBqa82wGfQAMiF89BZPLverZ3mGw4q7aU1J1k16aP3lB9kddxKVRns4baCou 9rZOCj4ZX5UsKe+c1bhgITDzBD+7Hbmm0xSlKECcmnTy58ENKjHqZc/Q8vtsmEWAee+FuZOMbHq xkqxzoiFFrU16j59QcfVGiNUqhpgk/VIfWZT/eLh1fUeMK4eDQg0Sk4zFeHm5s7k+HMP61pH7hH s5ciItb1sDYMYO8zSSdV/mTzT7cUDwOe+7ZFM5fRxCC8/yw49krhPeJaqnrZxlx+sFGTH9igFjB 0B2oqTE0uAv7XD43weH4tQ4QFOrVwKmCaL9xfEIZEYCU+LUU7Y183J4/HRwC8/qAD+C8p2eNpJ2 B7K7RA9F3p/eHrR9LFGc9mRFdKu3UOFb6Ns0esyb0vbJqNpdPNCOLFxg9/18mEM+PPJqJy4len9 MxkoujYEW9npRg0ScSfkfSCjBtuUVBJBGH5f0V/2qmwbV1ZT9qIqzezAJGnuFjRdZhercxQ/gK5 ZgObhYBO4Wjn5rc 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: dmaengine@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