summaryrefslogtreecommitdiff
path: root/libfec
AgeCommit message (Collapse)Author
2024-01-04Remove unused mutex fieldsKelvin Zhang
The mutex usage is removed in aosp/179410 , we can safely remove the mutex fields now. Test: th Bug: 318078616 Change-Id: Id22e8eab9c8cb6cc24fcbf9e32d222ba6d11cb84
2023-05-08Cleanup fec_process to use modern C++ primitivesKelvin Zhang
Test: th Bug: 279705058 Change-Id: I644fcee0f206b2f9523f413d82650fe0ea8aba6d
2023-04-28libfec: Fix unaligned multiblock readsSami Tolvanen
fec_process miscalculates the number of blocks it needs to read when we perform a small read that spans multiple blocks, which results in a partial read. The function also returns early when it notices the partial read without cleaning up the worker threads, which can lead to the caller releasing the buffer that the threads are still using. Fix the calculation and add a test case to fec_unittest. Bug: 279705058 Test: fec_unittest Change-Id: I0d36950d3324572043b345997a21bb3e985968e5
2022-12-06Allow libfec to correct bad blocksKelvin Zhang
dm-verity already corrects I/O errors. userspace library libfec should behave in the same way. This allows us to correct more errors during OTA. Test: th Bug: 259622792 Change-Id: I0e53d7ff47474524f12c6a2abd901f55ed927137
2022-03-24Tweak linux_glibc properties for musl builds in system/extrasColin Cross
For convenience, builds against musl libc currently use the linux_glibc properties because they are almost always linux-specific and not glibc-specific. In preparation for removing this hack, tweak the linux_glibc properties by either moving them to host_linux, which will apply to linux_glibc, linux_musl and linux_bionic, or by setting appropriate musl or linux_musl properties. Properties that must not be repeated while musl uses linux_musl and also still uses the linux_glibc properties are moved to glibc properties, which don't apply to musl. Whether these stay as glibc properties or get moved back to linux_glibc later once the musl hack is removed is TBD. Bug: 223257095 Test: m checkbuild Test: m USE_HOST_MUSL=true host-native Change-Id: Iff2b4ec1465033e3e076774bc0c72b2cf966478c
2021-07-29Stop using syscall() to get tidDan Willemsen
This call is deprecated on recent MacOS versions, use our portable wrapper in libbase instead. Change-Id: I3e247738434f621f83192d4cd6772dbf55f8bed0
2021-07-23Make libfs_mgr dependencies vendor_ramdisk_available.David Anderson
This is needed to link libfs_mgr into snapuserd. Bug: 193833730 Test: builds Change-Id: I41aec802503f8c4bd0ddcf36140afdf02f68536e
2021-06-14Add ramdisk_available to init_first_stage's depsInseob Kim
Bug: 187196593 Test: boot Change-Id: I3b4b8c4758d5e710d3c98dd138b0893a7b320601
2021-04-20Remove unused reference to gtest_prod.Elliott Hughes
There's a gtest_prod_headers headers_lib now, but since this is actually a gtest, it doesn't need it. Bug: http://b/185916167 Test: treehugger Change-Id: I1688f899f5a91dbcb873ddc4f54bc5080ba3de61
2021-02-19[LSC] Add LOCAL_LICENSE_KINDS to system/extrasBob Badour
Added SPDX-license-identifier-Apache-2.0 to: alloc-stress/Android.bp app-launcher/Android.bp boot_control_copy/Android.bp bootctl/Android.bp boottime_tools/bootanalyze/stressfs/Android.bp boottime_tools/bootio/Android.bp brillo_config/Android.mk checkpoint_gc/Android.bp cppreopts/Android.bp crypto-perf/Android.bp ext4_utils/Android.bp ext4_utils/Android.mk f2fs_utils/Android.bp ioblame/Android.bp ioshark/Android.bp iotop/Android.bp kexec_tools/Android.bp latencytop/Android.bp libfec/Android.bp libfec/test/Android.bp libfscrypt/Android.bp libfscrypt/tests/Android.bp libjsonpb/parse/Android.bp libjsonpb/verify/Android.bp memory_replay/Android.bp memtrack/Android.bp mmap-perf/Android.bp module_ndk_libs/libnativehelper/Android.bp multinetwork/Android.bp pagecache/Android.bp partition_tools/Android.bp partition_tools/aidl/Android.bp perf2cfg/Android.bp postinst/Android.bp preopt2cachename/Android.bp profcollectd/Android.bp profcollectd/libprofcollectd/Android.bp profcollectd/libprofcollectd/bindings/libflags/Android.bp pssbench/Android.mk puncture_fs/Android.bp runconuid/Android.bp sane_schedstat/Android.bp showslab/Android.bp simpleperf/Android.bp simpleperf/runtest/Android.bp simpleperf/scripts/inferno/Android.bp simpleperf/simpleperf_app_runner/Android.bp slideshow/Android.mk sound/Android.bp squashfs_utils/Android.bp su/Android.mk taskstats/Android.bp tests/Android.bp tests/audio/alsa/Android.bp tests/binder/benchmarks/Android.bp tests/bootloader/Android.mk tests/cpueater/Android.bp tests/crypto/Android.bp tests/directiotest/Android.bp tests/ext4/Android.mk tests/framebuffer/Android.bp tests/fstest/Android.bp tests/icachetest/Android.bp tests/iptables/qtaguid/Android.bp tests/kernel.config/Android.mk tests/lib/Android.bp tests/lib/testUtil/Android.bp tests/memeater/Android.mk tests/pagingtest/Android.mk tests/pftest/Android.bp tests/schedtest/Android.bp tests/storage/Android.bp tests/suspend_stress/Android.bp tests/tcp_nuke_addr/Android.bp tests/timetest/Android.bp tests/uevents/Android.bp toolchain-extras/Android.bp vbmeta_tools/Android.bp verity/Android.bp verity/fec/Android.bp zram-perf/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: cpustats/Android.bp Added SPDX-license-identifier-BSD to: ANRdaemon/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: Ia559848af903a7b6746d9b12b7de8b83bc57f99d
2021-02-16Revert "[LSC] Add LOCAL_LICENSE_KINDS to system/extras"Bob Badour
This reverts commit 044d055c842a5750359ed71dfe50a6a4bf5f4cc3. Reason for revert: Needs to run as multiple roots. Change-Id: I8e06e7eb19e0f634f52fbd8a1c6662f43e347dd5
2021-02-12[LSC] Add LOCAL_LICENSE_KINDS to system/extrasBob Badour
Added SPDX-license-identifier-Apache-2.0 to: boot_control_copy/Android.bp bootctl/Android.bp boottime_tools/bootanalyze/stressfs/Android.bp boottime_tools/bootio/Android.bp checkpoint_gc/Android.bp cppreopts/Android.bp crypto-perf/Android.bp ext4_utils/Android.bp ext4_utils/Android.mk f2fs_utils/Android.bp ioshark/Android.bp iotop/Android.bp kexec_tools/Android.bp latencytop/Android.bp libfec/Android.bp libfec/test/Android.bp libfscrypt/Android.bp libfscrypt/tests/Android.bp libjsonpb/parse/Android.bp libjsonpb/verify/Android.bp memory_replay/Android.bp memtrack/Android.bp mmap-perf/Android.bp module_ndk_libs/libnativehelper/Android.bp multinetwork/Android.bp pagecache/Android.bp partition_tools/Android.bp perf2cfg/Android.bp postinst/Android.bp preopt2cachename/Android.bp profcollectd/Android.bp profcollectd/libprofcollectd/Android.bp profcollectd/libprofcollectd/bindings/libflags/Android.bp puncture_fs/Android.bp runconuid/Android.bp sane_schedstat/Android.bp showslab/Android.bp simpleperf/Android.bp simpleperf/runtest/Android.bp simpleperf/scripts/inferno/Android.bp simpleperf/simpleperf_app_runner/Android.bp slideshow/Android.mk sound/Android.bp squashfs_utils/Android.bp su/Android.mk taskstats/Android.bp tests/Android.bp tests/audio/alsa/Android.bp tests/binder/benchmarks/Android.bp tests/bootloader/Android.mk tests/cpueater/Android.bp tests/crypto/Android.bp tests/directiotest/Android.bp tests/ext4/Android.mk tests/framebuffer/Android.bp tests/fstest/Android.bp tests/icachetest/Android.bp tests/iptables/qtaguid/Android.bp tests/kernel.config/Android.mk tests/lib/Android.bp tests/lib/testUtil/Android.bp tests/memeater/Android.mk tests/pagingtest/Android.mk tests/pftest/Android.bp tests/schedtest/Android.bp tests/storage/Android.bp tests/suspend_stress/Android.bp tests/tcp_nuke_addr/Android.bp tests/timetest/Android.bp tests/uevents/Android.bp toolchain-extras/Android.bp vbmeta_tools/Android.bp verity/Android.bp verity/fec/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: cpustats/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD legacy_notice to: Android.bp Added SPDX-license-identifier-BSD to: ANRdaemon/Android.bp Added legacy_notice to: alloc-stress/Android.bp app-launcher/Android.bp brillo_config/Android.mk ioblame/Android.bp partition_tools/aidl/Android.bp pssbench/Android.mk zram-perf/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: Ie7c022a4d7f828a89d0cda663684a497af37006e
2021-01-27Clean the build rules now that the avbtool can compileJulien Desprez
With the fix to get avbtool compiled cleanly for multilib "first", we can clean this. Test: make host-unit-tests Bug: 178591423 Change-Id: I036e5a8e6a754dd7357b063dee3de0f542710a0e
2021-01-20Switch required to data to be bundled in host-unit-testsJulien Desprez
Test: make fec_unittest Bug: 177450457 Change-Id: I01d8cb0585e94703be97523117ef95581b75cbba
2020-10-26libfec: consistently use check()Thiébaud Weksteen
The check() macro does not require a final semi-colon but its usage is inconsistent through the code. Add a semi-colon for all calls to check(). Change-Id: I5c9da52039f5c59428d40efe02a63aaec54bfb78
2020-07-27libfec: use inclusive languageSami Tolvanen
Comply with Android's inclusive language guidance. Bug: 161896447 Test: comment updates only Change-Id: I07ba5efdc703178208bf11724e95ca3f4b04183c
2020-05-29Fix the parsing of images without hashtree descriptorTianjie
It's possible that the an image doesn't contain a hashtree descriptor. And the current raises a segfault when we attempt to validate and copy a non existing descriptor. Bug: 157778739 Test: call fec_open on dtbo image. Change-Id: Ieb5acf016ceeb547f2b23de43d4276ea4d013a6f
2020-03-09Allow building libfec without libavbTianjie Xu
Add stub implementation for avb related functions to allow building libfec without libavb support. This is useful to build the fec binary when libavb isn't available on mac. Test: build, unittests pass Change-Id: I26f8de390c3c2c37bf48418fb31038ddd9863866
2020-01-21Suport parsing hashtree and ecc data from avbTianjie Xu
Add support to parse the AvbHashtreeFooter in the avb image. We are in particular looking for the ecc and hashtree data so that they can laster be used for error correction. Bug: 144388532 Test: unittests pass Change-Id: I3e53e3e84a58b00346274f9946cafc135702ac82
2019-12-19Don't padd the digest during hash computationTianjie Xu
There's no need to do that. Also check_block_hash() only allocates a buffer of digest_length_. Bug: 144388532 Test: unit tests pass Change-Id: Iec3209d260b51cb41905cc84ae86572bcb1cc130
2019-12-18Add sha1 support for hashtreeTianjie Xu
AVB format uses sha1 as the hash algorithm when computing the hash of each block. This cl adds the support to use either sha1 or sha256 in the hashtree_info struct. It also moves some helper functions as the member function of the struct. Bug: 144388532 Test: unit tests pass Change-Id: Ie4aef1bdd8fa89240f7c6f83fcb2e33f47a468cb
2019-12-18Add test to parse verity dataTianjie Xu
Add a unittest to load and verify a VB1.0 image. Bug: 144388532 Test: unittest pass Change-Id: I1bfc93239a6696c58e9220864009759a2468e136
2019-11-27Factor out the hashtree info from the verity_infoTianjie Xu
Even though the format for the VB2.0(AVB) image is different from the VB1.0 image, the majority of the content is the same. In specific, they both have a hashtree and ecc data. By factoring the hashtree info, fec_read can later use only the hashtree for error correction and doesn't need to have the knowledge of verity format. VB 1.0: Filesystem hash_tree metadata <- assume 8 blocks ecc_data VB 2.0: Filesystem hash_tree ecc_data vbmeta avb footer Also switch the internal struct to use std containers so that we don't need to worry about the memory management. Bug: 144388532 Test: load a verity image, unit tests pass Change-Id: I83c55464c3ac75ac41be9f507b674886ad298350
2018-10-18libfec: Drop the extern "C" wrapping.Tao Bao
squashfs_utils.h does it in its header. Test: `mmma -j system/extra/libfec` Change-Id: I8cc4b5e281fe5649cbb92021285e05e8a5f28ebf
2018-08-13libfec: Use commonly used shared libraries.Tao Bao
This helps reduce the size of libfec.so and the overall size of recovery image, as those libs are already installed on device. Bug: 112494634 Test: `m dist` with aosp_taimen-userdebug Test: `m -j bootimage` with aosp_taimen-userdebug. Check the size of `recovery/system/lib64/libfec.so`. Change-Id: I1c82ba6dcbb6f184fd9826b838af665cbfc06891
2018-08-03libfec: fix a check for read-only modeSami Tolvanen
O_RDONLY is defined as zero, which makes the test for it incorrect. As we don't allow O_WRONLY when opening files, it's sufficient to test for O_RDWR instead. Bug: 112147169 Test: tested that corrupt zero blocks are not read without O_RDWR Change-Id: I2328cda4285f4c9daf98dffa2a6602c9db5ad539
2018-07-31libfec: skip over verity tree when reading metadata from filesystem.Sandeep Patil
If partition size > filesystem image, we must skip over the verity tree appended to the filesystem image when trying to find the verity metadata. Bug: 112046449 Test: Enable verity for hikey960 (system partition size = ~2 x filesystem size) and boot. Change-Id: Ia6cdbc0f35a98fdfa1fb4677951ae5c829cabb0f Signed-off-by: Sandeep Patil <sspatil@google.com>
2018-05-24Mark as recovery_available:trueJiyong Park
Libraries that are direct or indirect dependencies of modules installed to recovery partition (e.g. adbd) are marked as recovery_available: true. This allows a recovery variant of the lib is created when it is depended by other recovery or recovery_available modules. Bug: 79146551 Test: m -j Change-Id: I7bee45375b03d3ada86263580ddcb201e683f024
2018-05-09Convert more of system/extras to SoongDan Willemsen
See build/soong/README.md for more information. Some modules are no longer installed by default on eng/debug builds, but I didn't see any automatic references to them. If they're commonly used by users, they can be added into build/make with PRODUCT_PACKAGES_ENG / PRODUCT_PACKAGES_DEBUG. Otherwise everyone's compiles get a little smaller. Some modules also moved from /system/xbin to /system/bin, as we've deprecated xbin. I checked codesearch for references to the full paths and couldn't find any. Test: cd system/extras; mma Test: for the modules changing locations, check cs/ for references Change-Id: I4ffd99d3dcf50e4d5cb2197824abc11973214133
2017-12-28Don't TEMP_FAILURE_RETRY on close.Josh Gao
close always succeeds, even if it was interrupted and "fails" with EINTR. Retrying will either close a nonexistent fd or stomp on another thread's newly opened file descriptor. Bug: http://b/20501816 Test: treehugger Change-Id: I706d5e8027e60b13f23f9488fdf5cf7cef7b3d3b
2017-10-02Rename target.linux[_x86[_64]] to target.linux_glibc[_x86[_64]]Dan Willemsen
In the future, target.linux will apply to all targets running a linux kernel (android, linux_glibc, linux_bionic). So move all current users to the specific linux_glibc. There will be another cleanup pass later that will move some instances back to target.linux if the properties should be shared with target.android and target.linux_bionic, but target.linux needs to be removed first. Test: out/soong/build.ninja identical before/after Change-Id: I79c638f0e5d0db86f14cb62209ece9166ebe8585 Exempt-From-Owner-Approval: build system cleanup
2017-07-25Remove LOCAL_CLANG and clang: trueLennart Wieboldt
clang is the default compiler since Android nougat Test: mma & verified it´s still build with clang Change-Id: Ie41a98a7d72940e8169996a7081ccec9b94aa61c Signed-off-by: Lennart Wieboldt <lennart.1997@gmx.de>
2017-06-07Fix macOS buildRomain Guy
Test: compile Change-Id: I97e93313f9b6ab7e8a753d4035b7805b21fdfa2d Merged-In: I97e93313f9b6ab7e8a753d4035b7805b21fdfa2d (cherry picked from commit b86fd88966aa15c2b9cce1bf0f7907fcdd11134e)
2017-01-24Convert several libraries to soong.Alex Deymo
This patch coverts libfec and its dependencies to soong. This also updates the name of the libext2_uuid-host library removing the "-host" suffix as that is also being converted to soong. Also create a shared library for libfec given that it has quite a few dependencies. Bug: 34284069 Test: mmma system/extras; make checkbuild Change-Id: Ib3ada6420bae32418a02ca92db664d0d24214e2f
2017-01-11Export libsquashfs_utils include path in the library.Alex Deymo
When using the libsquashfs_utils we need to include its only header, so exposing the include path for this library avoids repeating the path when using it. This patch also removes the include path from the only call site (libfec). Bug: None. Change-Id: I82380b89652f758e4f33a0dc90650b04223c0940
2017-01-11Remove "_host" suffix from libsquashfs_utils.Alex Deymo
Bug: 34220783 Change-Id: I9a140ed7bafdb8342dbdc2c7143a765acb86ecb9
2017-01-11Remove "_static" and "_host" suffix from libext4_utils definitions.Alex Deymo
Bug: 34220783 Change-Id: Ia8da0c96a0384826afd8b089101468ac388d0ca2
2017-01-11Remove "_host" suffix from libfec_rs.Alex Deymo
libfec_rs_host is now renamed to libfec_rs. Bug: 34220783 Change-Id: I70dd794cbf2ed2f118849371379e424159b312a4
2017-01-05libfec: add large file which larger than 4G operation supportwangjiangshao
Add _LARGEFILE64_SOURCE to handle large files such as larger than 4G, fix fec_open cannot open file larger than 4G Bug: https://code.google.com/p/android/issues/detail?id=231508 Test: tested on Android N devices Change-Id: I8df81a039cb987f6bde36384bf69e8ab119fd515 Signed-off-by: wangjiangshao <wangjiangshao@xiaomi.com>
2016-11-08Rename libfec_host to libfec.Alex Deymo
Host libraries don't need to have a different name from the device target. Bug: None Test: `make dist` Change-Id: Ib7709a327ac2fdbdfb131e40f578217633e1f996
2016-10-20libfec: correct verity table only if it's invalidSami Tolvanen
To increase reliability in the case where part of the partition is corrupt and error correction might fail, attempt to use raw verity table before the corrected one. Bug: 32288104 Test: tested on angler Change-Id: I201fdc6162c87b1808979486df5707d683a6d20c
2016-10-09libfec: Update the header path for ext4_utils.Tao Bao
Test: mmma system/extras/libfec Change-Id: I28b71419019c3bb0873b159e178cdfcfb5d89922
2016-09-01libfec: allow fec_header to be located anywhereSami Tolvanen
Don't require fec_header to be immediately after ECC data. Bug: 28865197 Change-Id: Ie8faeeb07c35e2593553f7678762aae7f14c2ff7
2016-08-05Fix references to libcrypto_utils_static.Josh Gao
Bug: http://b/30708454 Change-Id: I471ed5e3be92d60a88bf75ed5e427f7e34eefbc3
2016-08-02Fix google-explicit-constructor warnings in libfec.Chih-Hung Hsieh
Bug: 28341362 Change-Id: Id7d9593e87fc8187942ef808f6ccf943a6ec023d Test: build with WITH_TIDY=1
2016-07-27Fix clang-tidy performance warnings in libfec.Chih-Hung Hsieh
* Use const reference type for for-loop index variables to avoid unnecessary copy. Bug: 30413223 Change-Id: I9819261087a5385fe580f805be44a2407f35cdf5 Test: build with WITH_TIDY=1
2016-06-17Merge "libfec: pack the fec_header structure"Badhri Jagan Sridharan
2016-06-08libfec: return raw and corrected verity metadata signaturesSami Tolvanen
Since it's not possible for libfec to identify whether the signature field was successfully corrected, return both and allow the caller to validate either signature. Bug: 28943429 Change-Id: Ie913c21ba1d07d6df4c6feeb7226b2ec963f4d19 (cherry picked from commit 65cbaeb020b209f3d75d594ebbe49a609dd3c7e7)
2016-05-17libfec: pack the fec_header structureJeremy Compostella
The fec_header structure is generated build time and stored on disk. The fec_header might be build on a 64 bits machine while it is read per a 32 bits device or the other way around. In such situations, the fec_header fields are not aligned as expected by the device and it fails to read the fec_header structure. This patch makes the fec_header packed. Change-Id: I77546f850cea5559909971a1192e1a7616d22d50 Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
2016-04-06Switch to BoringSSL for crypto.Mattias Nissler
Adjust code and dependencies to use BoringSSL + libcrypto_utils instead of libmincrypt. Change-Id: Id1b4ee538923e9dac68a7db2521b70007119c268