/* * Copyright 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _LIBUNWINDSTACK_UNWINDERCOMPONENTCREATOR_H #define _LIBUNWINDSTACK_UNWINDERCOMPONENTCREATOR_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../ElfFake.h" #include "../MemoryFake.h" #include "fuzzer/FuzzedDataProvider.h" using unwindstack::ArchEnum; using unwindstack::DexFiles; using unwindstack::Elf; using unwindstack::ElfFake; using unwindstack::ElfInterfaceFake; using unwindstack::FunctionData; using unwindstack::Maps; using unwindstack::Memory; using unwindstack::MemoryFake; using unwindstack::Regs; using unwindstack::StepData; static constexpr uint8_t kArchCount = 6; static constexpr uint8_t kMaxSoNameLen = 150; static constexpr uint8_t kMaxFuncNameLen = 50; static constexpr uint8_t kMaxFuncCount = 100; static constexpr uint8_t kMaxJitElfFiles = 20; static constexpr uint8_t kJitElfPadding = 32; static constexpr uint8_t kMaxStepCount = 100; static constexpr uint8_t kMaxMapEntryCount = 50; static constexpr uint8_t kMaxBuildIdLen = 100; static constexpr uint8_t kMaxMapInfoNameLen = 150; std::unique_ptr GetRegisters(unwindstack::ArchEnum arch); std::unique_ptr GetMaps(FuzzedDataProvider* data_provider); std::vector GetStringList(FuzzedDataProvider* data_provider, uint max_str_len, uint max_strings); unwindstack::ArchEnum GetArch(FuzzedDataProvider* data_provider); void AddMapInfo(uint64_t start, uint64_t end, uint64_t offset, uint64_t flags, const char* name, Elf* elf = nullptr); void PutElfFilesInMemory(MemoryFake* memory, FuzzedDataProvider* data_provider); std::unique_ptr GetDexFiles(FuzzedDataProvider* data_provider, std::shared_ptr memory, uint max_libraries, uint max_library_length, unwindstack::ArchEnum arch); #endif // _LIBUNWINDSTACK_UNWINDERCOMPONENTCREATOR_H