Linux CIFS filesystem development
 help / color / mirror / Atom feed
* question about potential integer truncation in cifs_set_file_size
@ 2015-09-26 14:31 PaX Team
       [not found] ` <5606AC37.16935.51F2ED39-tVCe0bXVy/VhMnff8nq0I0CAg8bcNmFB@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: PaX Team @ 2015-09-26 14:31 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA
  Cc: Steve French, re.emese-Re5JQEeQqe8AvxtiuMwx3w,
	spender-JNS0hek0TMl4qEwOxq4T+Q

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-29 11:02 UTC | newest]

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox