Page MenuHomeFreeBSD

Fix inode extra time fields overflow.
ClosedPublic

Authored by fsu on Apr 22 2021, 5:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 17 2024, 11:53 PM
Unknown Object (File)
Jan 14 2024, 4:59 AM
Unknown Object (File)
Dec 26 2023, 9:40 AM
Unknown Object (File)
Dec 22 2023, 11:19 PM
Unknown Object (File)
Dec 15 2023, 11:35 PM
Unknown Object (File)
Nov 23 2023, 9:15 PM
Unknown Object (File)
Nov 19 2023, 11:44 AM
Unknown Object (File)
Nov 12 2023, 4:12 PM
Subscribers
None

Details

Summary

Make inode extra time fields updating logic more closer to linux.

Test Plan

Found using pjdfstest:
pjdfstest/tests/utimensat/09.t

Testcase passed successfully.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

fsu requested review of this revision.Apr 22 2021, 5:25 PM
fsu created this revision.
pfg requested changes to this revision.Apr 22 2021, 8:49 PM

Do not touch inode.h.

You can use inline functions to replace the macros and perhaps with some casting you can get over the issues.

sys/fs/ext2fs/inode.h
103–106

These changes are wrong. Long discussion with bde@ showed we should not diverge from UFS here and the kernel won't handle anything different different than int32_t.

This revision now requires changes to proceed.Apr 22 2021, 8:49 PM
sys/fs/ext2fs/inode.h
103–106

I think we not diverge from ufs so mach, you can check struct ufs2_dinode and ufs_time_t typedef, where ufs_time_t is int64_t.

While the ext_time_t approach is valid and it also consistent with UFS2, it is usually faster to use 32bit values so you *could* use casts. Either way is valid so I won't object.

sys/fs/ext2fs/ext2_inode_cnv.c
96–97

You are replacing a macro so use inline here

105

use inline here, and move it nearer to the place where it will be used.: basically where the macro was.

sys/fs/ext2fs/inode.h
103–106

I see: I was looking at ufs1_dinode while you are using ufs2_dinode.
last time I looked at linux these were uint32_t so casting should be enough.

This revision is now accepted and ready to land.Apr 23 2021, 4:23 PM