diff mbox

ip_vs_sh: fix build

Message ID 51A611CF02000078000D99A6@nat28.tlf.novell.com
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Jan Beulich May 29, 2013, 12:33 p.m. UTC
kfree_rcu() requires offsetof(..., rcu_head) < 4096, which can get
violated with a sufficiently high CONFIG_IP_VS_SH_TAB_BITS.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

---
 net/netfilter/ipvs/ip_vs_sh.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)




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

Comments

Simon Horman May 29, 2013, 2:59 p.m. UTC | #1
On Wed, May 29, 2013 at 01:33:51PM +0100, Jan Beulich wrote:
> kfree_rcu() requires offsetof(..., rcu_head) < 4096, which can get
> violated with a sufficiently high CONFIG_IP_VS_SH_TAB_BITS.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Thanks Jan.

Pablo, could you take this one directly into your tree?

Signed-off-by: Simon Horman <horms@verge.net.au>

> 
> ---
>  net/netfilter/ipvs/ip_vs_sh.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- 3.10-rc3/net/netfilter/ipvs/ip_vs_sh.c
> +++ 3.10-rc3-ip_vs_sh-build/net/netfilter/ipvs/ip_vs_sh.c
> @@ -67,8 +67,8 @@ struct ip_vs_sh_bucket {
>  #define IP_VS_SH_TAB_MASK               (IP_VS_SH_TAB_SIZE - 1)
>  
>  struct ip_vs_sh_state {
> -	struct ip_vs_sh_bucket		buckets[IP_VS_SH_TAB_SIZE];
>  	struct rcu_head			rcu_head;
> +	struct ip_vs_sh_bucket		buckets[IP_VS_SH_TAB_SIZE];
>  };
>  
>  /*
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
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
Pablo Neira Ayuso May 29, 2013, 3:51 p.m. UTC | #2
On Wed, May 29, 2013 at 11:59:06PM +0900, Simon Horman wrote:
> On Wed, May 29, 2013 at 01:33:51PM +0100, Jan Beulich wrote:
> > kfree_rcu() requires offsetof(..., rcu_head) < 4096, which can get
> > violated with a sufficiently high CONFIG_IP_VS_SH_TAB_BITS.
> > 
> > Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Thanks Jan.
> 
> Pablo, could you take this one directly into your tree?
> 
> Signed-off-by: Simon Horman <horms@verge.net.au>

Applied, thanks Simon.
--
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
Julian Anastasov May 29, 2013, 7:31 p.m. UTC | #3
Hello,

On Wed, 29 May 2013, Jan Beulich wrote:

> kfree_rcu() requires offsetof(..., rcu_head) < 4096, which can get
> violated with a sufficiently high CONFIG_IP_VS_SH_TAB_BITS.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> ---
>  net/netfilter/ipvs/ip_vs_sh.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- 3.10-rc3/net/netfilter/ipvs/ip_vs_sh.c
> +++ 3.10-rc3-ip_vs_sh-build/net/netfilter/ipvs/ip_vs_sh.c
> @@ -67,8 +67,8 @@ struct ip_vs_sh_bucket {
>  #define IP_VS_SH_TAB_MASK               (IP_VS_SH_TAB_SIZE - 1)
>  
>  struct ip_vs_sh_state {
> -	struct ip_vs_sh_bucket		buckets[IP_VS_SH_TAB_SIZE];
>  	struct rcu_head			rcu_head;
> +	struct ip_vs_sh_bucket		buckets[IP_VS_SH_TAB_SIZE];

	Your fix reminds me about the same problem
I noticed for LBLC (may be due to 10 bits) during development
but forgot to check the other schedulers. The same solution
is needed also for DH. OTOH, LBLC and LBLCR are correct.
Do you prefer to provide similar fix for ip_vs_dh.c or
I have to take care?

>  };
>  
>  /*

Regards

--
Julian Anastasov <ja@ssi.bg>
--
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
Jan Beulich May 30, 2013, 5:48 a.m. UTC | #4
>>> Julian Anastasov <ja@ssi.bg> 05/29/13 9:28 PM >>>
>On Wed, 29 May 2013, Jan Beulich wrote:
>> --- 3.10-rc3/net/netfilter/ipvs/ip_vs_sh.c
>> +++ 3.10-rc3-ip_vs_sh-build/net/netfilter/ipvs/ip_vs_sh.c
>> @@ -67,8 +67,8 @@ struct ip_vs_sh_bucket {
>>  #define IP_VS_SH_TAB_MASK               (IP_VS_SH_TAB_SIZE - 1)
>>  
>>  struct ip_vs_sh_state {
>> -    struct ip_vs_sh_bucket        buckets[IP_VS_SH_TAB_SIZE];
>>      struct rcu_head            rcu_head;
>> +    struct ip_vs_sh_bucket        buckets[IP_VS_SH_TAB_SIZE];
>
>    Your fix reminds me about the same problem
>I noticed for LBLC (may be due to 10 bits) during development
>but forgot to check the other schedulers. The same solution
>is needed also for DH. OTOH, LBLC and LBLCR are correct.
>Do you prefer to provide similar fix for ip_vs_dh.c or
>I have to take care?

CONFIG_IP_VS_DH_TAB_BITS is always 8 (due to not coming from any
Kconfig setting), and hence not a problem at this point. If it is being planned
to make configurable, then that change should at once flip the structure
members.

Jan

--
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
Julian Anastasov May 30, 2013, 6:42 a.m. UTC | #5
Hello,

On Thu, 30 May 2013, Jan Beulich wrote:

> CONFIG_IP_VS_DH_TAB_BITS is always 8 (due to not coming from any
> Kconfig setting), and hence not a problem at this point. If it is being planned
> to make configurable, then that change should at once flip the structure
> members.

	Aha, OK.

Regards

--
Julian Anastasov <ja@ssi.bg>
--
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

--- 3.10-rc3/net/netfilter/ipvs/ip_vs_sh.c
+++ 3.10-rc3-ip_vs_sh-build/net/netfilter/ipvs/ip_vs_sh.c
@@ -67,8 +67,8 @@  struct ip_vs_sh_bucket {
 #define IP_VS_SH_TAB_MASK               (IP_VS_SH_TAB_SIZE - 1)
 
 struct ip_vs_sh_state {
-	struct ip_vs_sh_bucket		buckets[IP_VS_SH_TAB_SIZE];
 	struct rcu_head			rcu_head;
+	struct ip_vs_sh_bucket		buckets[IP_VS_SH_TAB_SIZE];
 };
 
 /*