Re: [PATCH v3 net-next 02/12] bpf/verifier: rework value tracking
From: Edward Cree
Date: Wed Jun 28 2017 - 14:28:52 EST
On 28/06/17 18:09, Daniel Borkmann wrote:
> Could you elaborate on this one? If I understand it correctly, then
> the scalar += pointer case would mean the following: given I have one
> of the allowed pointer types in adjust_ptr_min_max_vals() then the
> prior scalar type inherits the ptr type/id. I would then 'destroy' the
> pointer value so we get a -EACCES on it. We mark the tmp off_reg as
> scalar type, but shouldn't also actual dst_reg be marked as such
> like in below pointer += scalar case, such that we undo the prior
> ptr_type inheritance?
Good catch. The intent was that adjust_ptr_min_max_vals() wouldn't mark
dst_reg's type/id in the case when it returned -EACCES, but indeed there
are some such paths, and rather than changing those it may be easier to
change the type/id back to scalar/0. I don't think we need to go as far
as calling __mark_reg_unknown() on it though, its bounds and align
shouldn't have been screwed up by adjust_ptr_min_max_vals().
-Ed