Image credit: [**pixabay**](https://pixabay.com/) Image credit: pixabay

libnids on 64-bit architecture machines

A quick note for anybody using libnids on a 64-bit machine (AMD64), you will need to compile with -fno-strict-aliasing if you use optimisation at -O2 or above. Without it libnids will silently fail to provide you any data.

Rafal (the original author of libnids) posted some sample broken code in Ubuntu bug #1072650. There is also Gentoo bug #505026 with further information about how the libnids code breaks strict-aliasing rules. There are some good explanations online about this rule, especially in this PDF.

GCC should provide a warning about this, but apparently these bugs are quite hard to detect. GCC bug #60581 has further details.

So until the libnids code is fixed (which might not be soon unless somebody patches it) package maintainers for AMD64 should pass -fno-strict-aliasing in CFLAGS when building packages.

David Cannings
David Cannings
Cyber Security

My interests include computer security, digital electronics and writing tools to help analysis of cyber attacks.