OpenSolaris

Printable Version Enter a New Search
Bug ID 6575316
Synopsis snode flags has run out of space
State 10-Fix Delivered (Fix available in build)
Category:Subcategory kernel:devfs
Keywords
Responsible Engineer Vikram Hegde
Reported Against
Duplicate Of
Introduced In solaris_nevada
Commit to Fix snv_69
Fixed In snv_69
Release Fixed solaris_nevada(snv_69)
Related Bugs
Submit Date 28-June-2007
Last Update Date 19-July-2007
Description
The s_flag field in the snode structure (core data structure of specfs) is a ushort_t. With the integration of a recent bugfix, the last flag available (0x8000) has been taken, leaving no more space for other flags. Since drivers could potentially dereference an snode pointer (it is not opaque like a devinfo node), it may not be safe to expand the s_flag field as it will change the offset of subsequent fields. Instead we propose adding a new field at the end of the snode struct. This new field will be s_auxflag and will be a uint32_t.
Chris Horne pointed out that the s_flag field although a "short" is bracketed by two 4 byte(x86)/8 byte(sparcv9/amd64)  fields (s_size and s_fsid) so there is likely to be some padding to meet alignment restrictions and/or the C "array" rule. Indeed a look via mdb shows the following


sparcv9
========
> ::offsetof "struct snode" s_flag
offsetof (struct snode, s_flag) = 0x50
> ::offsetof "struct snode" s_fsid
offsetof (struct snode, s_fsid) = 0x58

i386
=====
> ::offsetof "struct snode" s_flag
offsetof (struct snode, s_flag) = 0x30
> ::offsetof "struct snode" s_fsid
offsetof (struct snode, s_fsid) = 0x34

amd64
======
> ::offsetof "struct snode" s_flag
offsetof (struct snode, s_flag) = 0x50
> ::offsetof "struct snode" s_fsid
offsetof (struct snode, s_fsid) = 0x58


 So to summarize, due to existing unused padding space, it is safe to extend the size of the s_flag field from a ushort_t to a uint_t. The offsets of subsequent fields will be unaffected by the extension of the s_flag field.
Work Around
N/A
Comments
N/A