Skip to content

Commit f324c15

Browse files
committed
pt_scaling: let MB-scale auto-scaling profiles parse; refuse implausible process counts where a profile drives processes
1 parent 558b7a5 commit f324c15

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

‎pt_scaling.c‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,12 @@ int create_auto_scaling_profile( char *name,
8787
down_cycles_tocheck = 0;
8888
down_cycles_delay = 0;
8989
}
90-
if (max_procs==0 || max_procs <= min_procs || max_procs>=1000) {
91-
LM_ERR("invalid relation or range for MIN/MAX processes [%d,%d]\n",
90+
/* a profile is a set of numbers that may drive a process group (counts,
91+
* checked again at create_process_group() time, where a four-digit
92+
* process count is refused) or an HG_MALLOC arena (MB, where 1024 and
93+
* far above are ordinary) - so only the relation is checked here */
94+
if (max_procs==0 || max_procs <= min_procs || max_procs >= (1u << 20)) {
95+
LM_ERR("invalid relation or range for MIN/MAX [%d,%d]\n",
9296
min_procs, max_procs);
9397
return -1;
9498
}
@@ -175,6 +179,13 @@ int create_process_group(enum process_type type,
175179
int h_size;
176180
str type_s;
177181

182+
if (prof->max_procs >= 1000) {
183+
LM_ERR("profile <%s>: %u is not a plausible number of processes "
184+
"(MB-scale targets belong to shm/pkg_auto_scaling_profile)\n",
185+
prof->name, prof->max_procs);
186+
return -1;
187+
}
188+
178189
/* how much of a history do we need in order to cover both up and down
179190
* tranzitions ? */
180191
h_size = (prof->up_cycles_tocheck > prof->down_cycles_tocheck) ?

0 commit comments

Comments
 (0)