lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 8 Aug 2017 14:33:48 +1200
From:   Xin Long <lucien.xin@...il.com>
To:     Cong Wang <xiyou.wangcong@...il.com>
Cc:     network dev <netdev@...r.kernel.org>,
        David Miller <davem@...emloft.net>,
        netfilter-devel@...r.kernel.org,
        Jamal Hadi Salim <jhs@...atatu.com>
Subject: Re: [PATCH net] net: sched: fix NULL pointer dereference when action
 calls some targets

On Tue, Aug 8, 2017 at 9:15 AM, Cong Wang <xiyou.wangcong@...il.com> wrote:
> (Cc'ing netfilter and Jamal)
>
> On Sat, Aug 5, 2017 at 4:35 AM, Xin Long <lucien.xin@...il.com> wrote:
>> As we know in some target's checkentry it may dereference par.entryinfo
>> to check entry stuff inside. But when sched action calls xt_check_target,
>> par.entryinfo is set with NULL. It would cause kernel panic when calling
>> some targets.
>>
>> It can be reproduce with:
>>   # tc qd add dev eth1 ingress handle ffff:
>>   # tc filter add dev eth1 parent ffff: u32 match u32 0 0 action xt \
>>     -j ECN --ecn-tcp-remove
>>
>> It could also crash kernel when using target CLUSTERIP or TPROXY.
>>
[1]
>> By now there's no proper value for par.entryinfo in ipt_init_target,
>> but it can not be set with NULL. This patch is to void all these
>> panics by setting it with an ipt_entry obj with all members 0.
>>
>> Signed-off-by: Xin Long <lucien.xin@...il.com>
>> ---
>>  net/sched/act_ipt.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
>> index 7c4816b..0f09f70 100644
>> --- a/net/sched/act_ipt.c
>> +++ b/net/sched/act_ipt.c
>> @@ -41,6 +41,7 @@ static int ipt_init_target(struct net *net, struct xt_entry_target *t,
>>  {
>>         struct xt_tgchk_param par;
>>         struct xt_target *target;
>> +       struct ipt_entry e;
>>         int ret = 0;
>>
>>         target = xt_request_find_target(AF_INET, t->u.user.name,
>> @@ -48,10 +49,11 @@ static int ipt_init_target(struct net *net, struct xt_entry_target *t,
>>         if (IS_ERR(target))
>>                 return PTR_ERR(target);
>>
>> +       memset(&e, 0, sizeof(e));
>>         t->u.kernel.target = target;
>>         par.net       = net;
>>         par.table     = table;
>> -       par.entryinfo = NULL;
>> +       par.entryinfo = &e;
>
> This looks like a completely API burden?
netfilter xt targets are not really compatible with netsched action.
I've got to say, the patch is just a way to make checkentry return
false and avoid panic. like [1] said

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ