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



The following reply was made to PR kern/44964; it has been noted by GNATS.

From: christos%zoulas.com@localhost (Christos Zoulas)
To: gnats-bugs%NetBSD.org@localhost, kern-bug-people%netbsd.org@localhost, 
        gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost, 
        Taylor R Campbell <campbell+netbsd%mumble.net@localhost>
Cc: 
Subject: Re: kern/44964: cgd seems to panic on unaligned writes instead of 
giving EINVAL
Date: Sat, 14 May 2011 11:10:24 -0400

 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