On Fri, 27 Oct 2023 09:37:19 GMT, Johan Sjölen <jsjo...@openjdk.org> wrote:

>> Thomas Stuefe has updated the pull request with a new target base due to a 
>> merge or a rebase. The pull request now contains four commits:
>> 
>>  - Merge master and solve merge conflicts
>>  - small fixes
>>  - start from VM op; show more thread details
>>  - start
>
> src/hotspot/os/linux/memMapPrinter_linux.cpp line 81:
> 
>> 79:   FILE* f = os::fopen("/proc/self/maps", "r");
>> 80:   if (f != nullptr) {
>> 81:     char line[1024];
> 
> This looks like a bug: A line may at most be 1024 characters, but 
> `scan_proc_maps_line` may clearly read more than 1024 characters. Yes, it 
> won't read out of bounds, but it limits the parser unnecessarily.

The parser will silently truncate these lines; the rest of the lines will be 
read with subsequent fgets calls and silently ignored, since they don't match 
the pattern. This is a pattern that we use all over the place.

About the size, yes, it makes sense to increase this to match what we later 
read from it. But there will always be a limit. I don't want to allocate memory 
dynamically in here to keep the VMA map stable during printing.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16301#discussion_r1374440296

Reply via email to