On Tue, May 26, 2020 at 2:33 PM Theo de Raadt <dera...@openbsd.org> wrote: > > Jason A. Donenfeld <ja...@zx2c4.com> wrote: > > > Hey Klemens, > > > > On Tue, May 26, 2020 at 9:13 AM Klemens Nanni <k...@openbsd.org> wrote: > > > I worked with the patches from the wireguard-openbsd repository after > > > version one of this diff on tech@ became a bit old. > > > > > > That was until yesterday; the kernel would panic due to memory > > > alignment issues in various spots, `amd64# ping6 tunnel-ip.sparc64' > > > would receive a single ICMP6 echo reply from the sparc64 peer before > > > panicing its kernel very early in noise init code. > > > > > > I've had fixed a few bugs and ran into different panics during later > > > code paths. > > > > > > Fortunately, using "rev. 2" of your diff on top of a clean checkout just > > > works so far on sparc64 without any additional patches required - this > > > is a very pleasnt suprise and I can start looking at it under production > > > use cases more thoroughly now. > > > > That's good news that it's working for you now, but I didn't change > > anything within the last 24 hours (you mentioned "yesterday") that > > would seem related to this. So perhaps don't get too excited just yet. > > I've got a decent MIPS setup here and a hacked up qemu for having a > > bit more detail on alignment traps. I'll see if I can reproduce any > > issues. > > I suspect problems around forcing __packed. > > __packed is very dangerous. > > If you know the sizes of the objects are correctly sized and placed to > not have gap-pads, then not using __packed might be better.
Right, most times, uses of packed are wrong and can be avoided. I'll work through that all and see what can be minimized. In a cursory look I did see code to the effect of `struct { u32 a; u64 b; } __packed`, which could trap. Jason