I'm curious as to what would prevent you from running a 64-bit iscsid in this 
case, but that's OK.

The real fix, without breaking backwards compatibility, is going to need to be 
a kernel patch to use the 32-bit layout when talking to a compat process.  It's 
not as straightforward with netlink as ioctls, but I think it's doable if 
needed.  There are other kernel features that punt on 32/64 compat, like IP 
XFRM, and we should at least fail sanely if it's not going to be supported.

The other option, breaking the interface, is to fix the alignment in the 32-bit 
tools to match the 64-bit kernel.  This test patch should work if you define 
BUILD_32_64.  I've checked the resulting layout of everything in iscsi_if.h.  
That will build 32-bit binaries that only work on a 64-bit kernel.

-Chris

---

diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index 9d15811..758dc0a 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -37,6 +37,13 @@
 #define KEVENT_BASE                    100
 #define ISCSI_ERR_BASE                 1000
 
+/* internal allignment hack to build a 32-bit binary to run a on 64-bit kernel 
*/
+#ifdef BUILD_32_64
+       #define __32_64_fix(x) __attribute__((aligned (x)))
+#else
+       #define __32_64_fix(x)
+#endif
+
 enum iscsi_uevent_e {
        ISCSI_UEVENT_UNKNOWN            = 0,
 
@@ -254,8 +261,7 @@ struct iscsi_uevent {
                struct msg_get_host_stats {
                        uint32_t        host_no;
                } get_host_stats;
-
-       } u;
+       } __32_64_fix(sizeof(uint64_t)) u;
        union {
                /* messages k -> u */
                int                     retcode;
@@ -315,7 +321,7 @@ struct iscsi_uevent {
                struct msg_new_flashnode_ret {
                        uint32_t        flashnode_idx;
                } new_flashnode_ret;
-       } r;
+       } __32_64_fix(sizeof(uint64_t)) r;
 } __attribute__ ((aligned (sizeof(uint64_t))));
 
 enum iscsi_param_type {

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index 9d15811..758dc0a 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -37,6 +37,13 @@
 #define KEVENT_BASE			100
 #define ISCSI_ERR_BASE			1000
 
+/* internal allignment hack to build a 32-bit binary to run a on 64-bit kernel */
+#ifdef BUILD_32_64
+	#define __32_64_fix(x) __attribute__((aligned (x)))
+#else
+	#define __32_64_fix(x)
+#endif
+
 enum iscsi_uevent_e {
 	ISCSI_UEVENT_UNKNOWN		= 0,
 
@@ -254,8 +261,7 @@ struct iscsi_uevent {
 		struct msg_get_host_stats {
 			uint32_t	host_no;
 		} get_host_stats;
-
-	} u;
+	} __32_64_fix(sizeof(uint64_t)) u;
 	union {
 		/* messages k -> u */
 		int			retcode;
@@ -315,7 +321,7 @@ struct iscsi_uevent {
 		struct msg_new_flashnode_ret {
 			uint32_t	flashnode_idx;
 		} new_flashnode_ret;
-	} r;
+	} __32_64_fix(sizeof(uint64_t)) r;
 } __attribute__ ((aligned (sizeof(uint64_t))));
 
 enum iscsi_param_type {

Reply via email to