• yonghong-song's avatar
    avoid probe rewriting of p->m in &(p->m) (#1831) · 24581968
    yonghong-song authored
    Fix issue #1830.
    
    After the rewrite, the code approximately becomes
      &({type _val; bpf_probe_read(&_val, sizeof(_val), &(p->m)); _val)
    
    Firstly the rewriting is really unnecessary, and secondly
    the compilation will fail since the addressOf cannot take address
    of the rvalue _val.
    
    C standard, however, allows the addressOf operand array subscript
    expression, e.g.,
      &({type _val; bpf_probe_read(&_val, sizeof(_val), &(p->m)); _val)[0]
    
    This patch intends to fix the problem by avoiding
    the rewriting in the first place of addrressOf simple member expression.
    It still permits addressOf the array subscript expression.
    Signed-off-by: default avatarYonghong Song <yhs@fb.com>
    24581968
b_frontend_action.h 6.5 KB