Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: "PaX Team" <pageexec-Y8qEzhMunLyT9ig0jae3mg@public.gmane.org>
To: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Steve French <sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>,
	re.emese-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	spender-JNS0hek0TMl4qEwOxq4T+Q@public.gmane.org
Subject: question about potential integer truncation in cifs_set_file_size
Date: Sat, 26 Sep 2015 16:31:19 +0200	[thread overview]
Message-ID: <5606AC37.16935.51F2ED39@pageexec.freemail.hu> (raw)

hi all,

fs/cifs/inode.c:cifs_set_file_size can truncate iattr.ia_size from loff_t
(long long) to unsigned int here:

	io_parms.length = attrs->ia_size;

and i'm wondering if this is intentional. based on a quick read of the code,
it seems that ia_size can at this point have a value over 4G (e.g., via a
call to truncate) and the ->set_file_size callback will transmit the full
64 bit value however in case of specific failures a (fallback?) call to
CIFSSMBWrite would be made with the truncated size.

FTR, this issue was detected with the upcoming version of the size overflow
plugin we have in PaX/grsecurity and there're a handful of similar cases in
the tree where potentially unwanted or unnecessary integer truncations occur,
this being one of these. any opinion/help is welcome!

cheers,
  PaX Team

             reply	other threads:[~2015-09-26 14:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-26 14:31 PaX Team [this message]
     [not found] ` <5606AC37.16935.51F2ED39-tVCe0bXVy/VhMnff8nq0I0CAg8bcNmFB@public.gmane.org>
2015-09-28 20:57   ` question about potential integer truncation in cifs_set_file_size Steve French
     [not found]     ` <CAH2r5mvWtbsru8HAphsGhukP-YHNSF+99D9v1BbBbNMeiaeCAw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-29 11:02       ` PaX Team

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=5606AC37.16935.51F2ED39@pageexec.freemail.hu \
    --to=pageexec-y8qezhmunlyt9ig0jae3mg@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=re.emese-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org \
    --cc=spender-JNS0hek0TMl4qEwOxq4T+Q@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox