summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-03-30 07:52:33 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-03-30 07:52:33 +0000
commitbf0f94ab5eae936591e29e8f7d2a371fea208c3d (patch)
tree67ef3a5c29b016573a5d0466f97bff6a68b38d95 /sys/arch
parent58a4d9051f44de59c0b328bef84258c7ad009269 (diff)
first approximation: spoof UDF filesystem disklabels when we see them.
it is likely a slight bug or two will sneak in with this, so everyone please keep an eye out on your disklabels
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/alpha/disksubr.c6
-rw-r--r--sys/arch/amd64/amd64/disksubr.c6
-rw-r--r--sys/arch/arm/arm/disksubr.c6
-rw-r--r--sys/arch/hp300/hp300/disksubr.c6
-rw-r--r--sys/arch/hppa/hppa/disksubr.c6
-rw-r--r--sys/arch/i386/i386/disksubr.c6
-rw-r--r--sys/arch/luna88k/luna88k/disksubr.c6
-rw-r--r--sys/arch/mac68k/mac68k/disksubr.c6
-rw-r--r--sys/arch/macppc/macppc/disksubr.c6
-rw-r--r--sys/arch/mips64/mips64/disksubr.c6
-rw-r--r--sys/arch/mvme68k/mvme68k/disksubr.c7
-rw-r--r--sys/arch/mvme88k/mvme88k/disksubr.c6
-rw-r--r--sys/arch/mvmeppc/mvmeppc/disksubr.c6
-rw-r--r--sys/arch/sparc/sparc/disksubr.c21
-rw-r--r--sys/arch/sparc64/sparc64/disksubr.c21
-rw-r--r--sys/arch/vax/vax/disksubr.c6
16 files changed, 103 insertions, 24 deletions
diff --git a/sys/arch/alpha/alpha/disksubr.c b/sys/arch/alpha/alpha/disksubr.c
index 060fe419756..5422d3c245f 100644
--- a/sys/arch/alpha/alpha/disksubr.c
+++ b/sys/arch/alpha/alpha/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.39 2004/03/17 14:16:00 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.40 2005/03/30 07:52:30 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -299,6 +299,10 @@ readdisklabel(dev, strat, lp, osdep, spoofonly)
if (msg && iso_disklabelspoof(dev, strat, lp) == 0)
msg = NULL;
#endif
+#if defined(UDF)
+ if (msg && udf_disklabelspoof(dev, strat, lp) == 0)
+ msg = NULL;
+#endif
/* If there was an error, still provide a decent fake one. */
if (msg)
diff --git a/sys/arch/amd64/amd64/disksubr.c b/sys/arch/amd64/amd64/disksubr.c
index 209caa3d5a4..246a4c6ec0f 100644
--- a/sys/arch/amd64/amd64/disksubr.c
+++ b/sys/arch/amd64/amd64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.2 2004/03/17 14:16:03 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.3 2005/03/30 07:52:31 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -287,6 +287,10 @@ donot:
if (iso_disklabelspoof(dev, strat, lp) == 0)
msg = NULL;
#endif
+#if defined(UDF)
+ if (msg && udf_disklabelspoof(dev, strat, lp) == 0)
+ msg = NULL;
+#endif
goto done;
}
diff --git a/sys/arch/arm/arm/disksubr.c b/sys/arch/arm/arm/disksubr.c
index 389590526fc..8059576a31e 100644
--- a/sys/arch/arm/arm/disksubr.c
+++ b/sys/arch/arm/arm/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.3 2004/03/17 14:16:03 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.4 2005/03/30 07:52:31 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -281,6 +281,10 @@ donot:
if (iso_disklabelspoof(dev, strat, lp) == 0)
msg = NULL;
#endif
+#if defined(UDF)
+ if (msg && udf_disklabelspoof(dev, strat, lp) == 0)
+ msg = NULL;
+#endif
goto done;
}
diff --git a/sys/arch/hp300/hp300/disksubr.c b/sys/arch/hp300/hp300/disksubr.c
index 79ffe8f401b..0d631bbccc2 100644
--- a/sys/arch/hp300/hp300/disksubr.c
+++ b/sys/arch/hp300/hp300/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.16 2004/03/17 14:16:04 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.17 2005/03/30 07:52:31 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.9 1997/04/01 03:12:13 scottr Exp $ */
/*
@@ -107,6 +107,10 @@ readdisklabel(dev, strat, lp, osdep, spoofonly)
if (iso_disklabelspoof(dev, strat, lp) != 0)
#endif
msg = "no disk label";
+#if defined(UDF)
+ if (msg && udf_disklabelspoof(dev, strat, lp) == 0)
+ msg = NULL;
+#endif
}
} else if (dlp->d_npartitions > MAXPARTITIONS ||
dkcksum(dlp) != 0)
diff --git a/sys/arch/hppa/hppa/disksubr.c b/sys/arch/hppa/hppa/disksubr.c
index 4dae9bb9000..4e7e9861715 100644
--- a/sys/arch/hppa/hppa/disksubr.c
+++ b/sys/arch/hppa/hppa/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.17 2004/10/07 15:51:21 mickey Exp $ */
+/* $OpenBSD: disksubr.c,v 1.18 2005/03/30 07:52:31 deraadt Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -315,6 +315,10 @@ readdisklabel(dev, strat, lp, osdep, spoofonly)
if (msg && iso_disklabelspoof(dev, strat, lp) == 0)
msg = NULL;
#endif
+#if defined(UDF)
+ if (msg && udf_disklabelspoof(dev, strat, lp) == 0)
+ msg = NULL;
+#endif
/* If there was an error, still provide a decent fake one. */
if (msg)
diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c
index da9f77569a9..f28af3f0364 100644
--- a/sys/arch/i386/i386/disksubr.c
+++ b/sys/arch/i386/i386/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.44 2004/03/17 14:16:04 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.45 2005/03/30 07:52:31 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -283,6 +283,10 @@ donot:
if (iso_disklabelspoof(dev, strat, lp) == 0)
msg = NULL;
#endif
+#if defined(UDF)
+ if (msg && udf_disklabelspoof(dev, strat, lp) == 0)
+ msg = NULL;
+#endif
goto done;
}
diff --git a/sys/arch/luna88k/luna88k/disksubr.c b/sys/arch/luna88k/luna88k/disksubr.c
index 3fdf632ccaa..d98fb7e04ba 100644
--- a/sys/arch/luna88k/luna88k/disksubr.c
+++ b/sys/arch/luna88k/luna88k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.3 2005/03/29 16:35:59 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.4 2005/03/30 07:52:31 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.12 2002/02/19 17:09:44 wiz Exp $ */
/*
@@ -168,6 +168,10 @@ readdisklabel(dev, strat, lp, clp, spoofonly)
if (iso_disklabelspoof(dev, strat, lp) == 0)
return (NULL);
#endif
+#if defined(UDF)
+ if (udf_disklabelspoof(dev, strat, lp) == 0)
+ return (NULL);
+#endif
/* Check for a BSD disk label first. */
dlp = (struct disklabel *)(clp->cd_block + LABELOFFSET);
diff --git a/sys/arch/mac68k/mac68k/disksubr.c b/sys/arch/mac68k/mac68k/disksubr.c
index b7349ad027b..01671856ac8 100644
--- a/sys/arch/mac68k/mac68k/disksubr.c
+++ b/sys/arch/mac68k/mac68k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.26 2004/12/26 22:13:45 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.27 2005/03/30 07:52:32 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.22 1997/11/26 04:18:20 briggs Exp $ */
/*
@@ -425,6 +425,10 @@ readdisklabel(dev, strat, lp, osdep, spoofonly)
if (msg != NULL && iso_disklabelspoof(dev, strat, lp) == 0)
msg = NULL;
#endif
+#if defined(UDF)
+ if (msg && udf_disklabelspoof(dev, strat, lp) == 0)
+ msg = NULL;
+#endif
bp->b_flags |= B_INVAL;
brelse(bp);
diff --git a/sys/arch/macppc/macppc/disksubr.c b/sys/arch/macppc/macppc/disksubr.c
index 543bf37d141..83df3e09682 100644
--- a/sys/arch/macppc/macppc/disksubr.c
+++ b/sys/arch/macppc/macppc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.10 2004/03/17 14:16:04 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.11 2005/03/30 07:52:32 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -368,6 +368,10 @@ found_disklabel:
if (iso_disklabelspoof(dev, strat, lp) == 0)
msg = NULL;
#endif
+#if defined(UDF)
+ if (msg && udf_disklabelspoof(dev, strat, lp) == 0)
+ msg = NULL;
+#endif
goto done;
}
diff --git a/sys/arch/mips64/mips64/disksubr.c b/sys/arch/mips64/mips64/disksubr.c
index bfafe532c40..56ed5759d97 100644
--- a/sys/arch/mips64/mips64/disksubr.c
+++ b/sys/arch/mips64/mips64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.6 2004/10/30 14:48:59 pefo Exp $ */
+/* $OpenBSD: disksubr.c,v 1.7 2005/03/30 07:52:32 deraadt Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -331,6 +331,10 @@ readdisklabel(dev, strat, lp, osdep, spoofonly)
if (msg && iso_disklabelspoof(dev, strat, lp) == 0)
msg = NULL;
#endif
+#if defined(UDF)
+ if (msg && udf_disklabelspoof(dev, strat, lp) == 0)
+ msg = NULL;
+#endif
/* If there was an error, still provide a decent fake one. */
if (msg)
diff --git a/sys/arch/mvme68k/mvme68k/disksubr.c b/sys/arch/mvme68k/mvme68k/disksubr.c
index 770a0f828ac..c7839998dfa 100644
--- a/sys/arch/mvme68k/mvme68k/disksubr.c
+++ b/sys/arch/mvme68k/mvme68k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.30 2004/03/17 14:16:04 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.31 2005/03/30 07:52:32 deraadt Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1995 Dale Rahn.
@@ -159,6 +159,11 @@ readdisklabel(dev, strat, lp, clp, spoofonly)
if (iso_disklabelspoof(dev, strat, lp) == 0)
return (NULL);
#endif
+#if defined(UDF)
+ if (udf_disklabelspoof(dev, strat, lp) == 0)
+ return (NULL);
+#endif
+
if (clp->magic1 != DISKMAGIC || clp->magic2 != DISKMAGIC)
return ("no disk label");
diff --git a/sys/arch/mvme88k/mvme88k/disksubr.c b/sys/arch/mvme88k/mvme88k/disksubr.c
index e2c7a70dbd5..27fd747c69f 100644
--- a/sys/arch/mvme88k/mvme88k/disksubr.c
+++ b/sys/arch/mvme88k/mvme88k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.27 2004/09/30 21:46:38 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.28 2005/03/30 07:52:32 deraadt Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1995 Dale Rahn.
@@ -184,6 +184,10 @@ readdisklabel(dev, strat, lp, clp, spoofonly)
if (iso_disklabelspoof(dev, strat, lp) == 0)
return (NULL);
#endif
+#if defined(UDF)
+ if (udf_disklabelspoof(dev, strat, lp) == 0)
+ return (NULL);
+#endif
if (clp->magic1 != DISKMAGIC || clp->magic2 != DISKMAGIC)
return ("no disk label");
diff --git a/sys/arch/mvmeppc/mvmeppc/disksubr.c b/sys/arch/mvmeppc/mvmeppc/disksubr.c
index 0a1dc82426e..0d1474f0911 100644
--- a/sys/arch/mvmeppc/mvmeppc/disksubr.c
+++ b/sys/arch/mvmeppc/mvmeppc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.6 2004/03/17 14:16:04 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.7 2005/03/30 07:52:32 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -283,6 +283,10 @@ donot:
if (iso_disklabelspoof(dev, strat, lp) == 0)
msg = NULL;
#endif
+#if defined(UDF)
+ if (msg && udf_disklabelspoof(dev, strat, lp) == 0)
+ msg = NULL;
+#endif
goto done;
}
diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c
index 8bd369903df..3c8c54ec865 100644
--- a/sys/arch/sparc/sparc/disksubr.c
+++ b/sys/arch/sparc/sparc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.30 2004/03/17 14:16:04 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.31 2005/03/30 07:52:32 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */
/*
@@ -187,11 +187,18 @@ readdisklabel(dev, strat, lp, clp, spoofonly)
if (error)
return ("disk label read error");
-#if defined(CD9660) && (NCD > 0)
- if ((strat == cdstrategy) &&
- (iso_disklabelspoof(dev, strat, lp) == NULL))
- return (NULL);
+#if NCD > 0
+ if (strat == cdstrategy) {
+#if defined(CD9660)
+ if (iso_disklabelspoof(dev, strat, lp) == 0)
+ return (NULL);
+#endif
+#if defined(UDF)
+ if (udf_disklabelspoof(dev, strat, lp) == 0)
+ return (NULL);
#endif
+ }
+#endif /* NCD > 0 */
/* Check for a Sun disk label (for PROM compatibility). */
slp = (struct sun_disklabel *) clp->cd_block;
@@ -211,6 +218,10 @@ readdisklabel(dev, strat, lp, clp, spoofonly)
if (iso_disklabelspoof(dev, strat, lp) == 0)
return (NULL);
#endif
+#if defined(UDF)
+ if (udf_disklabelspoof(dev, strat, lp) == 0)
+ return (NULL);
+#endif
bzero(clp->cd_block, sizeof(clp->cd_block));
return ("no disk label");
}
diff --git a/sys/arch/sparc64/sparc64/disksubr.c b/sys/arch/sparc64/sparc64/disksubr.c
index cbb3f0f7769..a9d32b44842 100644
--- a/sys/arch/sparc64/sparc64/disksubr.c
+++ b/sys/arch/sparc64/sparc64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.12 2004/03/17 14:16:04 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.13 2005/03/30 07:52:32 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.13 2000/12/17 22:39:18 pk Exp $ */
/*
@@ -110,11 +110,18 @@ readdisklabel(dev, strat, lp, clp, spoofonly)
if (spoofonly)
return (NULL);
-#if defined(CD9660) && (NCD > 0)
- if ((strat == cdstrategy) &&
- (iso_disklabelspoof(dev, strat, lp) == NULL))
- return (NULL);
+#if NCD > 0
+ if (strat == cdstrategy) {
+#if defined(CD9660)
+ if (iso_disklabelspoof(dev, strat, lp) == 0)
+ return (NULL);
+#endif
+#if defined(UDF)
+ if (udf_disklabelspoof(dev, strat, lp) == 0)
+ return (NULL);
#endif
+ }
+#endif /* NCD > 0 */
/* obtain buffer to probe drive with */
bp = geteblk((int)lp->d_secsize);
@@ -155,6 +162,10 @@ readdisklabel(dev, strat, lp, clp, spoofonly)
if (iso_disklabelspoof(dev, strat, lp) == NULL)
return (NULL);
#endif
+#if defined(UDF)
+ if (udf_disklabelspoof(dev, strat, lp) == 0)
+ return (NULL);
+#endif
bzero(clp->cd_block, sizeof(clp->cd_block));
return ("no disk label");
}
diff --git a/sys/arch/vax/vax/disksubr.c b/sys/arch/vax/vax/disksubr.c
index 70b77a8e790..f313f6a7411 100644
--- a/sys/arch/vax/vax/disksubr.c
+++ b/sys/arch/vax/vax/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.22 2004/03/17 14:16:04 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.23 2005/03/30 07:52:32 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1999/06/30 18:48:06 ragge Exp $ */
/*
@@ -172,6 +172,10 @@ readdisklabel(dev, strat, lp, osdep, spoofonly)
if (msg && iso_disklabelspoof(dev, strat, lp) == 0)
msg = NULL;
#endif
+#if defined(UDF)
+ if (msg && udf_disklabelspoof(dev, strat, lp) == 0)
+ msg = NULL;
+#endif
bp->b_flags = B_INVAL | B_AGE | B_READ;
brelse(bp);