diff options
Diffstat (limited to 'dynamic-layers/selinux/android-tools/android-tools/fastboot_dont_use_sparse_file_import_auto_in_load_buf_fd.patch')
-rw-r--r-- | dynamic-layers/selinux/android-tools/android-tools/fastboot_dont_use_sparse_file_import_auto_in_load_buf_fd.patch | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/dynamic-layers/selinux/android-tools/android-tools/fastboot_dont_use_sparse_file_import_auto_in_load_buf_fd.patch b/dynamic-layers/selinux/android-tools/android-tools/fastboot_dont_use_sparse_file_import_auto_in_load_buf_fd.patch new file mode 100644 index 0000000..d8c74be --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/fastboot_dont_use_sparse_file_import_auto_in_load_buf_fd.patch | |||
@@ -0,0 +1,42 @@ | |||
1 | upstream commit taken as below | ||
2 | Original Issue link | ||
3 | https://android-review.googlesource.com/c/platform/system/core/+/1123485 | ||
4 | |||
5 | Commit taken below: | ||
6 | |||
7 | fastboot: don't use sparse_file_import_auto() in load_buf_fd() | ||
8 | |||
9 | load_buf_fd() attempts to find the size of the file that it is about | ||
10 | to load by first calling sparse_file_import_auto() then using | ||
11 | sparse_file_len() upon success or falling back to the file size on the | ||
12 | filesystem on failure. | ||
13 | |||
14 | This is problematic however as sparse_file_import_auto() creates a | ||
15 | sparse_file out of the normal file, but does not resparse it, so an | ||
16 | assertion fails during the sparse_file_len() call. | ||
17 | |||
18 | This is fixed by using sparse_file_import() instead. This will fail | ||
19 | in the case that the file is not sparse and the call to | ||
20 | sparse_file_len() will be properly skipped. | ||
21 | |||
22 | Bug: 140538105 | ||
23 | Test: flash blueline factory image with assertions enabled in | ||
24 | libsparse/sparse.cpp | ||
25 | |||
26 | Change-Id: I0283be33563a3301ce5b09bde41105a20f91086c | ||
27 | |||
28 | https://android.googlesource.com/platform/system/core/+/fbb9535aaea5ae4011f3c3edf4c00b27452f57ec | ||
29 | Upstream-Status: Backport(commit fbb9535aaea5ae4011f3c3edf4c00b27452f57ec) | ||
30 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
31 | |||
32 | --- git/system/core/fastboot/fastboot.cpp 2021-05-28 09:24:15.583963227 +0000 | ||
33 | +++ git/system/core/fastboot/fastboot.cpp 2021-05-28 09:25:09.948974990 +0000 | ||
34 | @@ -869,7 +869,7 @@ | ||
35 | return false; | ||
36 | } | ||
37 | |||
38 | - if (sparse_file* s = sparse_file_import_auto(fd, false, false)) { | ||
39 | + if (sparse_file* s = sparse_file_import(fd, false, false)) { | ||
40 | buf->image_size = sparse_file_len(s, false, false); | ||
41 | sparse_file_destroy(s); | ||
42 | } else { | ||