FAT: Allow 0xE9 near jump in fat_read_static_bpb()
Subsystems (2)
PATCH 1/1 FAT: Allow 0xE9 near jump in fat_read_static_bpb()
The fat_read_static_bpb() only accepts a short jump as a valid bootstrap code signature for DOS 1.x volumes when the dos1xfloppy mount option is used.
However, according to the Microsoft fatgen103.doc, the BS_jmpBoot field has two allowed forms: 0xEB 0x?? 0x90 (short jump + NOP) and 0xE9 0x?? 0x?? (near jump). The specification explicitly states that either form is acceptable.
This patch relaxes the check to also accept 0xE9 as the first byte of the jump instruction.
--- fs/fat/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/fat/inode.c +2 -2
@@ -1479,8 +1479,8 @@ static int fat_read_static_bpb(struct super_block *sb,int error = -EINVAL ;unsigned i; -/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp code */ -if (b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) { +/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp or near-jmp code */ +if ((b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) && (b->ignored[0 ] !=0xe9 )) {if (!silent)fat_msg (sb,KERN_ERR ,"%s; no bootstrapping code" , notdos1x);
Signature · 1 line
2.43.0
OGAWA Hirofumi
maintainerQuoted 22 lines · Ziran Zhang
The
fat_read_static_bpb()only accepts a short jump as a valid bootstrap code signature for DOS 1.x volumes when the dos1xfloppy mount option is used.However, according to the Microsoft fatgen103.doc, the
BS_jmpBootfield has two allowed forms:0xEB0x??0x90(short jump + NOP) and0xE90x?? 0x?? (near jump). The specification explicitly states that either form is acceptable.This patch relaxes the check to also accept
0xE9as the first byte of the jump instruction.Signed-off-by Ziran Zhang <[email protected]>--- fs/fat/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/fat/inode.c +0
-0
fs/fat/inode.c static int fat_read_static_bpb(struct super_block *sb, · line 1483
Quoted 7 lines
fs/fat/inode.c +2
-2@@ -1479,8 +1479,8 @@ static int fat_read_static_bpb(struct super_block *sb,int error = -EINVAL ;unsigned i; -/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp code */ -if (b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) { +/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp or near-jmp code */ +if ((b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) && (b->ignored[0 ] !=0xe9 )) {
Looks like over 80 columns.
if ((b->ignored[0] != 0xeb || b->ignored[2] != 0x90) &&
(b->ignored[0] != 0xe9)) {or such please.
Thanks.
Quoted 3 lines
fs/fat/inode.c +0
-0if (!silent)fat_msg (sb,KERN_ERR ,"%s; no bootstrapping code" , notdos1x);
Signature · 1 line
OGAWA Hirofumi <[email protected]>
PATCH v2 1/1 FAT: Allow 0xE9 near jump in fat_read_static_bpb()
Quoted 8 lines
Looks like over 80 columns.
if ((b->ignored[0] != 0xeb || b->ignored[2] != 0x90) && (b->ignored[0] != 0xe9)) {or such please.
Thanks.
Thank you for the review. I have fixed the line length and sent v2 patch.
--- fs/fat/inode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/fat/inode.c +3 -2
@@ -1479,8 +1479,9 @@ static int fat_read_static_bpb(struct super_block *sb,int error = -EINVAL ;unsigned i; -/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp code */ -if (b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) { +/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp or near-jmp code */ +if ((b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) && + (b->ignored[0 ] !=0xe9 )) {if (!silent)fat_msg (sb,KERN_ERR ,"%s; no bootstrapping code" , notdos1x);
Signature · 1 line
2.43.0
PATCH v3 1/1 FAT: Allow 0xE9 near jump in fat_read_static_bpb()
Changes in v3:
- Fix line length over 80 columns (split condition into two lines)
- Correct version number from erroneous "v2 v2" to v3
---
Please ignore the earlier erroneous "[PATCH v2 v2]" patch. This is the corrected v3.
fs/fat/inode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/fat/inode.c +3 -2
@@ -1479,8 +1479,9 @@ static int fat_read_static_bpb(struct super_block *sb,int error = -EINVAL ;unsigned i; -/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp code */ -if (b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) { +/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp or near-jmp code */ +if ((b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) && + (b->ignored[0 ] !=0xe9 )) {if (!silent)fat_msg (sb,KERN_ERR ,"%s; no bootstrapping code" , notdos1x);
Signature · 1 line
2.43.0
OGAWA Hirofumi
maintainerQuoted 5 lines · Ziran Zhang
Changes in v3:
- Fix line length over 80 columns (split condition into two lines)
- Correct version number from erroneous "v2 v2" to v3Signed-off-by Ziran Zhang <[email protected]>
Could you add original commit log, instead of changelog?
Thanks.
Quoted 24 lines
---
Please ignore the earlier erroneous "[PATCH v2 v2]" patch. This is the corrected v3.
fs/fat/inode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)fs/fat/inode.c +3
-2@@ -1479,8 +1479,9 @@ static int fat_read_static_bpb(struct super_block *sb,int error = -EINVAL ;unsigned i; -/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp code */ -if (b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) { +/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp or near-jmp code */ +if ((b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) && + (b->ignored[0 ] !=0xe9 )) {if (!silent)fat_msg (sb,KERN_ERR ,"%s; no bootstrapping code" , notdos1x);
Signature · 1 line
OGAWA Hirofumi <[email protected]>
PATCH v4 1/1 FAT: Allow 0xE9 near jump in fat_read_static_bpb()
The fat_read_static_bpb() only accepts a short jump as a valid bootstrap code signature for DOS 1.x volumes when the dos1xfloppy mount option is used.
However, according to the Microsoft fatgen103.doc, the BS_jmpBoot field has two allowed forms: 0xEB 0x?? 0x90 (short jump + NOP) and 0xE9 0x?? 0x?? (near jump). The specification explicitly states that either form is acceptable.
This patch relaxes the check to also accept 0xE9 as the first byte of the jump instruction.
Changes in v4:
- Add original commit log
---
Quoted 3 lines
Could you add original commit log, instead of changelog?
Thanks.
Done! Please ignore the earlier erroneous v2 v2 and v3.
fs/fat/inode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/fat/inode.c +3 -2
@@ -1479,8 +1479,9 @@ static int fat_read_static_bpb(struct super_block *sb,int error = -EINVAL ;unsigned i; -/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp code */ -if (b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) { +/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp or near-jmp code */ +if ((b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) && + (b->ignored[0 ] !=0xe9 )) {if (!silent)fat_msg (sb,KERN_ERR ,"%s; no bootstrapping code" , notdos1x);
Signature · 1 line
2.43.0
Quoted 9 lines · Ziran Zhang
The
fat_read_static_bpb()only accepts a short jump as a valid bootstrap code signature for DOS 1.x volumes when the dos1xfloppy mount option is used.However, according to the Microsoft fatgen103.doc, the
BS_jmpBootfield has two allowed forms:0xEB0x??0x90(short jump + NOP) and0xE90x?? 0x?? (near jump). The specification explicitly states that either form is acceptable.
Quoted 7 lines
This patch relaxes the check to also accept
0xE9as the first byte of the jump instruction.Changes in v4:
- Add original commit logSigned-off-by Ziran Zhang <[email protected]>
Thanks.
Quoted 27 lines
---
Quoted 3 lines
Could you add original commit log, instead of changelog?
Thanks.
Done! Please ignore the earlier erroneous v2 v2 and v3.
fs/fat/inode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)fs/fat/inode.c +3
-2@@ -1479,8 +1479,9 @@ static int fat_read_static_bpb(struct super_block *sb,int error = -EINVAL ;unsigned i; -/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp code */ -if (b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) { +/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp or near-jmp code */ +if ((b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) && + (b->ignored[0 ] !=0xe9 )) {if (!silent)fat_msg (sb,KERN_ERR ,"%s; no bootstrapping code" , notdos1x);
Signature · 1 line
OGAWA Hirofumi <[email protected]>
OGAWA Hirofumi
maintainerOGAWA Hirofumi <[email protected]> writes:
Please apply this too.
Thanks.
Quoted 50 lines
Quoted 9 lines · Ziran Zhang
The
fat_read_static_bpb()only accepts a short jump as a valid bootstrap code signature for DOS 1.x volumes when the dos1xfloppy mount option is used.However, according to the Microsoft fatgen103.doc, the
BS_jmpBootfield has two allowed forms:0xEB0x??0x90(short jump + NOP) and0xE90x?? 0x?? (near jump). The specification explicitly states that either form is acceptable.Quoted 7 lines
This patch relaxes the check to also accept
0xE9as the first byte of the jump instruction.Changes in v4:
- Add original commit logSigned-off-by Ziran Zhang <[email protected]>Thanks.
Acked-by OGAWA Hirofumi <[email protected]>Quoted 27 lines
---
Quoted 3 lines
Could you add original commit log, instead of changelog?
Thanks.
Done! Please ignore the earlier erroneous v2 v2 and v3.
fs/fat/inode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)fs/fat/inode.c +3
-2@@ -1479,8 +1479,9 @@ static int fat_read_static_bpb(struct super_block *sb,int error = -EINVAL ;unsigned i; -/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp code */ -if (b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) { +/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp or near-jmp code */ +if ((b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) && + (b->ignored[0 ] !=0xe9 )) {if (!silent)fat_msg (sb,KERN_ERR ,"%s; no bootstrapping code" , notdos1x);
Signature · 1 line
OGAWA Hirofumi <[email protected]>
OGAWA Hirofumi
maintainerOGAWA Hirofumi <[email protected]> writes:
ping?
Quoted 56 lines
OGAWA Hirofumi <[email protected]> writes:
Please apply this too.
Thanks.
Quoted 50 lines
Quoted 9 lines · Ziran Zhang
The
fat_read_static_bpb()only accepts a short jump as a valid bootstrap code signature for DOS 1.x volumes when the dos1xfloppy mount option is used.However, according to the Microsoft fatgen103.doc, the
BS_jmpBootfield has two allowed forms:0xEB0x??0x90(short jump + NOP) and0xE90x?? 0x?? (near jump). The specification explicitly states that either form is acceptable.Quoted 7 lines
This patch relaxes the check to also accept
0xE9as the first byte of the jump instruction.Changes in v4:
- Add original commit logSigned-off-by Ziran Zhang <[email protected]>Thanks.
Acked-by OGAWA Hirofumi <[email protected]>Quoted 27 lines
---
Quoted 3 lines
Could you add original commit log, instead of changelog?
Thanks.
Done! Please ignore the earlier erroneous v2 v2 and v3.
fs/fat/inode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)fs/fat/inode.c +3
-2@@ -1479,8 +1479,9 @@ static int fat_read_static_bpb(struct super_block *sb,int error = -EINVAL ;unsigned i; -/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp code */ -if (b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) { +/* 16-bit DOS 1.x reliably wrote bootstrap short-jmp or near-jmp code */ +if ((b->ignored[0 ] !=0xeb || b->ignored[2 ] !=0x90 ) && + (b->ignored[0 ] !=0xe9 )) {if (!silent)fat_msg (sb,KERN_ERR ,"%s; no bootstrapping code" , notdos1x);
Signature · 1 line
OGAWA Hirofumi <[email protected]>
Quoted 1 line · OGAWA Hirofumi
ping?
Hi Andrew,
Ping on this v4 patch. Acked-by FAT maintainer since April.
Thanks,
Ziran Zhang