Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F155060188
D37675.id114058.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D37675.id114058.diff
View Options
diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c
--- a/sys/ufs/ffs/ffs_subr.c
+++ b/sys/ufs/ffs/ffs_subr.c
@@ -43,6 +43,7 @@
#include <stdlib.h>
#include <time.h>
#include <sys/errno.h>
+#include <sys/endian.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
@@ -382,6 +383,18 @@
prtmsg = ((flags & UFS_NOMSG) == 0);
warnerr = (flags & UFS_NOWARNFAIL) == UFS_NOWARNFAIL ? 0 : ENOENT;
wmsg = warnerr ? "" : " (Ignored)";
+
+ /* Guess endian mismatch between machine and filesystem */
+ if ((fs->fs_magic != FS_UFS2_MAGIC) &&
+ (bswap32(fs->fs_magic) == FS_UFS2_MAGIC)) {
+ MPRINT("UFS2 superblock failed: possible endian mismatch between machine and filesystem\n");
+ return(ENOEXEC);
+ } else if ((fs->fs_magic != FS_UFS1_MAGIC) &&
+ (bswap32(fs->fs_magic) == FS_UFS1_MAGIC)) {
+ MPRINT("UFS1 superblock failed: possible endian mismatch between machine and filesystem\n");
+ return(ENOEXEC);
+ }
+
/*
* If just validating for recovery, then do just the minimal
* checks needed for the superblock fields needed to find
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, May 2, 2:24 AM (14 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32605493
Default Alt Text
D37675.id114058.diff (1 KB)
Attached To
Mode
D37675: ufs/ffs: detect endian mismatch between machine and filesystem
Attached
Detach File
Event Timeline
Log In to Comment