Skip to contentSkip to conversation

Unaligned access in sk_run_filter

NET Dmitry Mishin 2 participants 2 messages Feb 20, 2006 netfilter

lore
Share & tools
lore
#0 lore raw

Hello,

We have an issue on ia64 box. It is easy triggerable 'kernel unaligned access' in sk_run_filter:

         ptr = load_pointer(skb, k, 4, &tmp);
         if (ptr != NULL) {
                  A = ntohl(*(u32 *)ptr); << here
                  continue;
         }

due to 'k' is coming from userspace it can be easy triggered, e.g.:
[root@node1 ~]# tcpdump -i eth0 'ip[1:2]=0'

Could you advise how to fix this?

Signature · 2 lines
Thanks,
Dmitry.
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Dmitry" == Dmitry Mishin <[email protected]> writes:

Dmitry> Hello, We have an issue on ia64 box. It is easy triggerable Dmitry> 'kernel unaligned access' in sk_run_filter:

Dmitry> ptr = load_pointer(skb, k, 4, &tmp);
Dmitry> if (ptr != NULL) {
Dmitry> A = ntohl(*(u32 *)ptr); << here

Change the above line to something like this:

                        A = ntohl(get_unaligned((u32*)ptr));

And add an #include <asm/unaligned.h>

Cheers,
Jes