summaryrefslogtreecommitdiffstats
path: root/dynamic-layers/selinux/android-tools/android-tools/core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dynamic-layers/selinux/android-tools/android-tools/core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch')
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch
new file mode 100644
index 0000000..d465ad6
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch
@@ -0,0 +1,54 @@
1From a4839f29e1286b0c53208a45b9c237d81021f829 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:15:47 +0100
4Subject: [PATCH 05/15] fastboot: don't use sparse_file_import_auto() in
5 load_buf_fd()
6
7upstream commit taken as below Original Issue link https://android-review.googlesource.com/c/platform/system/core/+/1123485
8
9Commit taken below:
10
11fastboot: don't use sparse_file_import_auto() in load_buf_fd()
12
13load_buf_fd() attempts to find the size of the file that it is about
14to load by first calling sparse_file_import_auto() then using
15sparse_file_len() upon success or falling back to the file size on the
16filesystem on failure.
17
18This is problematic however as sparse_file_import_auto() creates a
19sparse_file out of the normal file, but does not resparse it, so an
20assertion fails during the sparse_file_len() call.
21
22This is fixed by using sparse_file_import() instead. This will fail
23in the case that the file is not sparse and the call to
24sparse_file_len() will be properly skipped.
25
26Bug: 140538105
27Test: flash blueline factory image with assertions enabled in
28 libsparse/sparse.cpp
29
30Change-Id: I0283be33563a3301ce5b09bde41105a20f91086c
31
32https://android.googlesource.com/platform/system/core/+/fbb9535aaea5ae4011f3c3edf4c00b27452f57ec
33Upstream-Status: Backport [commit fbb9535aaea5ae4011f3c3edf4c00b27452f57ec]
34Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
35---
36 fastboot/fastboot.cpp | 2 +-
37 1 file changed, 1 insertion(+), 1 deletion(-)
38
39diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
40index 3b7b5571..0ae9402e 100644
41--- a/fastboot/fastboot.cpp
42+++ b/fastboot/fastboot.cpp
43@@ -869,7 +869,7 @@ static bool load_buf_fd(int fd, struct fastboot_buffer* buf) {
44 return false;
45 }
46
47- if (sparse_file* s = sparse_file_import_auto(fd, false, false)) {
48+ if (sparse_file* s = sparse_file_import(fd, false, false)) {
49 buf->image_size = sparse_file_len(s, false, false);
50 sparse_file_destroy(s);
51 } else {
52--
532.36.1.vfs.0.0
54