[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20190107120927.13238-1-ap420073@gmail.com>
Date: Mon, 7 Jan 2019 21:09:27 +0900
From: Taehee Yoo <ap420073@...il.com>
To: davem@...emloft.net, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, daniel@...earbox.net, ast@...nel.org,
mcgrof@...nel.org
Cc: ap420073@...il.com
Subject: [PATCH net v3 0/4] net: bpfilter: fix two bugs in bpfilter
This patches fix two bugs in the bpfilter_umh which are related in
iptables command.
The first patch adds an exit code for UMH process.
This provides an opportunity to cleanup members of the umh_info
to modules which use the UMH.
In order to identify UMH processes, a new flag PF_UMH is added.
The second patch makes the bpfilter_umh use UMH cleanup callback.
The third patch adds re-start routine for the bpfilter_umh.
The bpfilter_umh does not re-start after error occurred.
because there is no re-start routine in the module.
The fourth patch ensures that the bpfilter.ko module will not removed while
it's being used.
The bpfilter.ko is not protected by locks or module reference counter.
Therefore that can be removed while module is being used.
In order to protect that, mutex is used.
The first and second patch are preparation patches for the third and
fourth patch.
TEST #1
while :
do
modprobe bpfilter
kill -9 <pid of the bpfilter_umh>
iptables -vnL
done
TEST #2
while :
do
iptables -I FORWARD -m string --string ap --algo kmp &
iptables -F &
modprobe -rv bpfilter &
done
The TEST1 makes a failure of iptables command.
This is fixed by the third patch.
The TEST2 makes a panic because of a race condition in the bpfilter_umh
module.
This is fixed by the fourth patch.
v3 :
- Avoid unnecessary list lookup for non-UMH processes
- Add a new PF_UMH flag
v2 : add the first and second patch
v1 : Initial patch
Taehee Yoo (4):
umh: add exit routine for UMH process
net: bpfilter: use cleanup callback to release umh_info
net: bpfilter: restart bpfilter_umh when error occurred
net: bpfilter: disallow to remove bpfilter module while being used
include/linux/bpfilter.h | 15 +++++--
include/linux/sched.h | 1 +
include/linux/umh.h | 4 ++
kernel/exit.c | 1 +
kernel/umh.c | 36 +++++++++++++++-
net/bpfilter/bpfilter_kern.c | 72 +++++++++++++++++---------------
net/bpfilter/bpfilter_umh_blob.S | 2 +-
net/ipv4/bpfilter/sockopt.c | 59 +++++++++++++++++++++-----
8 files changed, 140 insertions(+), 50 deletions(-)
--
2.17.1
Powered by blists - more mailing lists