Kernel: Reject loading ELF files with no loadable segments

If there's no loadable segments then there can't be any code to execute
either. This resolves a crash these kinds of ELF files would cause from
the directly following VERIFY statement.
This commit is contained in:
Idan Horowitz 2023-12-15 17:38:24 +02:00 committed by Andreas Kling
parent 2a6b492c7f
commit 1bea780a7f

View file

@ -201,6 +201,10 @@ static ErrorOr<RequiredLoadRange> get_required_load_range(OpenFileDescription& p
range.end = region_end;
});
// If there's nothing to load, there's nothing to execute
if (range.start == range.end)
return EINVAL;
VERIFY(range.end > range.start);
return range;
}