From: Tyler Hicks <tyhicks@canonical.com>
To: Michael Halcrow <mhalcrow@google.com>
Cc: dmitryc@google.com, keescook@google.com, ecryptfs@vger.kernel.org
Subject: Re: [PATCH] eCryptfs: Remove buggy and unnecessary write in file name decode routine
Date: Wed, 26 Nov 2014 11:22:59 -0600 [thread overview]
Message-ID: <20141126172258.GA31285@boyd> (raw)
In-Reply-To: <1417021756-30233-1-git-send-email-mhalcrow@google.com>
[-- Attachment #1: Type: text/plain, Size: 1590 bytes --]
On 2014-11-26 09:09:16, Michael Halcrow wrote:
> Dmitry Chernenkov used KASAN to discover that eCryptfs writes past the
> end of the allocated buffer during encrypted filename decoding. This
> fix corrects the issue by getting rid of the unnecessary 0 write when
> the current bit offset is 2.
>
> Signed-off-by: Michael Halcrow <mhalcrow@google.com>
I like this fix better than the other where you modified
ecryptfs_max_decoded_size() to return an extra byte.
ecryptfs_max_decoded_size() is actually returning the correct size
instead of being conservative, as the comments in that function suggest
so returning an extra byte doesn't make sense.
Also, the decode operation takes blocks of 4 encoded bytes down to 3
decoded bytes so there's no reason to zero the 4th decoded byte in the
sequence when there may not even be a 4th encoded byte.
So, this one gets my ack. I'll take it from here. I'll add the correct
tag to get it backported to the appropriate stable kernels and also give
Dmitry credit with a Reported-by tag.
Thanks!
Tyler
> ---
> fs/ecryptfs/crypto.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
> index 2f6735d..31b148f 100644
> --- a/fs/ecryptfs/crypto.c
> +++ b/fs/ecryptfs/crypto.c
> @@ -1917,7 +1917,6 @@ ecryptfs_decode_from_filename(unsigned char *dst, size_t *dst_size,
> break;
> case 2:
> dst[dst_byte_offset++] |= (src_byte);
> - dst[dst_byte_offset] = 0;
> current_bit_offset = 0;
> break;
> }
> --
> 2.2.0.rc0.207.ga3a616c
>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2014-11-26 17:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-26 17:09 [PATCH] eCryptfs: Remove buggy and unnecessary write in file name decode routine Michael Halcrow
2014-11-26 17:22 ` Tyler Hicks [this message]
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=20141126172258.GA31285@boyd \
--to=tyhicks@canonical.com \
--cc=dmitryc@google.com \
--cc=ecryptfs@vger.kernel.org \
--cc=keescook@google.com \
--cc=mhalcrow@google.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