[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#502845: open-iscsi: login fails using 64-bit kernel with 32-bit userland



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.

The 2nd patch is set up to not break the ABI for 32bit userspace, the first patch would indeed break the ABI (and hence the need for the 2nd one).

On Thu, 1 Nov 2012, Jonathan Nieder wrote:

Date: Thu, 1 Nov 2012 01:25:35 -0700
From: Jonathan Nieder <jrnieder@gmail.com>
To: Lisa Marie <nullogic@sdf.org>
Cc: 502845@bugs.debian.org, open-iscsi@packages.debian.org
Subject: Re: open-iscsi: login fails using 64-bit kernel with 32-bit userland

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:

#ifdef CONFIG_COMPAT
	compat_skb = alloc_skb(len, GFP_ATOMIC);
	... fill compat_skb ...

	skb_shinfo(skb)->frag_list = compat_skb;
#endif

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,
Jonathan

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


nullogic@sdf.org
SDF Public Access UNIX System - http://sdf.org


Reply to: