From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Chenbo Feng <fengc@google.com>
Cc: zenczykowski@gmail.com, Chenbo Feng <chenbofeng.kernel@gmail.com>,
netdev@vger.kernel.org, netfilter-devel@vger.kernel.org,
kernel-team@android.com, Lorenzo Colitti <lorenzo@google.com>
Subject: Re: [PATCH net-next] netfilter: xt_quota: fix the behavior of xt_quota module
Date: Tue, 2 Oct 2018 20:15:46 +0200 [thread overview]
Message-ID: <20181002181546.b6zhizcl6lj2inu2@salvia> (raw)
In-Reply-To: <CAMOXUJkYwz-aOuWO4ygVchTVWiX59=3znCb-NWC55nsmHSD93A@mail.gmail.com>
Hi Chenbo,
On Tue, Oct 02, 2018 at 10:45:58AM -0700, Chenbo Feng wrote:
> On Tue, Oct 2, 2018 at 3:51 AM Pablo Neira Ayuso <pablo@netfilter.org> wrote:
[...]
> Do you mean the remain field will be zeroed when copying the
> xt_quota_info struct out of the kernel? I believe that is decided by
> the usersize defined in struct xt_match and this patch set it to the
> full struct size. So the whole xt_quota_info struct will be copied
> into userspace including the field stores the remaining quota. The
> userspace will not be aware of it if the ipatbles is not updated but
> it should not modify it as well. I have tested the behavior with
> net-next branch and it seems working. Am I missing something
> recently updated?
Hm, I see, I overlook that your patch removes this:
- .usersize = offsetof(struct xt_quota_info, master),
BTW, is iptables -D command working with your patch?
Telling this because if .usersize is removed, then IIRC userspace
compares this new remain field with userspace value and deletion will
break.
Patch that I was referring before is this one from Willem:
commit f32815d21d4d8287336fb9cef4d2d9e0866214c2
Author: Willem de Bruijn <willemb@google.com>
Date: Mon Jan 2 17:19:40 2017 -0500
xtables: add xt_match, xt_target and data copy_to_user functions
xt_entry_target, xt_entry_match and their private data may contain
kernel data.
[...]
Private data is defined in xt_match and xt_target. All matches and
targets that maintain kernel data store this at the tail of their
private structure. Extend xt_match and xt_target with .usersize to
limit how many bytes of data are copied. The remainder is cleared.
Let me know, thanks !
next prev parent reply other threads:[~2018-10-03 1:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-02 1:23 [PATCH net-next iptables] Rework the xt_quota module Chenbo Feng
2018-10-02 1:23 ` [PATCH iptables] extensions: libxt_quota: Allow setting the remaining quota Chenbo Feng
2018-10-08 23:16 ` Pablo Neira Ayuso
2018-10-02 1:23 ` [PATCH net-next] netfilter: xt_quota: fix the behavior of xt_quota module Chenbo Feng
2018-10-02 7:59 ` Pablo Neira Ayuso
2018-10-02 8:24 ` Maciej Żenczykowski
2018-10-02 8:25 ` Maciej Żenczykowski
2018-10-02 10:11 ` Pablo Neira Ayuso
2018-10-02 10:15 ` Pablo Neira Ayuso
2018-10-02 10:38 ` Maciej Żenczykowski
2018-10-02 10:51 ` Pablo Neira Ayuso
2018-10-02 10:52 ` Pablo Neira Ayuso
2018-10-02 17:45 ` Chenbo Feng
2018-10-02 18:15 ` Pablo Neira Ayuso [this message]
2018-10-02 18:28 ` Chenbo Feng
2018-10-02 18:43 ` Pablo Neira Ayuso
2018-10-02 22:22 ` Maciej Żenczykowski
2018-10-03 9:19 ` Pablo Neira Ayuso
2018-10-03 9:26 ` Maciej Żenczykowski
2018-10-03 9:28 ` Pablo Neira Ayuso
2018-10-03 15:37 ` Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181002181546.b6zhizcl6lj2inu2@salvia \
--to=pablo@netfilter.org \
--cc=chenbofeng.kernel@gmail.com \
--cc=fengc@google.com \
--cc=kernel-team@android.com \
--cc=lorenzo@google.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=zenczykowski@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox