From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 0D13A84039 for ; Fri, 22 May 2026 03:14:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779419680; cv=none; b=QqfCsdC+o2ySqzCKkZkJ5yk3J/jPlEqxfsezQcRZyeORFFZCKlhveGc/ObI7tqo2p8Jj7mD7J1pLnlfKrejHErHTbDsAmDHsOds2P0xCYIRIV26r2AalydFqh4kKg12D6J6W8fBerM5f2M5XdgHRHjbJErxaAniz5pHW2/c+88A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779419680; c=relaxed/simple; bh=6UtX54cRZEvFWSJEZsyNF/Kj8XtNiN2Yqu6h5Ik9lWs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=on7Vq002sX7rHOvBdeP5Tu/5fMNcViGkwHLesjj73IKtlB0ulkTuHtBP87nZiCYqpo9DIPiRP2RTlIKp0s9hT8xMFSXT75RuCyZqafeg6Mt8BdJ6yl24p5HopCtmee5ieJwxz4mAkdMQBesrrwIOWUsr7MIT+/IaVACKO8MT/Zk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=Rx0VF/cm; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Rx0VF/cm" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=UDJQJ2SWRuuTm3n45a6ixiISyrnNrJNCHrAU5RDL+Ws=; b=Rx0VF/cmGYIABTDNVZaHGF2h8h f8rOwshu2WOT6h/1ynFiMa8JD9zcIguI1b4skLFnBRToF9eitmRt3+jJP5X59L4mQE4f0gMhd0C8V /IPZHZezqCnIDx2rLK/lBDpzvk2Er0buQDZlpMliX3HBHEbfiMgTZp+N5uQHTuSHr32wQb97z3sBu 3Z1WJDWAgb8hK+IpqbngemQKa0rGkzy8rlNQhdXeEBri3ghqDiXd0DnjN/2/UNwnrGEoy6aBEeD15 8Wfqc6jgvQhNxVWfC+xs7Mq+8wS7G3WmRfaTOG9RRyHJ3jkhZjUx9SatrLZe+xUoUDf5dxQKlN5bc WTOEgrRw==; Received: from willy by casper.infradead.org with local (Exim 4.99.1 #2 (Red Hat Linux)) id 1wQGLI-00000009Sdy-3FpN; Fri, 22 May 2026 03:14:32 +0000 Date: Fri, 22 May 2026 04:14:32 +0100 From: Matthew Wilcox To: Kameron Carr Cc: akpm@linux-foundation.org, urezki@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, rppt@kernel.org, catalin.marinas@arm.com, mhklinux@outlook.com Subject: Re: [RFC PATCH] mm/vmalloc: add vmalloc_decrypted() and vzalloc_decrypted() Message-ID: References: <20260521205834.1012925-1-kameroncarr@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: <20260521205834.1012925-1-kameroncarr@linux.microsoft.com> On Thu, May 21, 2026 at 01:58:34PM -0700, Kameron Carr wrote: > +/* > + * Transition a single contiguous block of @nr pages at index @idx in There's no parameter called @nr_pages; you probably meant @nr. > + * @area->pages to encrypted or decrypted state. On failure, the block's > + * page-pointer slots are cleared so the standard free path will not return > + * the pages to the allocator (they are leaked). > + */ > +static int __vm_pages_enc_dec(struct vm_struct *area, unsigned int idx, > + unsigned int nr, bool encrypt) This 'bool encrypt' parameter is an antipattern. Just split this into two functions. > +{ > + unsigned long addr = > + (unsigned long)kasan_reset_tag(page_address(area->pages[idx])); > + int err = encrypt ? set_memory_encrypted(addr, nr) : > + set_memory_decrypted(addr, nr); > + > + if (err) > + memset(&area->pages[idx], 0, nr * sizeof(*area->pages)); > + return err; > +} Does it really make sense to pass in 'area' and 'idx' rather than passing in &area->pages[idx]?