Bug#1001449: array indexing broken

2021-12-10 Thread Vincent Bernat
 ❦ 10 December 2021 10:40 +01, Julian Taylor:

> This has been fixed upstream with this patch:
> https://github.com/iovisor/bpftrace/pull/1457

I'll try to push the update for the next point release (Dec 18).
-- 
The last thing one knows in constructing a work is what to put first.
-- Blaise Pascal



Bug#1001449: array indexing broken

2021-12-10 Thread Julian Taylor

Package: bpftrace
Version: 0.11.3-5
Tags: patch fixed-upstream

array indexing in bpftrace in debian stable is broken it always indexes 
with 0:

Example:

#!/usr/bin/env bpftrace
#include 
#include 
kprobe:tcp_connect
{
  $sk = ((struct sock *) arg0);
  if ($sk->__sk_common.skc_family == AF_INET6) {
  $d0 = $sk->__sk_common.skc_v6_daddr.in6_u.u6_addr32[0];
  $d1 = $sk->__sk_common.skc_v6_daddr.in6_u.u6_addr32[1];
  $d2 = $sk->__sk_common.skc_v6_daddr.in6_u.u6_addr32[2];
  $d3 = $sk->__sk_common.skc_v6_daddr.in6_u.u6_addr32[3];
  printf("%X %X %X %X\n", $d0, $d1, $d2, $d3);
  }
}

$ bpftrace tcpconnect.bt
$ curl -v http://[:::127.0.0.1]

output:
Attaching 1 probe...
0 0 0 0


expected:
0 0  17F


This has been fixed upstream with this patch:
https://github.com/iovisor/bpftrace/pull/1457