Page MenuHomeFreeBSD

DIOCGSECTORSIZE expects to write to a u_int, but the struct zfs_probe_args member secsz is uint16_t
ClosedPublic

Authored by allanjude on Jan 7 2016, 1:45 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Aug 4, 6:27 AM
Unknown Object (File)
Mon, Jul 28, 4:25 AM
Unknown Object (File)
Jul 12 2025, 2:57 AM
Unknown Object (File)
Jul 7 2025, 2:29 PM
Unknown Object (File)
Jul 3 2025, 9:04 PM
Unknown Object (File)
Jun 23 2025, 8:20 PM
Unknown Object (File)
Jun 13 2025, 4:12 AM
Unknown Object (File)
Jun 12 2025, 4:07 AM
Subscribers

Details

Summary

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=204358
Submitted by Toomas Soome

sys/boot/zfs/zfs.c has probe args structure including uint16_t secsz variable for media sector size; its used as an argument for ioctl() at line 484

however, this ioctl is expecting 32bit data (u_int *) and therefore this ioctl will overwrite and corrupt 16bits of memory.
other use cases seem to use correct u_int type for secsz.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

allanjude retitled this revision from to DIOCGSECTORSIZE expects to write to a u_int, but the struct zfs_probe_args member secsz is uint16_t.
allanjude updated this object.
allanjude edited the test plan for this revision. (Show Details)
allanjude added reviewers: smh, delphij, asomers, avg, gibbs, will.
asomers edited edge metadata.

LGTM from inspection. If you'd like, I can test it on Monday.

This revision is now accepted and ready to land.Jan 9 2016, 12:09 AM
delphij added a subscriber: tsoome.
delphij edited edge metadata.

This change is reasonable.

smh edited edge metadata.
This revision was automatically updated to reflect the committed changes.