[Bug bpf/24659] New: kernel 5.2 bpf -- user and kernel-space map reads not synchronized?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug bpf/24659] New: kernel 5.2 bpf -- user and kernel-space map reads not synchronized?

Martin.Jansa at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24659

            Bug ID: 24659
           Summary: kernel 5.2 bpf -- user and kernel-space map reads not
                    synchronized?
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: bpf
          Assignee: systemtap at sourceware dot org
          Reporter: me at serhei dot io
  Target Milestone: ---

It appears that the recent kernels (seen on 5.2 rawhide) introduce some timing
issue between kernel- and user-space map operations.

global value//=2
global status//=2

probe begin {
  println("BEGIN")
  value = 2
  status = 2
}

probe kernel.function("vfs_read") {
  status = 0
  if (value == 2) next
  status = 1
}

probe kernel.function("vfs_read") {
  printf("vfs_read\n")
  printf("value %d\n", value)
  printf("status %d\n", status)
  if (status != 2) exit()
}

probe end {
  printf("end\n")
  printf("value %d\n", value)
  printf("status %d\n", status)
  if (status)
    println("END FAIL")
  else
    println("END PASS")
}

In this example, probe end runs too soon after the map update in vfs_read and
receives an updated value. Changing the second probe vfs_read to probe
timer.s(2) would make the testcase pass.

--
You are receiving this mail because:
You are the assignee for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug bpf/24659] kernel 5.2 bpf -- user and kernel-space map reads not synchronized?

Martin.Jansa at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24659

--- Comment #1 from Serhei Makarov <me at serhei dot io> ---
* should prior email should be 'receives an outdated value'. Output as follows:

BEGIN
vfs_read
value 0
status 0
end
value 2
status 2
END FAIL

--
You are receiving this mail because:
You are the assignee for the bug.