* [PATCH] FAT: Allow 0xE9 near jump in fat_read_static_bpb()
@ 2026-04-11 8:01 Ziran Zhang
2026-04-11 17:32 ` OGAWA Hirofumi
0 siblings, 1 reply; 7+ messages in thread
From: Ziran Zhang @ 2026-04-11 8:01 UTC (permalink / raw)
To: hirofumi; +Cc: linux-kernel, 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_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.
Signed-off-by: Ziran Zhang <zhangcoder@yeah.net>
---
fs/fat/inode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 28f78df08..0f64552e2 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -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);
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] FAT: Allow 0xE9 near jump in fat_read_static_bpb()
2026-04-11 8:01 [PATCH] FAT: Allow 0xE9 near jump in fat_read_static_bpb() Ziran Zhang
@ 2026-04-11 17:32 ` OGAWA Hirofumi
2026-04-12 1:39 ` [PATCH v2 v2] " Ziran Zhang
0 siblings, 1 reply; 7+ messages in thread
From: OGAWA Hirofumi @ 2026-04-11 17:32 UTC (permalink / raw)
To: Ziran Zhang; +Cc: linux-kernel
Ziran Zhang <zhangcoder@yeah.net> writes:
> 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.
>
> Signed-off-by: Ziran Zhang <zhangcoder@yeah.net>
> ---
> fs/fat/inode.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/fat/inode.c b/fs/fat/inode.c
> index 28f78df08..0f64552e2 100644
> --- a/fs/fat/inode.c
> +++ b/fs/fat/inode.c
> @@ -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.
> if (!silent)
> fat_msg(sb, KERN_ERR,
> "%s; no bootstrapping code", notdos1x);
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH v2 v2] FAT: Allow 0xE9 near jump in fat_read_static_bpb()
2026-04-11 17:32 ` OGAWA Hirofumi
@ 2026-04-12 1:39 ` Ziran Zhang
2026-04-12 3:56 ` [PATCH v3] " Ziran Zhang
0 siblings, 1 reply; 7+ messages in thread
From: Ziran Zhang @ 2026-04-12 1:39 UTC (permalink / raw)
To: hirofumi; +Cc: linux-kernel, zhangcoder
> 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.
Signed-off-by: Ziran Zhang <zhangcoder@yeah.net>
---
fs/fat/inode.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 28f78df08..0e7d106ea 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -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);
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v3] FAT: Allow 0xE9 near jump in fat_read_static_bpb()
2026-04-12 1:39 ` [PATCH v2 v2] " Ziran Zhang
@ 2026-04-12 3:56 ` Ziran Zhang
2026-04-12 6:21 ` OGAWA Hirofumi
0 siblings, 1 reply; 7+ messages in thread
From: Ziran Zhang @ 2026-04-12 3:56 UTC (permalink / raw)
To: hirofumi; +Cc: linux-kernel, Ziran Zhang
Changes in v3:
- Fix line length over 80 columns (split condition into two lines)
- Correct version number from erroneous "v2 v2" to v3
Signed-off-by: Ziran Zhang <zhangcoder@yeah.net>
---
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(-)
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 28f78df08..0e7d106ea 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -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);
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v3] FAT: Allow 0xE9 near jump in fat_read_static_bpb()
2026-04-12 3:56 ` [PATCH v3] " Ziran Zhang
@ 2026-04-12 6:21 ` OGAWA Hirofumi
2026-04-12 6:59 ` [PATCH v4] " Ziran Zhang
0 siblings, 1 reply; 7+ messages in thread
From: OGAWA Hirofumi @ 2026-04-12 6:21 UTC (permalink / raw)
To: Ziran Zhang; +Cc: linux-kernel
Ziran Zhang <zhangcoder@yeah.net> writes:
> Changes in v3:
> - Fix line length over 80 columns (split condition into two lines)
> - Correct version number from erroneous "v2 v2" to v3
>
> Signed-off-by: Ziran Zhang <zhangcoder@yeah.net>
Could you add original commit log, instead of changelog?
Thanks.
> ---
>
> 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(-)
>
> diff --git a/fs/fat/inode.c b/fs/fat/inode.c
> index 28f78df08..0e7d106ea 100644
> --- a/fs/fat/inode.c
> +++ b/fs/fat/inode.c
> @@ -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);
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH v4] FAT: Allow 0xE9 near jump in fat_read_static_bpb()
2026-04-12 6:21 ` OGAWA Hirofumi
@ 2026-04-12 6:59 ` Ziran Zhang
2026-04-12 7:37 ` OGAWA Hirofumi
0 siblings, 1 reply; 7+ messages in thread
From: Ziran Zhang @ 2026-04-12 6:59 UTC (permalink / raw)
To: hirofumi; +Cc: zhangcoder, linux-kernel
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
Signed-off-by: Ziran Zhang <zhangcoder@yeah.net>
---
> 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(-)
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 28f78df08..0e7d106ea 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -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);
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v4] FAT: Allow 0xE9 near jump in fat_read_static_bpb()
2026-04-12 6:59 ` [PATCH v4] " Ziran Zhang
@ 2026-04-12 7:37 ` OGAWA Hirofumi
0 siblings, 0 replies; 7+ messages in thread
From: OGAWA Hirofumi @ 2026-04-12 7:37 UTC (permalink / raw)
To: Christian Brauner; +Cc: Ziran Zhang, linux-kernel, linux-fsdevel
Ziran Zhang <zhangcoder@yeah.net> writes:
> 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
>
> Signed-off-by: Ziran Zhang <zhangcoder@yeah.net>
Thanks.
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
> ---
>
>> 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(-)
>
> diff --git a/fs/fat/inode.c b/fs/fat/inode.c
> index 28f78df08..0e7d106ea 100644
> --- a/fs/fat/inode.c
> +++ b/fs/fat/inode.c
> @@ -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);
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-04-12 7:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-11 8:01 [PATCH] FAT: Allow 0xE9 near jump in fat_read_static_bpb() Ziran Zhang
2026-04-11 17:32 ` OGAWA Hirofumi
2026-04-12 1:39 ` [PATCH v2 v2] " Ziran Zhang
2026-04-12 3:56 ` [PATCH v3] " Ziran Zhang
2026-04-12 6:21 ` OGAWA Hirofumi
2026-04-12 6:59 ` [PATCH v4] " Ziran Zhang
2026-04-12 7:37 ` OGAWA Hirofumi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox