efi_loader: disk: install file system protocol to a whole disk
PATCH 1/1 efi_loader: disk: install file system protocol to a whole disk
Currently, a whole disk without any partitions is not associated with EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. So even if it houses FAT file system, there is a chance that we may not be able to access it, particularly, when accesses are to be attempted after searching that protocol against a device handle.
With this patch, EFI_SIMPLE_FILE_SYSTEM_PROTOCOL is installed to such a disk if part_get_info() shows there is not partition table installed on it.
--- lib/efi_loader/efi_disk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
lib/efi_loader/efi_disk.c +3 -1
@@ -239,6 +239,7 @@ static efi_status_t efi_disk_add_dev( struct efi_disk_obj **disk) {struct efi_disk_obj *diskobj; +disk_partition_t info;efi_status_t ret;/* Don't add empty devices */
@@ -270,7 +271,8 @@ static efi_status_t efi_disk_add_dev( diskobj->dp);if (ret !=EFI_SUCCESS )return ret; -if (part >=1 ) { +/* partitions or whole disk without partitions */ +if (part >=1 ||part_get_info (desc, part, &info)) { diskobj->volume =efi_simple_file_system (desc, part, diskobj->dp); ret = efi_add_protocol(&diskobj->header,
Signature · 1 line
2.21.0
PATCH 1/1 efi_loader: disk: install file system protocol to a whole disk
Quoted 9 lines
From: AKASHI Takahiro <[email protected]>
Date: Thu, 22 Aug 2019 17:06:25 +0900Currently, a whole disk without any partitions is not associated with
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. So even if it houses FAT file system, there is a chance that we may not be able to access it, particularly, when accesses are to be attempted after searching that protocol against a device handle.
Quoted 3 lines
With this patch,
EFI_SIMPLE_FILE_SYSTEM_PROTOCOLis installed to such a disk ifpart_get_info()shows there is not partition table installed on it.
Do other UEFI implementations support this?
Quoted 34 lines
Signed-off-by AKASHI Takahiro <[email protected]>--- lib/efi_loader/efi_disk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)lib/efi_loader/efi_disk.c +3
-1@@ -239,6 +239,7 @@ static efi_status_t efi_disk_add_dev( struct efi_disk_obj **disk) {struct efi_disk_obj *diskobj; +disk_partition_t info;efi_status_t ret;/* Don't add empty devices */ @@ -270,7 +271,8 @@ static efi_status_t efi_disk_add_dev( diskobj->dp);if (ret !=EFI_SUCCESS )return ret; -if (part >=1 ) { +/* partitions or whole disk without partitions */ +if (part >=1 ||part_get_info (desc, part, &info)) { diskobj->volume =efi_simple_file_system (desc, part, diskobj->dp); ret = efi_add_protocol(&diskobj->header,Signature · 6 lines
2.21.0 _______________________________________________ U-Boot mailing list U-Boot at lists.denx.de https://lists.denx.de/listinfo/u-boot
PATCH 1/1 efi_loader: disk: install file system protocol to a whole disk
Quoted 9 lines · Mark Kettenis
Quoted 9 lines
From: AKASHI Takahiro <[email protected]>
Date: Thu, 22 Aug 2019 17:06:25 +0900Currently, a whole disk without any partitions is not associated with
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. So even if it houses FAT file system, there is a chance that we may not be able to access it, particularly, when accesses are to be attempted after searching that protocol against a device handle.
Quoted 5 lines
Quoted 3 lines
With this patch,
EFI_SIMPLE_FILE_SYSTEM_PROTOCOLis installed to such a disk ifpart_get_info()shows there is not partition table installed on it.Do other UEFI implementations support this?
What use cases exist that come without partition table?
You can create an MBR with partition table that is a valid start of a file system.
So you should first check if a partition table exists. Only if none exists you can test for a possible file system.
Best regards
Heinrich
Quoted 36 lines
Quoted 35 lines
Signed-off-by AKASHI Takahiro <[email protected]>--- lib/efi_loader/efi_disk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)lib/efi_loader/efi_disk.c +3
-2@@ -239,6 +239,7 @@ static efi_status_t efi_disk_add_dev( struct efi_disk_obj **disk) {struct efi_disk_obj *diskobj; +disk_partition_t info;efi_status_t ret;/* Don't add empty devices */ @@ -270,7 +271,8 @@ static efi_status_t efi_disk_add_dev( diskobj->dp);if (ret !=EFI_SUCCESS )return ret; -if (part >=1 ) { +/* partitions or whole disk without partitions */ +if (part >=1 ||part_get_info (desc, part, &info)) { diskobj->volume =efi_simple_file_system (desc, part, diskobj->dp); ret = efi_add_protocol(&diskobj->header, --2.21.0
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 1/1 efi_loader: disk: install file system protocol to a whole disk
Quoted 10 lines · Heinrich Schuchardt
Quoted 9 lines · Mark Kettenis
Quoted 9 lines
From: AKASHI Takahiro <[email protected]>
Date: Thu, 22 Aug 2019 17:06:25 +0900Currently, a whole disk without any partitions is not associated with
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. So even if it houses FAT file system, there is a chance that we may not be able to access it, particularly, when accesses are to be attempted after searching that protocol against a device handle.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
With this patch,
EFI_SIMPLE_FILE_SYSTEM_PROTOCOLis installed to such a disk ifpart_get_info()shows there is not partition table installed on it.Do other UEFI implementations support this?
What use cases exist that come without partition table?
I didn't find any *explicit* description in UEFI specification that mandates that any block device should have a partition table. It may be mandatory for boot(able) disks, but for others?
Quoted 2 lines
You can create an MBR with partition table that is a valid start of a file system.
Obviously we can do that, but if this is not a mandatory requirement, we'd better support no-partitioned cases.
Quoted 2 lines
So you should first check if a partition table exists. Only if none exists you can test for a possible file system.
I don't get your point. Are you saying that we should support a file system for a disk only if it has a file system?
This is not true even for existing partitions as FILE_SYSTEM PROTOCOL is always installed to every partition whether or not it really houses a file system under the current implementation.
Thanks,
-Takahiro Akashi
Quoted 41 lines
Best regards
Heinrich
Quoted 36 lines
Quoted 35 lines
Signed-off-by AKASHI Takahiro <[email protected]>--- lib/efi_loader/efi_disk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)lib/efi_loader/efi_disk.c +3
-2@@ -239,6 +239,7 @@ static efi_status_t efi_disk_add_dev( struct efi_disk_obj **disk) {struct efi_disk_obj *diskobj; +disk_partition_t info;efi_status_t ret;/* Don't add empty devices */ @@ -270,7 +271,8 @@ static efi_status_t efi_disk_add_dev( diskobj->dp);if (ret !=EFI_SUCCESS )return ret; -if (part >=1 ) { +/* partitions or whole disk without partitions */ +if (part >=1 ||part_get_info (desc, part, &info)) { diskobj->volume =efi_simple_file_system (desc, part, diskobj->dp); ret = efi_add_protocol(&diskobj->header, --2.21.0
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 1/1 efi_loader: disk: install file system protocol to a whole disk
Heinrich,
Quoted 23 lines · AKASHI Takahiro
Quoted 10 lines · Heinrich Schuchardt
Quoted 9 lines · Mark Kettenis
Quoted 9 lines
From: AKASHI Takahiro <[email protected]>
Date: Thu, 22 Aug 2019 17:06:25 +0900Currently, a whole disk without any partitions is not associated with
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. So even if it houses FAT file system, there is a chance that we may not be able to access it, particularly, when accesses are to be attempted after searching that protocol against a device handle.Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
With this patch,
EFI_SIMPLE_FILE_SYSTEM_PROTOCOLis installed to such a disk ifpart_get_info()shows there is not partition table installed on it.Do other UEFI implementations support this?
What use cases exist that come without partition table?
I didn't find any *explicit* description in UEFI specification that mandates that any block device should have a partition table. It may be mandatory for boot(able) disks, but for others?
Quoted 5 lines
Quoted 2 lines
You can create an MBR with partition table that is a valid start of a file system.
Obviously we can do that, but if this is not a mandatory requirement, we'd better support no-partitioned cases.
Any further comments?
-Takahiro Akashi
Quoted 55 lines
Quoted 3 lines
So you should first check if a partition table exists. Only if none exists you can test for a possible file system.
I don't get your point. Are you saying that we should support a file system for a disk only if it has a file system?
This is not true even for existing partitions asFILE_SYSTEMPROTOCOL is always installed to every partition whether or not it really houses a file system under the current implementation.Thanks,
-Takahiro AkashiQuoted 41 lines
Best regards
Heinrich
Quoted 36 lines
Quoted 35 lines
Signed-off-by AKASHI Takahiro <[email protected]>--- lib/efi_loader/efi_disk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)lib/efi_loader/efi_disk.c +3
-2@@ -239,6 +239,7 @@ static efi_status_t efi_disk_add_dev( struct efi_disk_obj **disk) {struct efi_disk_obj *diskobj; +disk_partition_t info;efi_status_t ret;/* Don't add empty devices */ @@ -270,7 +271,8 @@ static efi_status_t efi_disk_add_dev( diskobj->dp);if (ret !=EFI_SUCCESS )return ret; -if (part >=1 ) { +/* partitions or whole disk without partitions */ +if (part >=1 ||part_get_info (desc, part, &info)) { diskobj->volume =efi_simple_file_system (desc, part, diskobj->dp); ret = efi_add_protocol(&diskobj->header, --2.21.0
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 1/1 efi_loader: disk: install file system protocol to a whole disk
Quoted 31 lines · AKASHI Takahiro
Heinrich,
Quoted 28 lines · AKASHI Takahiro
Quoted 10 lines · Heinrich Schuchardt
Quoted 9 lines · Mark Kettenis
Quoted 9 lines
From: AKASHI Takahiro <[email protected]>
Date: Thu, 22 Aug 2019 17:06:25 +0900Currently, a whole disk without any partitions is not associated with
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. So even if it houses FAT file system, there is a chance that we may not be able to access it, particularly, when accesses are to be attempted after searching that protocol against a device handle.Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
With this patch,
EFI_SIMPLE_FILE_SYSTEM_PROTOCOLis installed to such a disk ifpart_get_info()shows there is not partition table installed on it.Do other UEFI implementations support this?
What use cases exist that come without partition table?
I didn't find any *explicit* description in UEFI specification that mandates that any block device should have a partition table. It may be mandatory for boot(able) disks, but for others?
Quoted 2 lines
You can create an MBR with partition table that is a valid start of a file system.
Obviously we can do that, but if this is not a mandatory requirement, we'd better support no-partitioned cases.
I did not mean this as a requirement but as a source of errors.
My idea is that could have an MBR which by chance looks like the start of a file system. When you now expose this non-existent file system the UEFI client may create havoc.
Quoted 14 lines
Any further comments?
-Takahiro Akashi
Quoted 9 lines
Quoted 3 lines
So you should first check if a partition table exists. Only if none exists you can test for a possible file system.
I don't get your point. Are you saying that we should support a file system for a disk only if it has a file system?
This is not true even for existing partitions asFILE_SYSTEMPROTOCOL is always installed to every partition whether or not it really houses a file system under the current implementation.
That sounds like a bug. If a partition isn't formatted we would not even know whether to call the FAT or the EXT4 driver.
Regards
Heinrich
Quoted 47 lines
Quoted 46 lines
Thanks,
-Takahiro AkashiQuoted 41 lines
Best regards
Heinrich
Quoted 36 lines
Quoted 35 lines
Signed-off-by AKASHI Takahiro <[email protected]>--- lib/efi_loader/efi_disk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)lib/efi_loader/efi_disk.c +3
-2@@ -239,6 +239,7 @@ static efi_status_t efi_disk_add_dev( struct efi_disk_obj **disk) {struct efi_disk_obj *diskobj; +disk_partition_t info;efi_status_t ret;/* Don't add empty devices */ @@ -270,7 +271,8 @@ static efi_status_t efi_disk_add_dev( diskobj->dp);if (ret !=EFI_SUCCESS )return ret; -if (part >=1 ) { +/* partitions or whole disk without partitions */ +if (part >=1 ||part_get_info (desc, part, &info)) { diskobj->volume =efi_simple_file_system (desc, part, diskobj->dp); ret = efi_add_protocol(&diskobj->header, --2.21.0
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 1/1 efi_loader: disk: install file system protocol to a whole disk
Quoted 30 lines · Heinrich Schuchardt
Quoted 29 lines · AKASHI Takahiro
Heinrich,
Quoted 26 lines · AKASHI Takahiro
Quoted 10 lines · Heinrich Schuchardt
Quoted 9 lines · Mark Kettenis
Quoted 9 lines
From: AKASHI Takahiro <[email protected]>
Date: Thu, 22 Aug 2019 17:06:25 +0900Currently, a whole disk without any partitions is not associated with
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. So even if it houses FAT file system, there is a chance that we may not be able to access it, particularly, when accesses are to be attempted after searching that protocol against a device handle.Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
With this patch,
EFI_SIMPLE_FILE_SYSTEM_PROTOCOLis installed to such a disk ifpart_get_info()shows there is not partition table installed on it.Do other UEFI implementations support this?
What use cases exist that come without partition table?
I didn't find any *explicit* description in UEFI specification that mandates that any block device should have a partition table. It may be mandatory for boot(able) disks, but for others?
Quoted 2 lines
You can create an MBR with partition table that is a valid start of a file system.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Obviously we can do that, but if this is not a mandatory requirement, we'd better support no-partitioned cases.
I did not mean this as a requirement but as a source of errors.
My idea is that could have an MBR which by chance looks like the start of a file system. When you now expose this non-existent file system the UEFI client may create havoc.
See below.
Quoted 9 lines
Quoted 9 lines
Any further comments?
-Takahiro Akashi
Quoted 4 lines
Quoted 3 lines
So you should first check if a partition table exists. Only if none exists you can test for a possible file system.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
I don't get your point. Are you saying that we should support a file system for a disk only if it has a file system?
This is not true even for existing partitions asFILE_SYSTEMPROTOCOL is always installed to every partition whether or not it really houses a file system under the current implementation.That sounds like a bug. If a partition isn't formatted we would not even know whether to call the FAT or the EXT4 driver.
Yes, the issue does exist in the current implementation.
So a good approach is
1. Check if a partition table is installed or not
2. If yes,
2-1 If a partition has a file system, install FILE_SYSTEM_PROTOCOL
to *that* partition.
2-2 not install FILE_SYSTEM_PROTOCOL to a whole disk
3. If no, and only if a file system exists, install FILE_SYSTEM_PROTOCOL to a whole disk
(2.1) and additional check at (3) should be added.
-Takahiro Akashi
Quoted 52 lines
Regards
Heinrich
Quoted 47 lines
Quoted 46 lines
Thanks,
-Takahiro AkashiQuoted 41 lines
Best regards
Heinrich
Quoted 36 lines
Quoted 35 lines
Signed-off-by AKASHI Takahiro <[email protected]>--- lib/efi_loader/efi_disk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)lib/efi_loader/efi_disk.c +3
-2@@ -239,6 +239,7 @@ static efi_status_t efi_disk_add_dev( struct efi_disk_obj **disk) {struct efi_disk_obj *diskobj; +disk_partition_t info;efi_status_t ret;/* Don't add empty devices */ @@ -270,7 +271,8 @@ static efi_status_t efi_disk_add_dev( diskobj->dp);if (ret !=EFI_SUCCESS )return ret; -if (part >=1 ) { +/* partitions or whole disk without partitions */ +if (part >=1 ||part_get_info (desc, part, &info)) { diskobj->volume =efi_simple_file_system (desc, part, diskobj->dp); ret = efi_add_protocol(&diskobj->header, --2.21.0
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot