Re: [PATCH 5/7] ecryptfs: sanitize struct iattr handling in truncate_upper
Tyler Hicks <[email protected]> Mon, 6 Apr 2026 01:59:19 -0500
| Newsgroups | org.kernel.vger.ecryptfs,org.kernel.vger.linux-fsdevel |
|---|---|
| Message-ID | <adNZx4T-Beljry59@yaupon> |
On 2026-04-06 08:27:13, Christoph Hellwig wrote: > On Mon, Apr 06, 2026 at 01:22:53AM -0500, Tyler Hicks wrote: > > Err... that was a bad suggestion. upper_size should be a loff_t but, now > > that I'm at the end of the patch series review, I see that's essentially > > the signature of ecryptfs_truncate() but I'm still not understanding why > > we're sticking the upper inode size into the lower_ia. > > Because that's what the existing setattr path already does by doing a > memcpy of the upper ia. We can explicitly pass it as a separate > argument, but I'm not really sure that clarifies things as all other > information gets passed in lower_ia. I could add a big comment explaining > all this if it helps? It took me some time to figure out, so I might as > well share that with the world. I think the intent of the current code is to copy all of the existing iattrs, from upper to lower, but treat lower_ia->ia_size as "uninitialized" and calculate/initialize it accordingly within truncate_upper(). I don't think the passed in value of lower_ia->ia_size was being used anywhere. I would prefer passing the new upper size as a separate argument. The end result of this patch series is very nice. Thanks for working on it! Tyler