lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 9 Nov 2023 09:27:11 -0800 From: Andrew Morton <akpm@...ux-foundation.org> To: Andreas Grünbacher <andreas.gruenbacher@...il.com> Cc: "Matthew Wilcox (Oracle)" <willy@...radead.org>, linux-ext4 <linux-ext4@...r.kernel.org>, gfs2@...ts.linux.dev, Linux FS-devel Mailing List <linux-fsdevel@...r.kernel.org>, linux-xfs <linux-xfs@...r.kernel.org>, "Darrick J . Wong" <djwong@...nel.org>, linux-erofs@...ts.ozlabs.org, "Theodore Ts'o" <tytso@....edu>, Andreas Dilger <adilger.kernel@...ger.ca>, Andreas Gruenbacher <agruenba@...hat.com> Subject: Re: [PATCH 1/3] mm: Add folio_zero_tail() and use it in ext4 On Thu, 9 Nov 2023 01:12:15 +0100 Andreas Grünbacher <andreas.gruenbacher@...il.com> wrote: > Andrew, > > Andrew Morton <akpm@...ux-foundation.org> schrieb am Do., 9. Nov. 2023, 00:06: > > > + > > > + if (folio_test_highmem(folio)) { > > > + size_t max = PAGE_SIZE - offset_in_page(offset); > > > + > > > + while (len > max) { > > > > Shouldn't this be `while (len)'? AFAICT this code can fail to clear > > the final page. > > not sure what you're seeing there, but this looks fine to me. I was right! This code does fail to handle the final page. : static inline void folio_fill_tail(struct folio *folio, size_t offset, : const char *from, size_t len) : { : char *to = kmap_local_folio(folio, offset); : : VM_BUG_ON(offset + len > folio_size(folio)); : : if (folio_test_highmem(folio)) { : size_t max = PAGE_SIZE - offset_in_page(offset); : : while (len > max) { : memcpy(to, from, max); : kunmap_local(to); : len -= max; : from += max; : offset += max; : max = PAGE_SIZE; : to = kmap_local_folio(folio, offset); : } : } : : memcpy(to, from, len); This code down here handles it, doh. : to = folio_zero_tail(folio, offset, to); : kunmap_local(to); : } Implementation seems less straightforward than it might be? Oh well. Has it been runtime tested? Anyway, let's please change the function argument ordering and remember to cc linux-mm on v2?
Powered by blists - more mailing lists