lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140816234557.11171.51119.stgit@birch.djwong.org>
Date:	Sat, 16 Aug 2014 16:45:57 -0700
From:	"Darrick J. Wong" <darrick.wong@...cle.com>
To:	tytso@....edu, darrick.wong@...cle.com
Cc:	linux-ext4@...r.kernel.org
Subject: [PATCH 01/27] e2fuzz: fix pwrite64/pwrite usage

Select pwrite64 or pwrite depending on what autoconf finds.  This
makes e2fuzz find a suitable pwrite variant regardless of platform.

Signed-off-by: Darrick J. Wong <darrick.wong@...cle.com>
---
 misc/e2fuzz.c |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)


diff --git a/misc/e2fuzz.c b/misc/e2fuzz.c
index 91aafe5..5794f97 100644
--- a/misc/e2fuzz.c
+++ b/misc/e2fuzz.c
@@ -32,15 +32,15 @@ static int metadata_only = 1;
 static unsigned long long user_corrupt_bytes = 0;
 static double user_corrupt_pct = 0.0;
 
-#ifndef HAVE_PWRITE
-ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset)
+#if !defined HAVE_PWRITE64 && !defined HAVE_PWRITE
+static ssize_t my_pwrite(int fd, const void *buf, size_t count, off_t offset)
 {
 	if (lseek(fd, offset, SEEK_SET) < 0)
 		return 0;
 
 	return write(fd, buf, count);
 }
-#endif /* HAVE_PWRITE */
+#endif /* !defined HAVE_PWRITE64 && !defined HAVE_PWRITE */
 
 int getseed(void)
 {
@@ -276,10 +276,22 @@ int process_fs(const char *fsname)
 			       off % fs->blocksize, off / fs->blocksize, c);
 		if (dryrun)
 			continue;
+#ifdef HAVE_PWRITE64
+		if (pwrite64(fd, &c, sizeof(c), off) != sizeof(c)) {
+			perror(fsname);
+			goto fail3;
+		}
+#elif HAVE_PWRITE
 		if (pwrite(fd, &c, sizeof(c), off) != sizeof(c)) {
 			perror(fsname);
 			goto fail3;
 		}
+#else
+		if (my_pwrite(fd, &c, sizeof(c), off) != sizeof(c)) {
+			perror(fsname);
+			goto fail3;
+		}
+#endif
 	}
 	close(fd);
 

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ