Re: [PATCH] alignment issue with ipchains

From: NIIBE Yutaka (gniibe@chroot.org)
Date: Fri Sep 08 2000 - 22:18:28 EST


Hi David,

I'd like to explain my point clearly. My point is that accessing with
get_user as int is questionable. In my case, it's string. I don't
think all the string argment to the kernel should be aligned.

David S. Miller wrote:
> Why not make sure in the user tools that the argument is properly
> aligned to 4 bytes?

Because (I think) it's not needed by the interface definition.

> I would really like to see specific examples of the failure before I
> consider this issue further.

OK, here's example (I'm talking about ipchains 1.3.8 or 9):

   # ipchains -F input

Here, on SuperH, the string of command line argument "input" is not
aligned to 4-byte boundary. The argument to main argv ("input") goes
through the setsockopt.

    main --> flush_entries --> libipfwc.c:ipfwc_flush_entries
        --> do_setsockopt --> setsockopt

For the optname IP_FW_APPEND...IP_FW_MASQ_CTL, the type of the value
is not integer but string. Accessing as int is rather violent.

I guess that on Sparc or Alpha the command line argument string is
4-byte aligned.

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Sep 15 2000 - 21:00:11 EST