[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 18/31: libdiskfs: Reject LFS seeks and read/writes
From: |
Samuel Thibault |
Subject: |
[hurd] 18/31: libdiskfs: Reject LFS seeks and read/writes |
Date: |
Mon, 02 May 2016 23:48:32 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit f2d22b3bab4de4b20c857bf6f0191fb6c000fd14
Author: Samuel Thibault <address@hidden>
Date: Tue Apr 26 23:42:25 2016 +0200
libdiskfs: Reject LFS seeks and read/writes
vm_offset_t (used by pager_memcpy) is not 64bit-ready yet. Reject requests
which go further than this.
* libdiskfs/io-seek.c (diskfs_S_io_seek): Return EFBIG when requested offset
is beyond limits of vm_offset_t.
* libdiskfs/rdwr-internal.c (_diskfs_rdwr_internal): Return EFBIG when
request goes beyond limits of vm_offset_t.
---
libdiskfs/io-seek.c | 8 ++++++++
libdiskfs/rdwr-internal.c | 7 ++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/libdiskfs/io-seek.c b/libdiskfs/io-seek.c
index 9e3ff09..0018a71 100644
--- a/libdiskfs/io-seek.c
+++ b/libdiskfs/io-seek.c
@@ -46,6 +46,14 @@ diskfs_S_io_seek (struct protid *cred,
offset += np->dn_stat.st_size;
case SEEK_SET:
check:
+ /* pager_memcpy inherently uses vm_offset_t, which may be smaller than
+ off_t. */
+ if (sizeof(off_t) > sizeof(vm_offset_t) &&
+ offset > ((off_t) 1) << (sizeof(vm_offset_t) * 8))
+ {
+ err = EFBIG;
+ break;
+ }
if (offset >= 0)
{
*newoffset = cred->po->filepointer = offset;
diff --git a/libdiskfs/rdwr-internal.c b/libdiskfs/rdwr-internal.c
index 18a4ae1..0d40551 100644
--- a/libdiskfs/rdwr-internal.c
+++ b/libdiskfs/rdwr-internal.c
@@ -58,7 +58,12 @@ _diskfs_rdwr_internal (struct node *np,
if (memobj == MACH_PORT_NULL)
return errno;
- err = pager_memcpy (diskfs_get_filemap_pager_struct (np), memobj,
+ /* pager_memcpy inherently uses vm_offset_t, which may be smaller than
off_t. */
+ if (sizeof(off_t) > sizeof(vm_offset_t) &&
+ offset + *amt > ((off_t) 1) << (sizeof(vm_offset_t) * 8))
+ err = EFBIG;
+ else
+ err = pager_memcpy (diskfs_get_filemap_pager_struct (np), memobj,
offset, data, amt, prot);
if (!diskfs_check_readonly () && !notime)
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] branch upstream updated (b5a5ed2 -> b90164e), Samuel Thibault, 2016/05/02
- [hurd] 03/31: Use swapon path as pager partition path, Samuel Thibault, 2016/05/02
- [hurd] 05/31: Update NEWS file, Samuel Thibault, 2016/05/02
- [hurd] 14/31: libdiskfs: improve error handling, Samuel Thibault, 2016/05/02
- [hurd] 15/31: libtrivfs: fix error handling, Samuel Thibault, 2016/05/02
- [hurd] 17/31: Fix supporting >4GiB files in ext2fs, Samuel Thibault, 2016/05/02
- [hurd] 18/31: libdiskfs: Reject LFS seeks and read/writes,
Samuel Thibault <=
- [hurd] 22/31: Unify and document the way fsids are handled in trivfs translators, Samuel Thibault, 2016/05/02
- [hurd] 21/31: libshouldbeinlibc: use the new assert in the refcount primitives, Samuel Thibault, 2016/05/02
- [hurd] 12/31: Fix access mode of temporary files, Samuel Thibault, 2016/05/02
- [hurd] 02/31: Fix swap information numbers, Samuel Thibault, 2016/05/02
- [hurd] 19/31: libpager: add missing include, Samuel Thibault, 2016/05/02
- [hurd] 09/31: Make make install idempotent, Samuel Thibault, 2016/05/02
- [hurd] 23/31: startup: implement bits of the fs and io protocols, Samuel Thibault, 2016/05/02
- [hurd] 11/31: libfshelp: pass cookie to the callback function, Samuel Thibault, 2016/05/02
- [hurd] 13/31: Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/hurd, Samuel Thibault, 2016/05/02
- [hurd] 20/31: libshouldbeinlibc: add assert(3) variant that prints backtraces, Samuel Thibault, 2016/05/02