NetBSD-Bugs archive

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

Re: kern/44964: cgd seems to panic on unaligned writes instead of giving EINVAL



On May 14,  5:15am, campbell+netbsd%mumble.net@localhost (Taylor R Campbell) 
wrote:
-- Subject: Re: kern/44964: cgd seems to panic on unaligned writes instead of

|  (1.22, presumably.)  I don't think this fully fixes the problem: other
|  parts of cgd are not prepared to handle unaligned writes.  For
|  example, cgd_cipher requires that len be an integral multiple of
|  blocksize (by assertion) and an integral multiple of secsize (by
|  subtracting secsize from the size_t len until len is zero).
|  
|  Also, I'm worried that using 8-bit operations rather than 32-bit
|  operations will hurt performance; have you compared the performance
|  before and after?

I don't think that it is going to be that bad, because the code is
using GETU32() PUTU32() in other parts to handle unaligned reads
and writes which is even more expensive.
|
|  How about the following patch to reject unaligned writes?  Untested,
|  but I'll test it in the next couple days if I get a chance.

I agree, commit that patch. cgd will not work properly anyway. But I would
also leave my patch in, because this was the only part of the code that
did not handle unaligned buffers.

christos


Home | Main Index | Thread Index | Old Index