* [PATCH] xfrm: fix xfrm_input/xfrm_tunnel_check oops
@ 2015-04-02 7:58 Alexey Dobriyan
2015-04-07 8:57 ` Steffen Klassert
0 siblings, 1 reply; 5+ messages in thread
From: Alexey Dobriyan @ 2015-04-02 7:58 UTC (permalink / raw)
To: davem; +Cc: mike, netdev, steffen.klassert, herbert
https://bugzilla.kernel.org/show_bug.cgi?id=95211
Commit 70be6c91c86596ad2b60c73587880b47df170a41
("xfrm: Add xfrm_tunnel_skb_cb to the skb common buffer") added check
which dereferences ->outer_mode too early but larval SAs don't have
this pointer set (yet). So check for tunnel stuff later.
Mike Noordermeer reported this bug and patiently applied all the debugging.
Technically this is remote-oops-in-interrupt-context type of thing.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000034
IP: [<ffffffff8150dca2>] xfrm_input+0x3c2/0x5a0
...
[<ffffffff81500fc6>] ? xfrm4_esp_rcv+0x36/0x70
[<ffffffff814acc9a>] ? ip_local_deliver_finish+0x9a/0x200
[<ffffffff81471b83>] ? __netif_receive_skb_core+0x6f3/0x8f0
...
RIP [<ffffffff8150dca2>] xfrm_input+0x3c2/0x5a0
Kernel panic - not syncing: Fatal exception in interrupt
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
Patch is in final testing, I'm sending it opportunistically.
Mike, please chim in if this patch didn't help in the end!
net/xfrm/xfrm_input.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/net/xfrm/xfrm_input.c
+++ a/net/xfrm/xfrm_input.c
@@ -238,11 +238,6 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
skb->sp->xvec[skb->sp->len++] = x;
- if (xfrm_tunnel_check(skb, x, family)) {
- XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATEMODEERROR);
- goto drop;
- }
-
spin_lock(&x->lock);
if (unlikely(x->km.state == XFRM_STATE_ACQ)) {
XFRM_INC_STATS(net, LINUX_MIB_XFRMACQUIREERROR);
@@ -271,6 +266,11 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
spin_unlock(&x->lock);
+ if (xfrm_tunnel_check(skb, x, family)) {
+ XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATEMODEERROR);
+ goto drop;
+ }
+
seq_hi = htonl(xfrm_replay_seqhi(x, seq));
XFRM_SKB_CB(skb)->seq.input.low = seq;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xfrm: fix xfrm_input/xfrm_tunnel_check oops
2015-04-02 7:58 [PATCH] xfrm: fix xfrm_input/xfrm_tunnel_check oops Alexey Dobriyan
@ 2015-04-07 8:57 ` Steffen Klassert
2015-04-07 11:43 ` Alexey Dobriyan
0 siblings, 1 reply; 5+ messages in thread
From: Steffen Klassert @ 2015-04-07 8:57 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: davem, mike, netdev, herbert
On Thu, Apr 02, 2015 at 10:58:24AM +0300, Alexey Dobriyan wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=95211
>
> Commit 70be6c91c86596ad2b60c73587880b47df170a41
> ("xfrm: Add xfrm_tunnel_skb_cb to the skb common buffer") added check
> which dereferences ->outer_mode too early but larval SAs don't have
> this pointer set (yet). So check for tunnel stuff later.
>
> Mike Noordermeer reported this bug and patiently applied all the debugging.
>
> Technically this is remote-oops-in-interrupt-context type of thing.
>
> BUG: unable to handle kernel NULL pointer dereference at 0000000000000034
> IP: [<ffffffff8150dca2>] xfrm_input+0x3c2/0x5a0
> ...
> [<ffffffff81500fc6>] ? xfrm4_esp_rcv+0x36/0x70
> [<ffffffff814acc9a>] ? ip_local_deliver_finish+0x9a/0x200
> [<ffffffff81471b83>] ? __netif_receive_skb_core+0x6f3/0x8f0
> ...
>
> RIP [<ffffffff8150dca2>] xfrm_input+0x3c2/0x5a0
> Kernel panic - not syncing: Fatal exception in interrupt
>
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Good catch!
Applied to the ipsec tree, thanks everyone!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xfrm: fix xfrm_input/xfrm_tunnel_check oops
2015-04-07 8:57 ` Steffen Klassert
@ 2015-04-07 11:43 ` Alexey Dobriyan
2015-04-07 12:14 ` Romain Francoise
0 siblings, 1 reply; 5+ messages in thread
From: Alexey Dobriyan @ 2015-04-07 11:43 UTC (permalink / raw)
To: Steffen Klassert; +Cc: davem, mike, netdev, herbert
On Tue, Apr 07, 2015 at 10:57:32AM +0200, Steffen Klassert wrote:
> On Thu, Apr 02, 2015 at 10:58:24AM +0300, Alexey Dobriyan wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=95211
> >
> > Commit 70be6c91c86596ad2b60c73587880b47df170a41
> > ("xfrm: Add xfrm_tunnel_skb_cb to the skb common buffer") added check
> > which dereferences ->outer_mode too early but larval SAs don't have
> > this pointer set (yet). So check for tunnel stuff later.
> >
> > Mike Noordermeer reported this bug and patiently applied all the debugging.
> >
> > Technically this is remote-oops-in-interrupt-context type of thing.
> >
> > BUG: unable to handle kernel NULL pointer dereference at 0000000000000034
> > IP: [<ffffffff8150dca2>] xfrm_input+0x3c2/0x5a0
> > ...
> > [<ffffffff81500fc6>] ? xfrm4_esp_rcv+0x36/0x70
> > [<ffffffff814acc9a>] ? ip_local_deliver_finish+0x9a/0x200
> > [<ffffffff81471b83>] ? __netif_receive_skb_core+0x6f3/0x8f0
> > ...
> >
> > RIP [<ffffffff8150dca2>] xfrm_input+0x3c2/0x5a0
> > Kernel panic - not syncing: Fatal exception in interrupt
> >
> > Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
>
> Good catch!
>
> Applied to the ipsec tree, thanks everyone!
For the record Mike confirmed that the patch works:
https://bugzilla.kernel.org/show_bug.cgi?id=95211#c20
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xfrm: fix xfrm_input/xfrm_tunnel_check oops
2015-04-07 11:43 ` Alexey Dobriyan
@ 2015-04-07 12:14 ` Romain Francoise
2015-04-07 12:32 ` Steffen Klassert
0 siblings, 1 reply; 5+ messages in thread
From: Romain Francoise @ 2015-04-07 12:14 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: Steffen Klassert, davem, mike, netdev, herbert
On Tue, Apr 07, 2015 at 02:43:41PM +0300, Alexey Dobriyan wrote:
> On Tue, Apr 07, 2015 at 10:57:32AM +0200, Steffen Klassert wrote:
>> On Thu, Apr 02, 2015 at 10:58:24AM +0300, Alexey Dobriyan wrote:
>> > https://bugzilla.kernel.org/show_bug.cgi?id=95211
>> >
>> > Commit 70be6c91c86596ad2b60c73587880b47df170a41
>> > ("xfrm: Add xfrm_tunnel_skb_cb to the skb common buffer") added check
>> > which dereferences ->outer_mode too early but larval SAs don't have
>> > this pointer set (yet). So check for tunnel stuff later.
>> >
>> > Mike Noordermeer reported this bug and patiently applied all the debugging.
>> >
>> > Technically this is remote-oops-in-interrupt-context type of thing.
>> >
>> > BUG: unable to handle kernel NULL pointer dereference at 0000000000000034
>> > IP: [<ffffffff8150dca2>] xfrm_input+0x3c2/0x5a0
>> > ...
>> > [<ffffffff81500fc6>] ? xfrm4_esp_rcv+0x36/0x70
>> > [<ffffffff814acc9a>] ? ip_local_deliver_finish+0x9a/0x200
>> > [<ffffffff81471b83>] ? __netif_receive_skb_core+0x6f3/0x8f0
>> > ...
>> >
>> > RIP [<ffffffff8150dca2>] xfrm_input+0x3c2/0x5a0
>> > Kernel panic - not syncing: Fatal exception in interrupt
>> >
>> > Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
>>
>> Good catch!
>>
>> Applied to the ipsec tree, thanks everyone!
> For the record Mike confirmed that the patch works:
> https://bugzilla.kernel.org/show_bug.cgi?id=95211#c20
Does this only affect configurations that use VTI? It's not clear from
the description.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xfrm: fix xfrm_input/xfrm_tunnel_check oops
2015-04-07 12:14 ` Romain Francoise
@ 2015-04-07 12:32 ` Steffen Klassert
0 siblings, 0 replies; 5+ messages in thread
From: Steffen Klassert @ 2015-04-07 12:32 UTC (permalink / raw)
To: Romain Francoise; +Cc: Alexey Dobriyan, davem, mike, netdev, herbert
On Tue, Apr 07, 2015 at 02:14:43PM +0200, Romain Francoise wrote:
> On Tue, Apr 07, 2015 at 02:43:41PM +0300, Alexey Dobriyan wrote:
> > On Tue, Apr 07, 2015 at 10:57:32AM +0200, Steffen Klassert wrote:
> >> On Thu, Apr 02, 2015 at 10:58:24AM +0300, Alexey Dobriyan wrote:
> >> > https://bugzilla.kernel.org/show_bug.cgi?id=95211
> >> >
> >> > Commit 70be6c91c86596ad2b60c73587880b47df170a41
> >> > ("xfrm: Add xfrm_tunnel_skb_cb to the skb common buffer") added check
> >> > which dereferences ->outer_mode too early but larval SAs don't have
> >> > this pointer set (yet). So check for tunnel stuff later.
> >> >
> >> > Mike Noordermeer reported this bug and patiently applied all the debugging.
> >> >
> >> > Technically this is remote-oops-in-interrupt-context type of thing.
> >> >
> >> > BUG: unable to handle kernel NULL pointer dereference at 0000000000000034
> >> > IP: [<ffffffff8150dca2>] xfrm_input+0x3c2/0x5a0
> >> > ...
> >> > [<ffffffff81500fc6>] ? xfrm4_esp_rcv+0x36/0x70
> >> > [<ffffffff814acc9a>] ? ip_local_deliver_finish+0x9a/0x200
> >> > [<ffffffff81471b83>] ? __netif_receive_skb_core+0x6f3/0x8f0
> >> > ...
> >> >
> >> > RIP [<ffffffff8150dca2>] xfrm_input+0x3c2/0x5a0
> >> > Kernel panic - not syncing: Fatal exception in interrupt
> >> >
> >> > Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> >>
> >> Good catch!
> >>
> >> Applied to the ipsec tree, thanks everyone!
>
> > For the record Mike confirmed that the patch works:
> > https://bugzilla.kernel.org/show_bug.cgi?id=95211#c20
>
> Does this only affect configurations that use VTI? It's not clear from
> the description.
xfrm_tunnel_check() dereferences outer_mode only if it finds a tunnel
pointer, so it affects only vti SAs.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-04-07 12:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-02 7:58 [PATCH] xfrm: fix xfrm_input/xfrm_tunnel_check oops Alexey Dobriyan
2015-04-07 8:57 ` Steffen Klassert
2015-04-07 11:43 ` Alexey Dobriyan
2015-04-07 12:14 ` Romain Francoise
2015-04-07 12:32 ` Steffen Klassert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).