commit | f1ce987ca191eb3bc5923f299699f166132de262 | [log] [tgz] |
---|---|---|
author | Nikita Ioffe <ioffe@google.com> | Fri Dec 09 13:31:59 2022 +0000 |
committer | Nikita Ioffe <ioffe@google.com> | Wed Dec 14 17:24:22 2022 +0000 |
tree | 29d991770d7c9d0e52b8546595ee92abe1aa230e | |
parent | 63dd9e28ef1badd211f84107895ce6a9e713110b [diff] |
Fix OOM in createOrUpdateIdsigFile when a directory is passed createOrUpdateIdsigFile uses V4Signature::create function, which takes an fd that is passed to it and lseeks to the end of it. If that fd corresponds to a directory on ext4, then lseek will return (off_t)-1. As a result, the function will OOM trying to allocate 72 petabytes of memory. This change fixes the issue by adding verification logic in createOrUpdateIdsigFile that passed pfd corresponds to a regular file. It also adds unit tests for createOrUpdateIdsigFile. I've also added comment to V4Signature::create telling callers that they should validate their fd before calling the function. Bug: 261840405 Test: atest virtualizationservice_device_test Test: adb shell /apex/com.android.virt/bin/vm create-idsig \ /apex/com.android.virt/app/EmptyPayloadApp@AOSP.MASTER \ /data/local/tmp/fun-with-microdroid Change-Id: Iddb694e10946eefb4df8959d06fe3488e9c6ac66
This repository contains userspace services related to running virtual machines on Android, especially protected virtual machines. See the getting started documentation and Microdroid README for more information.