public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 1/2] net: sctp: minor: make jsctp_sf_eat_sack static
       [not found] <cover.1360752304.git.dborkman@redhat.com>
@ 2013-02-13 11:03 ` Daniel Borkmann
  2013-02-13 19:04   ` David Miller
  2013-02-13 21:02   ` Neil Horman
  2013-02-13 11:03 ` [PATCH net-next 2/2] net: sctp: add build check for sctp_sf_eat_sack_6_2/jsctp_sf_eat_sack Daniel Borkmann
  1 sibling, 2 replies; 7+ messages in thread
From: Daniel Borkmann @ 2013-02-13 11:03 UTC (permalink / raw)
  To: davem; +Cc: linux-sctp, netdev

The function jsctp_sf_eat_sack can be made static, no need to extend
its visibility.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
---
 net/sctp/probe.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/sctp/probe.c b/net/sctp/probe.c
index 5f7518d..4eaaaf6 100644
--- a/net/sctp/probe.c
+++ b/net/sctp/probe.c
@@ -122,12 +122,12 @@ static const struct file_operations sctpprobe_fops = {
 	.llseek = noop_llseek,
 };
 
-sctp_disposition_t jsctp_sf_eat_sack(struct net *net,
-				     const struct sctp_endpoint *ep,
-				     const struct sctp_association *asoc,
-				     const sctp_subtype_t type,
-				     void *arg,
-				     sctp_cmd_seq_t *commands)
+static sctp_disposition_t jsctp_sf_eat_sack(struct net *net,
+					    const struct sctp_endpoint *ep,
+					    const struct sctp_association *asoc,
+					    const sctp_subtype_t type,
+					    void *arg,
+					    sctp_cmd_seq_t *commands)
 {
 	struct sctp_transport *sp;
 	static __u32 lcwnd = 0;
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 2/2] net: sctp: add build check for sctp_sf_eat_sack_6_2/jsctp_sf_eat_sack
       [not found] <cover.1360752304.git.dborkman@redhat.com>
  2013-02-13 11:03 ` [PATCH net-next 1/2] net: sctp: minor: make jsctp_sf_eat_sack static Daniel Borkmann
@ 2013-02-13 11:03 ` Daniel Borkmann
  2013-02-13 21:15   ` Neil Horman
  1 sibling, 1 reply; 7+ messages in thread
From: Daniel Borkmann @ 2013-02-13 11:03 UTC (permalink / raw)
  To: davem; +Cc: linux-sctp, netdev

In order to avoid any future surprises of kernel panics due to jprobes
function mismatches (as e.g. fixed in 4cb9d6eaf85ecd: sctp: jsctp_sf_eat_sack:
fix jprobes function signature mismatch), we should check both function
types during build and scream loudly if they do not match. __same_type
resolves to __builtin_types_compatible_p, which is 1 in case both types
are the same and 0 otherwise, qualifiers are ignored. Tested by myself.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
---
 net/sctp/probe.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/sctp/probe.c b/net/sctp/probe.c
index 4eaaaf6..261b7b9 100644
--- a/net/sctp/probe.c
+++ b/net/sctp/probe.c
@@ -183,6 +183,13 @@ static __init int sctpprobe_init(void)
 {
 	int ret = -ENOMEM;
 
+	/* Warning: if the function signature of sctp_sf_eat_sack_6_2,
+	 * has been changed, you also have to change the signature of
+	 * jsctp_sf_eat_sack, otherwise you end up right here!
+	 */
+	BUILD_BUG_ON(__same_type(sctp_sf_eat_sack_6_2,
+				 jsctp_sf_eat_sack) == 0);
+
 	init_waitqueue_head(&sctpw.wait);
 	spin_lock_init(&sctpw.lock);
 	if (kfifo_alloc(&sctpw.fifo, bufsize, GFP_KERNEL))
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 1/2] net: sctp: minor: make jsctp_sf_eat_sack static
  2013-02-13 11:03 ` [PATCH net-next 1/2] net: sctp: minor: make jsctp_sf_eat_sack static Daniel Borkmann
@ 2013-02-13 19:04   ` David Miller
  2013-02-13 19:06     ` David Miller
  2013-02-13 21:02   ` Neil Horman
  1 sibling, 1 reply; 7+ messages in thread
From: David Miller @ 2013-02-13 19:04 UTC (permalink / raw)
  To: dborkman; +Cc: linux-sctp, netdev

From: Daniel Borkmann <dborkman@redhat.com>
Date: Wed, 13 Feb 2013 12:03:49 +0100

> The function jsctp_sf_eat_sack can be made static, no need to extend
> its visibility.
> 
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>

It's exported for the jprobe lookup by ->symbol_name

Did you test this?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 1/2] net: sctp: minor: make jsctp_sf_eat_sack static
  2013-02-13 19:04   ` David Miller
@ 2013-02-13 19:06     ` David Miller
  2013-02-13 19:14       ` Daniel Borkmann
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2013-02-13 19:06 UTC (permalink / raw)
  To: dborkman; +Cc: linux-sctp, netdev

From: David Miller <davem@davemloft.net>
Date: Wed, 13 Feb 2013 14:04:36 -0500 (EST)

> From: Daniel Borkmann <dborkman@redhat.com>
> Date: Wed, 13 Feb 2013 12:03:49 +0100
> 
>> The function jsctp_sf_eat_sack can be made static, no need to extend
>> its visibility.
>> 
>> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
> 
> It's exported for the jprobe lookup by ->symbol_name
> 
> Did you test this?

Never mind, I mis-read this, the symbol name is for the routine being
shadowed by the jprobe, which is exported.

These two patches look fine and I'll apply them, thanks Daniel.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 1/2] net: sctp: minor: make jsctp_sf_eat_sack static
  2013-02-13 19:06     ` David Miller
@ 2013-02-13 19:14       ` Daniel Borkmann
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Borkmann @ 2013-02-13 19:14 UTC (permalink / raw)
  To: David Miller; +Cc: linux-sctp, netdev

On 02/13/2013 08:06 PM, David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Wed, 13 Feb 2013 14:04:36 -0500 (EST)
>
>> From: Daniel Borkmann <dborkman@redhat.com>
>> Date: Wed, 13 Feb 2013 12:03:49 +0100
>>
>>> The function jsctp_sf_eat_sack can be made static, no need to extend
>>> its visibility.
>>>
>>> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
>>
>> It's exported for the jprobe lookup by ->symbol_name
>>
>> Did you test this?
>
> Never mind, I mis-read this, the symbol name is for the routine being
> shadowed by the jprobe, which is exported.
>
> These two patches look fine and I'll apply them, thanks Daniel.

Thanks Dave, yes, I did a test doing cat on /proc/net/sctpprobe
while running a simple SCTP client / server.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 1/2] net: sctp: minor: make jsctp_sf_eat_sack static
  2013-02-13 11:03 ` [PATCH net-next 1/2] net: sctp: minor: make jsctp_sf_eat_sack static Daniel Borkmann
  2013-02-13 19:04   ` David Miller
@ 2013-02-13 21:02   ` Neil Horman
  1 sibling, 0 replies; 7+ messages in thread
From: Neil Horman @ 2013-02-13 21:02 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: davem, linux-sctp, netdev

On Wed, Feb 13, 2013 at 12:03:49PM +0100, Daniel Borkmann wrote:
> The function jsctp_sf_eat_sack can be made static, no need to extend
> its visibility.
> 
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
> ---
>  net/sctp/probe.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/net/sctp/probe.c b/net/sctp/probe.c
> index 5f7518d..4eaaaf6 100644
> --- a/net/sctp/probe.c
> +++ b/net/sctp/probe.c
> @@ -122,12 +122,12 @@ static const struct file_operations sctpprobe_fops = {
>  	.llseek = noop_llseek,
>  };
>  
> -sctp_disposition_t jsctp_sf_eat_sack(struct net *net,
> -				     const struct sctp_endpoint *ep,
> -				     const struct sctp_association *asoc,
> -				     const sctp_subtype_t type,
> -				     void *arg,
> -				     sctp_cmd_seq_t *commands)
> +static sctp_disposition_t jsctp_sf_eat_sack(struct net *net,
> +					    const struct sctp_endpoint *ep,
> +					    const struct sctp_association *asoc,
> +					    const sctp_subtype_t type,
> +					    void *arg,
> +					    sctp_cmd_seq_t *commands)
>  {
>  	struct sctp_transport *sp;
>  	static __u32 lcwnd = 0;
> -- 
> 1.7.11.7
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 2/2] net: sctp: add build check for sctp_sf_eat_sack_6_2/jsctp_sf_eat_sack
  2013-02-13 11:03 ` [PATCH net-next 2/2] net: sctp: add build check for sctp_sf_eat_sack_6_2/jsctp_sf_eat_sack Daniel Borkmann
@ 2013-02-13 21:15   ` Neil Horman
  0 siblings, 0 replies; 7+ messages in thread
From: Neil Horman @ 2013-02-13 21:15 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: davem, linux-sctp, netdev

On Wed, Feb 13, 2013 at 12:03:50PM +0100, Daniel Borkmann wrote:
> In order to avoid any future surprises of kernel panics due to jprobes
> function mismatches (as e.g. fixed in 4cb9d6eaf85ecd: sctp: jsctp_sf_eat_sack:
> fix jprobes function signature mismatch), we should check both function
> types during build and scream loudly if they do not match. __same_type
> resolves to __builtin_types_compatible_p, which is 1 in case both types
> are the same and 0 otherwise, qualifiers are ignored. Tested by myself.
> 
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
> ---
>  net/sctp/probe.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/net/sctp/probe.c b/net/sctp/probe.c
> index 4eaaaf6..261b7b9 100644
> --- a/net/sctp/probe.c
> +++ b/net/sctp/probe.c
> @@ -183,6 +183,13 @@ static __init int sctpprobe_init(void)
>  {
>  	int ret = -ENOMEM;
>  
> +	/* Warning: if the function signature of sctp_sf_eat_sack_6_2,
> +	 * has been changed, you also have to change the signature of
> +	 * jsctp_sf_eat_sack, otherwise you end up right here!
> +	 */
> +	BUILD_BUG_ON(__same_type(sctp_sf_eat_sack_6_2,
> +				 jsctp_sf_eat_sack) == 0);
> +
>  	init_waitqueue_head(&sctpw.wait);
>  	spin_lock_init(&sctpw.lock);
>  	if (kfifo_alloc(&sctpw.fifo, bufsize, GFP_KERNEL))
> -- 
> 1.7.11.7
Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-02-13 21:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1360752304.git.dborkman@redhat.com>
2013-02-13 11:03 ` [PATCH net-next 1/2] net: sctp: minor: make jsctp_sf_eat_sack static Daniel Borkmann
2013-02-13 19:04   ` David Miller
2013-02-13 19:06     ` David Miller
2013-02-13 19:14       ` Daniel Borkmann
2013-02-13 21:02   ` Neil Horman
2013-02-13 11:03 ` [PATCH net-next 2/2] net: sctp: add build check for sctp_sf_eat_sack_6_2/jsctp_sf_eat_sack Daniel Borkmann
2013-02-13 21:15   ` Neil Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox