Re: [PATCH net] tun: Fix NULL pointer dereference in XDP redirect

2018-05-27 Thread Toshiaki Makita
On 2018/05/28 11:24, Jason Wang wrote: > On 2018年05月25日 21:43, Toshiaki Makita wrote: > > [...] > @@ -1917,16 +1923,22 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,   struct bpf_prog *xdp_prog;   int ret; +    local_bh_

Re: [PATCH net] tun: Fix NULL pointer dereference in XDP redirect

2018-05-27 Thread Jason Wang
On 2018年05月25日 21:43, Toshiaki Makita wrote: [...] @@ -1917,16 +1923,22 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,   struct bpf_prog *xdp_prog;   int ret; +    local_bh_disable(); +    preempt_disable();   rcu_read_lock();  

Re: [PATCH net] tun: Fix NULL pointer dereference in XDP redirect

2018-05-25 Thread Toshiaki Makita
On 18/05/25 (金) 18:59, Jason Wang wrote: On 2018年05月25日 12:32, Toshiaki Makita wrote: Calling XDP redirection requires preempt/bh disabled. Especially softirq can call another XDP function and redirection functions, then percpu value ri->map can be overwritten to NULL. This is a generic XDP cas

Re: [PATCH net] tun: Fix NULL pointer dereference in XDP redirect

2018-05-25 Thread Jason Wang
On 2018年05月25日 12:32, Toshiaki Makita wrote: Calling XDP redirection requires preempt/bh disabled. Especially softirq can call another XDP function and redirection functions, then percpu value ri->map can be overwritten to NULL. This is a generic XDP case called from tun. [ 3535.736058] BUG:

[PATCH net] tun: Fix NULL pointer dereference in XDP redirect

2018-05-24 Thread Toshiaki Makita
Calling XDP redirection requires preempt/bh disabled. Especially softirq can call another XDP function and redirection functions, then percpu value ri->map can be overwritten to NULL. This is a generic XDP case called from tun. [ 3535.736058] BUG: unable to handle kernel NULL pointer dereference