diff mbox

[ipsec-next] xfrm: Do not parse 32bits compiled xfrm netlink msg on 64bits host

Message ID 1422327262-6344-1-git-send-email-fan.du@intel.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Fan Du Jan. 27, 2015, 2:54 a.m. UTC
structure like xfrm_usersa_info or xfrm_userpolicy_info
has different sizeof when compiled as 32bits and 64bits
due to not appending pack attribute in their definition.
This will result in broken SA and SP information when user
trying to configure them through netlink interface.

Inform user land about this situation instead of keeping
silent, the upper test scripts would behave accordingly.

Quotes from: http://marc.info/?l=linux-netdev&m=142226348715503&w=2
>
> Before a clean solution show up, I think it's better to warn user in some way
> like http://patchwork.ozlabs.org/patch/323842/ did. Otherwise, many people
> who stuck there will always spend time and try to fix this issue in whatever way.

Yes, this is the first thing we should do. I'm willing to accept a patch

Signed-off-by: Fan Du <fan.du@intel.com>
---
ChangeLog:
v2:
  - Rebase with latest tree

---
 net/xfrm/xfrm_user.c |    5 +++++
 1 file changed, 5 insertions(+)

Comments

David Miller Jan. 27, 2015, 7:39 a.m. UTC | #1
From: Fan Du <fan.du@intel.com>
Date: Tue, 27 Jan 2015 10:54:22 +0800

> @@ -2419,6 +2419,11 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
>  	const struct xfrm_link *link;
>  	int type, err;
>  
> +#ifdef CONFIG_COMPAT
> +	if (is_compat_task())
> +		return -EPERM;
> +#endif
> +

This seems more like an unsupported operation rather then a permission
problem.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
FengYu LeiDian Jan. 27, 2015, 7:44 a.m. UTC | #2
于 2015年01月27日 15:39, David Miller 写道:
> From: Fan Du <fan.du@intel.com>
> Date: Tue, 27 Jan 2015 10:54:22 +0800
>
>> @@ -2419,6 +2419,11 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
>>   	const struct xfrm_link *link;
>>   	int type, err;
>>
>> +#ifdef CONFIG_COMPAT
>> +	if (is_compat_task())
>> +		return -EPERM;
>> +#endif
>> +
>
> This seems more like an unsupported operation rather then a permission
> problem.
>
how about *ENOTSUPP* ?
David Miller Jan. 27, 2015, 8:12 a.m. UTC | #3
From: Fan Du <fengyuleidian0615@gmail.com>
Date: Tue, 27 Jan 2015 15:44:36 +0800

> 于 2015年01月27日 15:39, David Miller 写道:
>> From: Fan Du <fan.du@intel.com>
>> Date: Tue, 27 Jan 2015 10:54:22 +0800
>>
>>> @@ -2419,6 +2419,11 @@ static int xfrm_user_rcv_msg(struct sk_buff
>>> *skb, struct nlmsghdr *nlh)
>>>   	const struct xfrm_link *link;
>>>   	int type, err;
>>>
>>> +#ifdef CONFIG_COMPAT
>>> +	if (is_compat_task())
>>> +		return -EPERM;
>>> +#endif
>>> +
>>
>> This seems more like an unsupported operation rather then a permission
>> problem.
>>
> how about *ENOTSUPP* ?

Unquestionably, that is an improvement over EPERM.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bill Fink Jan. 27, 2015, 11:32 p.m. UTC | #4
On Tue, 27 Jan 2015, David Miller wrote:

> From: Fan Du <fengyuleidian0615@gmail.com>
> Date: Tue, 27 Jan 2015 15:44:36 +0800
> 
> > 于 2015年01月27日 15:39, David Miller 写道:
> >> From: Fan Du <fan.du@intel.com>
> >> Date: Tue, 27 Jan 2015 10:54:22 +0800
> >>
> >>> @@ -2419,6 +2419,11 @@ static int xfrm_user_rcv_msg(struct sk_buff
> >>> *skb, struct nlmsghdr *nlh)
> >>>   	const struct xfrm_link *link;
> >>>   	int type, err;
> >>>
> >>> +#ifdef CONFIG_COMPAT
> >>> +	if (is_compat_task())
> >>> +		return -EPERM;
> >>> +#endif
> >>> +
> >>
> >> This seems more like an unsupported operation rather then a permission
> >> problem.
> >>
> > how about *ENOTSUPP* ?
> 
> Unquestionably, that is an improvement over EPERM.

But it should be EOPNOTSUPP rather than ENOTSUP, right?

					-Bill
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 8128594..f960bd9 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2419,6 +2419,11 @@  static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 	const struct xfrm_link *link;
 	int type, err;
 
+#ifdef CONFIG_COMPAT
+	if (is_compat_task())
+		return -EPERM;
+#endif
+
 	type = nlh->nlmsg_type;
 	if (type > XFRM_MSG_MAX)
 		return -EINVAL;