summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibELF/Validation.cpp
AgeCommit message (Collapse)Author
2023-02-08LibELF: Add EM_AARCH64 as expected architecture for ELF validationTimon Kruiper
2023-01-21Everywhere: Remove string.h include from AK/Traits.h and resolve falloutAndrew Kaster
A lot of places were relying on AK/Traits.h to give it strnlen, memcmp, memcpy and other related declarations. In the quest to remove inclusion of LibC headers from Kernel files, deal with all the fallout of this included-everywhere header including less things.
2022-12-28LibELF+LibSymbolication: Remove i686 supportLiav A
2022-12-20LibELF: Include <pthread.h> to ensure PTHREAD_STACK_MAX is availableAndrew Kaster
Android's bionic C library puts this definition in pthread.h rather than limits.h
2022-12-11Kernel+LibC+LibELF: Set stack size based on PT_GNU_STACK during execvesin-ack
Some programs explicitly ask for a different initial stack size than what the OS provides. This is implemented in ELF by having a PT_GNU_STACK header which has its p_memsz set to the amount that the program requires. This commit implements this policy by reading the p_memsz of the header and setting the main thread stack size to that. ELF::Image::validate_program_headers ensures that the size attribute is a reasonable value.
2022-05-01LibELF: Relax restriction on allowed values of EI_OSABI to allow GNUAndrew Kaster
This check is here to make sure we only try to load serenity binaries. However, with -fprofile-instr-generate -fcoverage-mapping, clang sets the EI_OSABI field to 3, for GNU. The instrumentation uses a lot of retained COMDAT sections for coverage instrumentation that get the SHF_GNU_RETAINED section header flag set on them, forcing llvm to set the ABI to GNU.
2022-02-16Kernel+LibELF+LibVT: Remove unused AK::String header includesIdan Horowitz
2022-01-13LibELF: Accept Span instead of Pointer+Size in validate_program_headersIdan Horowitz
2022-01-13LibELF: Use StringBuilders instead of Strings for the interpreter pathIdan Horowitz
This is required for the Kernel's usage of LibELF, since Strings do not expose allocation failure.
2021-08-31LibELF: Allow (but ignore) PT_LOAD headers with zero sizeAndreas Kling
GNU ld sometimes generates zero-sized PT_LOAD headers when running with the "-z separate-code" option. Let's not choke on such headers, we can just ignore them and move along.
2021-07-01LibELF: Check for missing PT_LOAD alignment header valueIdan Horowitz
This ensures we dont divide by zero when checking for valid alignment values.
2021-06-29LibELF: Don't validate PT_LOAD alignment in ET_CORE filesAndreas Kling
This was causing CrashDaemon to choke on our coredumps. Note that we didn't care about the validation failures before this change either, this patch simply reorders the checks to avoid divide-by-zero when validating an ET_CORE file.
2021-06-28Kernel+LibELF: Add support for validating and loading ELF64 executablesGunnar Beutner
2021-06-24 LibELF: Fix missing includeHendiadyoin1
A few files are expecting that someone brings PAGE_SIZE from possibly the Kernel with them
2021-05-30AK+Userland: Use akaster@serenityos.org for my copyright headersAndrew Kaster
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-18LibC+LibELF: Implement support for the dl_iterate_phdr helperGunnar Beutner
This helper is used by libgcc_s to figure out where the .eh_frame sections are located for all loaded shared objects.
2021-04-18LibElf: Allow PT_GNU_EH_FRAME program headersGunnar Beutner
These are built when compiling an executable with exception support.
2021-03-29LibElf+readelf: Parse ELFs with no program headers correctlyIdan Horowitz
This simply fixes a check which assumed the program header count was always non zero.
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-01-30LibELF: Add a bunch of overflow checks in ELF validationAndreas Kling
2021-01-16LibELF: validate_program_headers: Validate PT_INTERP header p_filesz > 1Brendan Coles
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling