Skip to content

8298248: Limit sscanf output width in cgroup file parsers #3391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/hotspot/os/linux/cgroupV2Subsystem_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ char * CgroupV2Subsystem::cpu_cpuset_cpus() {

char* CgroupV2Subsystem::cpu_quota_val() {
GET_CONTAINER_INFO_CPTR(cptr, _unified, "/cpu.max",
"Raw value for CPU quota is: %s", "%s %*d", quota, 1024);
"Raw value for CPU quota is: %s", "%1023s %*d", quota, 1024);
return os::strdup(quota);
}

Expand Down Expand Up @@ -141,7 +141,7 @@ jlong CgroupV2Subsystem::memory_max_usage_in_bytes() {

char* CgroupV2Subsystem::mem_soft_limit_val() {
GET_CONTAINER_INFO_CPTR(cptr, _unified, "/memory.low",
"Memory Soft Limit is: %s", "%s", mem_soft_limit_str, 1024);
"Memory Soft Limit is: %s", "%1023s", mem_soft_limit_str, 1024);
return os::strdup(mem_soft_limit_str);
}

Expand All @@ -164,14 +164,14 @@ jlong CgroupV2Subsystem::memory_and_swap_limit_in_bytes() {

char* CgroupV2Subsystem::mem_swp_limit_val() {
GET_CONTAINER_INFO_CPTR(cptr, _unified, "/memory.swap.max",
"Memory and Swap Limit is: %s", "%s", mem_swp_limit_str, 1024);
"Memory and Swap Limit is: %s", "%1023s", mem_swp_limit_str, 1024);
return os::strdup(mem_swp_limit_str);
}

// memory.swap.current : total amount of swap currently used by the cgroup and its descendants
char* CgroupV2Subsystem::mem_swp_current_val() {
GET_CONTAINER_INFO_CPTR(cptr, _unified, "/memory.swap.current",
"Swap currently used is: %s", "%s", mem_swp_current_str, 1024);
"Swap currently used is: %s", "%1023s", mem_swp_current_str, 1024);
return os::strdup(mem_swp_current_str);
}

Expand All @@ -198,7 +198,7 @@ jlong CgroupV2Subsystem::read_memory_limit_in_bytes() {

char* CgroupV2Subsystem::mem_limit_val() {
GET_CONTAINER_INFO_CPTR(cptr, _unified, "/memory.max",
"Raw value for memory limit is: %s", "%s", mem_limit_str, 1024);
"Raw value for memory limit is: %s", "%1023s", mem_limit_str, 1024);
return os::strdup(mem_limit_str);
}

Expand All @@ -224,7 +224,7 @@ char* CgroupV2Controller::construct_path(char* mount_path, char *cgroup_path) {

char* CgroupV2Subsystem::pids_max_val() {
GET_CONTAINER_INFO_CPTR(cptr, _unified, "/pids.max",
"Maximum number of tasks is: %s", "%s %*d", pidsmax, 1024);
"Maximum number of tasks is: %s", "%1023s %*d", pidsmax, 1024);
return os::strdup(pidsmax);
}

Expand Down