tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: RFC: New userspace fetch/store API



On Sat, Feb 23, 2019 at 04:40:40PM -0800, Jason Thorpe wrote:
 > >> i like this.  the current API is ... odd.
 > >> 
 > >> can you add alignment documentation?  eg, if only to say that it
 > >> must support aligned or unaligned accesses for the relevant
 > >> datatypes.  not sure what we need currently, ie, if unaligned is
 > >> needed because that happens today, or we can define it as wrong
 > >> in this API.
 > > 
 > > Yah, I?ll make that clear.  It?s implicit in the current API (alpha would blow up otherwise), but I will make it explicit.
 > 
 > I added the following:
 > 
 > <quote>
 > All addresses MUST be naturally-aligned for their type.  If unaligned
 > access is required, use copy(9).
 > </quote>
 > 
 > OK?

Given that the predominant use of these is to fetch from user-supplied
pointers, which can be crap, it would best to include an alignment
check; otherwise ~all call sites will require explicit checks, which
in addition to being error-prone start running into annoying
portability questions.

(On at least some platforms the alignment check is free, also, because
an alignment fault during the access will be caught by the copyin
fault logic.)

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index