Commit graph

1956 commits

Author SHA1 Message Date
Tao Bao
c96c9881a6 Merge "Revert "Fix memory/resource handling in imgdiff.cpp, using unique_ptr and vector."" 2016-06-01 21:32:15 +00:00
Tao Bao
a0c4011028 Revert "Fix memory/resource handling in imgdiff.cpp, using unique_ptr and vector."
This reverts commit 50a6f8c833.

A mix of new and free leads to memory corruptions.
2016-06-01 13:15:44 -07:00
Treehugger Robot
a8850710e5 Merge "Fix memory/resource handling in imgdiff.cpp, using unique_ptr and vector." 2016-06-01 18:24:15 +00:00
Adam Buchbinder
50a6f8c833 Fix memory/resource handling in imgdiff.cpp, using unique_ptr and vector.
This fixes the following cppcheck reports:
[imgdiff.cpp:197]: (error) Memory leak: img
[imgdiff.cpp:386]: (error) Memory leak: img
[imgdiff.cpp:656]: (error) Memory leak: data
[imgdiff.cpp:664]: (error) Memory leak: data
[imgdiff.cpp:668]: (error) Memory leak: data
[imgdiff.cpp:668]: (error) Resource leak: f
[imgdiff.cpp:820]: (error) Memory leak: bonus_data
[imgdiff.cpp:824]: (error) Memory leak: bonus_data
[imgdiff.cpp:824]: (error) Resource leak: f
[imgdiff.cpp:847]: (error) Memory leak: bonus_data
[imgdiff.cpp:851]: (error) Memory leak: bonus_data
[imgdiff.cpp:856]: (error) Memory leak: bonus_data
[imgdiff.cpp:860]: (error) Memory leak: bonus_data
[imgdiff.cpp:227]: (error) Memory leak: temp_entries

Change-Id: I06f878d0b677a25328e0deb84f65f3b7212e24b1
(cherry picked from commit 51dc9444bc)
2016-06-01 10:28:45 -07:00
Tao Bao
59203510eb Merge "Revert "imgdiff: Generate statically linked imgdiff."" 2016-06-01 00:09:19 +00:00
Tao Bao
16e3861c84 Revert "imgdiff: Generate statically linked imgdiff."
This reverts commit b4422bd769.

Bug: 28941046
Change-Id: Ic3c7439c64b8e55832252850514f721a944993d6
2016-06-01 00:08:40 +00:00
Tao Bao
680d783ecc Merge "imgdiff: Generate statically linked imgdiff." 2016-05-31 22:42:13 +00:00
Tao Bao
b4422bd769 imgdiff: Generate statically linked imgdiff.
Bug: 28941046
Change-Id: If3019d8cff91fd4f6fa4516bef5a0f51c2ddebc7
2016-05-30 21:53:11 -07:00
Treehugger Robot
3788001b2c Merge "slot_metadata: add verity_corrupted field" 2016-05-23 21:10:16 +00:00
Jeremy Compostella
e77a68f67f slot_metadata: add verity_corrupted field
In rootfs context, the verity mode must be supplied by the bootloader
to the kernel.  This patch creates a new verity_corrupted field in the
slot metadata structure to remind that this slot is corrupted from a
dm-verity point of view.

If the bootloader receives the "dm-verity device corrupted" reboot
target, it should set this bit to 1.  If this bit value is 1, the
bootloader should set the veritymode to "eio".

Change-Id: I9335a39d7d009200318c58c53a3139d542788a9b
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
2016-05-23 13:10:23 +02:00
Treehugger Robot
14352497f0 Merge "Keep ADF device alive for the lifetime of the minui backend" 2016-05-12 17:24:24 +00:00
Tao Bao
c7d7eb2225 Merge "updater, minzip: Remove unnecessary O_SYNC flags." 2016-05-08 17:58:19 +00:00
Alistair Strachan
733285fea2 updater, minzip: Remove unnecessary O_SYNC flags.
Remove O_SYNC from mzExtractRecursive() and PackageExtractFileFn().
These functions deal with extracting whole files from the update
package onto a filesystem. If run on ext4 on a rotating disk, for
example, the O_SYNC flag will cause serious performance problems
and the extraction proecss can take over 30 minutes, with no
obvious benefits.

This API function already calls fsync(fd) after each file is
extracted to ensure data and metadata is written to the underlying
block device, so the O_SYNC calls should be superfluous and safely
removable.

This change does not affect the OTA patch paths or any modification
of the bootloader partition or writes to other 'emmc' partitions.

Signed-off-by: Alistair Strachan <alistair.strachan@imgtec.com>
Change-Id: I9cbb98a98e6278bf5c0d7efaae340773d1fbfcd2
2016-05-05 16:04:58 -07:00
Treehugger Robot
704cac2f99 Merge "applypatch: Use bsdiff from external/bsdiff." 2016-05-05 22:35:43 +00:00
Jonathan Hamilton
bab6e492ef Keep ADF device alive for the lifetime of the minui backend
Some ADF drivers do some amount of state cleanup when the ADF device
node is closed, making and attempts to draw using it fail.

This changes the minui ADF backend to keep the adf_device open until it
is exited, fixing issues on such devices.
2016-05-05 15:30:57 -07:00
Sen Jiang
2fffcb174b applypatch: Use bsdiff from external/bsdiff.
external/bsdiff uses divsufsort which is much faster, and also include
some bug fixes.

Bug: 26982501
Test: ./imgdiff_test.sh

Change-Id: I089a301c291ee55d79938c7a3ca6d509895440d1
2016-05-03 16:39:51 -07:00
Treehugger Robot
ecd6e2af50 Merge "recovery: Always log the update attempt." 2016-05-03 05:40:23 +00:00
Tao Bao
37c45027bb recovery: Always log the update attempt.
An OTA may be skipped due to low battery. But we should always log it to
understand why an update _fails_ to apply.

Bug: 27893175
Change-Id: I50a3fbbb3e51035e0ac5f1cca150e283852825c3
(cherry picked from commit 5687001895)
2016-05-02 21:27:43 -07:00
Chih-hung Hsieh
fafa6a6531 Merge "Fix google-explicit-constructor warnings." 2016-04-29 22:26:41 +00:00
Chih-Hung Hsieh
49c5c79df1 Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: I5b35ae16c069e7e9229e66963386f322bd808af1
2016-04-29 14:16:35 -07:00
Tao Bao
df59ceecfb Merge "updater: Don't zero out CommandParameters with memset(3)." 2016-04-28 04:28:19 +00:00
Tao Bao
730646199b updater: Don't zero out CommandParameters with memset(3).
[1] switched a few things to android::base::unique_fd including
CommandParameters.fd. However, we were using memset(3) to zero out the
struct, which effectively assigned unique_fd(0) to fd. When it called
fd.reset(), file descriptor 0 was unintentionally closed. When FD 0 was
later reassigned via open(2), it led to lseek(2) errors: "Bad file
descriptor".

This CL switches to using braced-init (i.e. '= {}') instead, so that the
default constructor unique_fd(-1) would be called.

[1]: commit bcabd09293

Bug: 28391985
Change-Id: If1f99932b15552714c399e65c8b80550344b758a
2016-04-26 17:36:13 -07:00
Chih-hung Hsieh
a1f4a1ec33 Merge "Fix google-runtime-int warnings." 2016-04-18 22:19:06 +00:00
Chih-Hung Hsieh
54a2747ef3 Fix google-runtime-int warnings.
Bug: 28220065
Change-Id: Ida199c66692a1638be6990d583d2ed42583fb592
2016-04-18 12:29:30 -07:00
Treehugger Robot
51dcd0da37 Merge "Fix IWYU errors." 2016-04-16 01:46:25 +00:00
David Benjamin
a86392ea92 Fix IWYU errors.
This fixes build errors with BoringSSL master. (The cpp file uses functions
from bn.h and neither it nor the header includes it.)

Change-Id: If7f38aa0b931aa7940079bc006c7283b31f3b774
2016-04-15 20:27:44 -04:00
Tao Bao
e6af5228aa Merge "Define the Bootloader Control A/B structure" 2016-04-15 16:51:14 +00:00
Elliott Hughes
62e6637f8b Merge "Convert recovery to use BoringSSL instead of mincrypt." 2016-04-12 23:12:35 +00:00
Mattias Nissler
452df6d99c Convert recovery to use BoringSSL instead of mincrypt.
This changes the verification code in bootable/recovery to use
BoringSSL instead of mincrypt.

Change-Id: I37b37d84b22e81c32ac180cd1240c02150ddf3a7
2016-04-06 15:54:17 +02:00
Jeremy Compostella
b3bf958d4f Define the Bootloader Control A/B structure
Define the A/B structure for implementation using the misc partition
as storage.  The bootloader_control structure is designed to be put in
the bootloader_message slot_suffix field.

Change-Id: I158bdf3e69b3f327a1dde4c6eb1f907dbaf8939c
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
2016-04-06 09:56:10 +02:00
Mark Salyzyn
901f31531b Merge "recovery-persist: pick up both pstore console files" 2016-04-05 14:29:05 +00:00
Mark Salyzyn
5f7111ff4d recovery-persist: pick up both pstore console files
- Volantis console-ramoops-0 (upstream correct)
- Angler console-ramoops
- Bullhead console-ramoops
- Shamu console-ramoops

NB: Shamu also has kernel crashes in other pstore files,
    not merging them in.

Bug: 27176738
Change-Id: Ib6eef3e25475935b89252f51c960719c7860511a
2016-04-04 16:24:48 -07:00
Elliott Hughes
81247500d5 Merge "Move selinux dependencies out of header files." 2016-04-02 15:53:11 +00:00
Elliott Hughes
4bbd5bf8a6 Move selinux dependencies out of header files.
Bug: http://b/27764900
Change-Id: Ib62a59edcb13054f40f514c404d32b87b14ed5f1
2016-04-01 18:24:39 -07:00
Mark Salyzyn
75da77105f Merge "recovery: use __android_log_pmsg_file_write for log files" 2016-03-31 20:49:56 +00:00
Yabin Cui
ebd22be4f7 Merge "uncrypt: remove --read-bcb option." 2016-03-30 01:19:25 +00:00
Yabin Cui
6507265906 uncrypt: remove --read-bcb option.
Bug: 27897241
Change-Id: I4f52ada58e8f204dba8c974ea0ae03876411ecf0
(cherry picked from commit 61799baba3)
2016-03-29 18:14:44 -07:00
Tianjie Xu
3568004cba Merge "Add string for Installing_security_update" 2016-03-29 23:58:31 +00:00
Tianjie Xu
1c95c97e55 Add string for Installing_security_update
Bug: 27837319
Change-Id: I037158697a294c3e03f186f3b4207ea700321a8a
(cherry picked from commit 1ee0ff3d78)
2016-03-29 13:59:22 -07:00
Elliott Hughes
5d73735552 Merge "Switch to <android-base/unique_fd.h>." 2016-03-29 17:55:47 +00:00
Elliott Hughes
bcabd09293 Switch to <android-base/unique_fd.h>.
Change-Id: I13ba3f40bd52b5f3e3fe9002a45a9a8630040129
2016-03-29 08:18:34 -07:00
Mark Salyzyn
a4f701af93 recovery: use __android_log_pmsg_file_write for log files
- Add call to __android_log_pmsg_file_write for recovery logging.
- Add call to refresh pmsg if we reboot back into recovery and then
  allow overwrite of those logs.
- Add a new one-time executable recovery-refresh that refreshes pmsg
  in post-fs phase of init. We rely on pmsg eventually scrolling off
  to age the content after recovery-persist has done its job.
- Add a new one-time executable recovery-persist that transfers from
  pmsg to /data/misc/recovery/ directory if /cache is not mounted
  in post-fs-data phase of init.
- Build and appropriately trigger the above two as required if
  BOARD_CACHEIMAGE_PARTITION_SIZE is undefined.
- Add some simple unit tests

NB: Test failure is expected on systems that do not deliver either
the recovery-persist or recovery-refresh executables, e.g. systems
with /cache. Tests also require a timely reboot sequence of test
to truly verify, tests provide guidance on stderr to direct.

Bug: 27176738
Change-Id: I17bb95980234984f6b2087fd5941b0a3126b706b
2016-03-28 11:07:00 -07:00
Elliott Hughes
2dbd06c7ed Merge "Move recovery_l10n here from development/tools." 2016-03-26 15:45:24 +00:00
Elliott Hughes
3d0153a807 Move recovery_l10n here from development/tools.
Bug: http://b/27837319
Change-Id: I116fc13ae108a59b657f5c9f7efe971de72ac743
2016-03-26 08:42:49 -07:00
Tianjie Xu
3123e5ad94 Merge "Skip stashing source blocks in verify mode" 2016-03-25 22:09:34 +00:00
Tianjie Xu
7eca97e75d Skip stashing source blocks in verify mode
Currently block_image_verify() stashes source blocks to /cache and
in some case triggers I/O errors. To avoid this risk, We create
a map from the hash value to the source blocks' range_set. When
executing stash command in verify mode, source range is saved but block
contents aren't stashed. And load_stash could get its value from
either the stashed file from the previous update, or the contents on
the source partition specified by the saved range.

Bug: 27584487
Bug: 25633753
Change-Id: I775baf4bee55762b6e7b204f8294afc597afd996
(cherry picked from commit 0188935d55)
2016-03-25 14:56:21 -07:00
Tianjie Xu
7e18ce221f Merge "Clean up intent_file related code in recovery.cpp" 2016-03-25 21:03:00 +00:00
Tao Bao
9afbf2af4c Merge "Correct caching behavior for should_inject_cache" 2016-03-25 19:03:28 +00:00
Jed Estep
e326b22446 Correct caching behavior for should_inject_cache
Bug: 27800498
Change-Id: I5255283c1d04a385ed719c5bc2be461cae9f3648
(cherry picked from commit 88dd7796a1)
2016-03-25 11:21:12 -07:00
Tianjie Xu
c14d95da58 Clean up intent_file related code in recovery.cpp
No one in recovery or framework is utilizing intent file. Clean
up the code.

Bug:27725880
Change-Id: I78b37ff94261793e0d6a86a0fa6d27dcfe3f4783
2016-03-24 12:49:46 -07:00