Re: Linux ISO-9660 Rock Ridge bug needs fix

From: James Lamanna
Date: Tue Oct 17 2006 - 14:38:27 EST



Joerg Schilling wrote:
> Hi,
>
> while working on better ISO-9660 support for the Solaris Kernel,
> I recently enhanced mkisofs to support the Rock Ridge Standard version 1.12
> from 1994.
>
> The difference bewteen version 1.12 and 1.10 (this is what previous
> mkisofs versions did implement) is that the "PX" field is now 8 Byte
> bigger than before (44 instead of 36 bytes).
>
> As Rock Ridge is a protocol that implements a list of size tagged fields,
> this change in mkisofs should not be a problem and in fact is not for Solaris
> or FreeBSD. As Linux does not implement Rock Rige correctly, Linux will
> reject CDs/DVDs that have been created by a recent mkisofs.
>
> As Linux will completely disable RR because of this bug, it must be called
> a showstopper bug that needs immediate fixing and that also needs to be
> backported.

Hi Joerg,

It looks like Linux would definitely have an issue with field sizes changing
because it does an overflow calculation (see rock_check_overflow())
based on struct sizes.
Have you seen the error that Linux generates? If so please post it. I'm
assuming its probably something along the lines of:
"rock: directory entry would overflow storage...."

I've attached a patch that may fix the problem for now.
This is only compile-tested, not run tested or tested against any
RockRidge 1.12 images yet. Unfortunately I'm not by any machines with any
flavor of linux or cdrecord that actually have a CD burner I can test this on.

As I am not any sort of ISOFS maintainer by any stretch of the imagination all
review is welcome.

Thanks.

-- James Lamanna

Add a PX entry structure that includes the File Serial Number field per
RockRidge version 1.12.

Signed-off-by: James Lamanna <jlamanna@xxxxxxxxx>
---
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index f3a1db3..48be069 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -4,6 +4,9 @@
* (C) 1992, 1993 Eric Youngdale
*
* Rock Ridge Extensions to iso9660
+ *
+ * James Lamanna : Support v. 1.12 PX Entry
+ * (jlamanna@xxxxxxxxx) : 17th Oct 2006
*/

#include <linux/slab.h>
@@ -148,8 +151,14 @@ static int rock_check_overflow(struct ro
len = sizeof(struct RR_RR_s);
break;
case SIG('P', 'X'):
- len = sizeof(struct RR_PX_s);
+ {
+ struct rock_ridge *rr = (struct rock_ridge *)rs->chr;
+ if (rr->len == PX_112_LEN)
+ len = sizeof(struct RR_PX_112_s);
+ else
+ len = sizeof(struct RR_PX_s);
break;
+ }
case SIG('P', 'N'):
len = sizeof(struct RR_PN_s);
break;
@@ -349,6 +358,9 @@ #endif
inode->i_nlink = isonum_733(rr->u.PX.n_links);
inode->i_uid = isonum_733(rr->u.PX.uid);
inode->i_gid = isonum_733(rr->u.PX.gid);
+
+ if (rr->len == PX_112_LEN)
+ inode->i_ino = isonum_733(rr->u.PX_112.serial);
break;
case SIG('P', 'N'):
{
diff --git a/fs/isofs/rock.h b/fs/isofs/rock.h
index ed09e2b..fc4478f 100644
--- a/fs/isofs/rock.h
+++ b/fs/isofs/rock.h
@@ -35,6 +35,16 @@ struct RR_PX_s {
char gid[8];
};

+/* RR 1.12 extends the PX entry with a POSIX File Serial Number */
+#define PX_112_LEN (sizeof(struct RR_PX_112_s) + offsetof(struct rock_ridge, u))
+struct RR_PX_112_s {
+ char mode[8];
+ char n_links[8];
+ char uid[8];
+ char gid[8];
+ char serial[8];
+};
+
struct RR_PN_s {
char dev_high[8];
char dev_low[8];
@@ -102,6 +112,7 @@ struct rock_ridge {
struct SU_ER_s ER;
struct RR_RR_s RR;
struct RR_PX_s PX;
+ struct RR_PX_112_s PX_112;
struct RR_PN_s PN;
struct RR_SL_s SL;
struct RR_NM_s NM;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/