[Pkg-iscsi-maintainers] open-iscsi: login fails using 64-bit kernel with 32-bit userland

Jonathan Nieder jrnieder at gmail.com
Thu Nov 1 08:25:35 UTC 2012

Hi Lisa,

Lisa Marie wrote:

> [Subject: (no subject)]

Please keep in mind that these appear as emails in a crowded inbox, where
a subject line can be very useful for providing context.

> Forwarding this: https://groups.google.com/group/open-iscsi/browse_thread/thread/7b44b4b57f01eb70?hl=en#
> Since I'm not sure how long it takes google groups to update, i'll go ahead
> and paste the patch here as well below.
> If you apply the first patch from the above link, the second patch below is
> not needed. It is only required for a 32bit userspace to talk to an
> unpatched 32bit kernel. The first patch allows for 64/64, 32/32, and 32/64
> user/kernel setups.

Thanks for working on this!

Your patches have no effect in the 64bit case (good).  In the 32bit
case, they break ABI, so they are a no-go, unfortunately.  The
userspace patch is especially dangerous, since it would make this
bug impossible to fix properly later.

Userspace processes using iscsi start by creating a netlink socket
with socket(PF_NETLINK, SOCK_RAW, NETLINK_ISCSI) and binding to it.
Afterwards, they use sendmsg and recvmsg as appropriate to send and
receive events.

We need to use a different message format when interacting with 32bit
tasks.  Kernel commit 1dacc76d0014 (net/compat/wext: send different
messages to compat tasks, 2009-07-01) can provide some inspiration.

In the send path, the way to do this is to set frag_list to the 32bit
version of the structure, like so:

	compat_skb = alloc_skb(len, GFP_ATOMIC);
	... fill compat_skb ...

	skb_shinfo(skb)->frag_list = compat_skb;

Then on a 64bit kernel, 32bit processes will receive compat_skb
instead of skb.  No ABI breakage!

So much for broadcast.  When receiving messages from userspace, we
want to know whether a 32bit process sent the message.  The netlink
API doesn't tell us.  The patch [1] ("netlink: store MSG_CMSG_COMPAT
flag in netlink_skb_parms") is simple and something similar would be
likely to be accepted once there's a caller using it.

Hope that helps,

[1] http://thread.gmane.org/gmane.linux.network/157118/focus=157119

More information about the Pkg-iscsi-maintainers mailing list