tracing: Free histogram the field rejected for a bad modifier
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ e30fbc618e97b38dbb49f1d44dcd0778d3f23b8c · < 230234d12ce42ab04132a32c3a848f07a5d27a71| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
tracing: Free histogram the field rejected for a bad modifier
Writing a hist trigger whose value or variable carries a modifier that is not allowed there leaks the fields that were built for it.
__create_val_field() takes the field from parse_expr() and stores it in hist_data->fields[] only after the modifier checks have run:
hist_field = parse_expr(hist_data, file, field_str, flags, var_name, &n_subexprs); ... if (hist_field->flags & HIST_FIELD_FL_VAR) { if (hist_field->flags & (...)) goto err; } else { if (hist_field->flags & (...)) goto err; }
hist_data->fields[val_idx] = hist_field;
Both checks jump past that store, and the err label returns without freeing anything. The error unwinds to create_hist_data(), which calls destroy_hist_data() -> destroy_hist_fields(), and that reaches a field only by walking fields[]. A field that never got there is unreachable.
commit e0213434fe3e ("tracing: Do not let histogram values have some modifiers") set ret to -EINVAL and fell through to the store, which left the field owned by fields[] and freed along with the rest of hist_data. Splitting the check into a value case and a variable case replaced that fall-through with a goto that skips it.
From the CVE record · Linux
The Linux kernel’s tracing histogram code leaks allocated fields when a hist trigger with a disallowed value or variable modifier is rejected. An attacker who can write hist triggers can repeat this operation to cause memory leaks; the input does not specify whether authentication or user interaction is required.
Operators running Linux kernels with tracing histogram support should check their kernel versions against the vendor advisory; affected versions are not specified.