Commit 222229974824a4f30b417531cdc9b5b869d6a6b7

Authored by Daniel Borkmann
Committed by David S. Miller
1 parent 1e55817463

net: sctp: add build check for sctp_sf_eat_sack_6_2/jsctp_sf_eat_sack

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>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 7 additions and 0 deletions Side-by-side Diff

... ... @@ -183,6 +183,13 @@
183 183 {
184 184 int ret = -ENOMEM;
185 185  
  186 + /* Warning: if the function signature of sctp_sf_eat_sack_6_2,
  187 + * has been changed, you also have to change the signature of
  188 + * jsctp_sf_eat_sack, otherwise you end up right here!
  189 + */
  190 + BUILD_BUG_ON(__same_type(sctp_sf_eat_sack_6_2,
  191 + jsctp_sf_eat_sack) == 0);
  192 +
186 193 init_waitqueue_head(&sctpw.wait);
187 194 spin_lock_init(&sctpw.lock);
188 195 if (kfifo_alloc(&sctpw.fifo, bufsize, GFP_KERNEL))