All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Patrick McHardy <kaber@trash.net>
Cc: arturo.borrero.glez@gmail.com, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 1/1] netfilter: nf_tables: fix nft_cmp_fast failure on big endian for size < 4
Date: Mon, 14 Apr 2014 10:39:30 +0200	[thread overview]
Message-ID: <20140414083930.GA4567@localhost> (raw)
In-Reply-To: <1397301477-16204-2-git-send-email-kaber@trash.net>

On Sat, Apr 12, 2014 at 01:17:57PM +0200, Patrick McHardy wrote:
> nft_cmp_fast is used for equality comparisions of size <= 4. For
> comparisions of size < 4 byte a mask is calculated that is applied to
> both the data from userspace (during initialization) and the register
> value (during runtime). Both values are stored using (in effect) memcpy
> to a memory area that is then interpreted as u32 by nft_cmp_fast.
> 
> This works fine on little endian since smaller types have the same base
> address, however on big endian this is not true and the smaller types
> are interpreted as a big number with trailing zero bytes.
> 
> The mask therefore must not include the lower bytes, but the higher bytes
> on big endian. Add a helper function that does a cpu_to_le32 to switch
> the bytes on big endian. Since we're dealing with a mask of just consequitive
> bits, this works out fine.

Applied and queue up to -stable. Thanks.

  reply	other threads:[~2014-04-14  8:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-12 11:17 [PATCH 0/1] netfilter: nf_tables: fix big endian problems Patrick McHardy
2014-04-12 11:17 ` [PATCH 1/1] netfilter: nf_tables: fix nft_cmp_fast failure on big endian for size < 4 Patrick McHardy
2014-04-14  8:39   ` Pablo Neira Ayuso [this message]
2014-04-12 13:19 ` [PATCH 0/1] netfilter: nf_tables: fix big endian problems Arturo Borrero Gonzalez

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=20140414083930.GA4567@localhost \
    --to=pablo@netfilter.org \
    --cc=arturo.borrero.glez@gmail.com \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.