Re: [DTrace-devel] [PATCH] test: account for member name change in mm_struct
Kris Van Hees <[email protected]> Tue, 3 Feb 2026 16:03:07 -0500
| Newsgroups | dev.linux.lists.dtrace |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Feb 03, 2026 at 03:41:52PM -0500, Eugene Loh wrote: > I'm curious, does this introduce a new dependency on bpftool that should be > reflected in the .spec file, or can we take it for granted that bpftool will > be there? Hm, yes, that should be listed as a new dependency. Thanks. > The "new" .d file needs an updated copyright year. Thanks. > Is it possible that both .x files "fail"? For some bad reason, I don't know > what. I guess I would have imagined turning the .d test into a .sh test > that checks for a member name, then chooses it or else the alternative, then > runs the script. So the test would have to run, one way or the other. Yes, that is possible if they rename it yet again to something different. I can change the test to be a .sh to avoid that yes. I was hoping not having to do that because they are always a bit more cumbersome but here it does make sense. > On 2/3/26 11:23, Kris Van Hees via DTrace-devel wrote: > > mm_struct->cpu_bitmap has been renamed mm_struct->flexible_array > > > > Add support for both variants. > > > > Signed-off-by: Kris Van Hees <[email protected]> > > --- > > ....d => tst.ctf-dynsized-bounds-runtime-1.d} | 0 > > .../tst.ctf-dynsized-bounds-runtime-1.x | 17 +++++++++++++ > > .../tst.ctf-dynsized-bounds-runtime-2.d | 25 +++++++++++++++++++ > > .../tst.ctf-dynsized-bounds-runtime-2.x | 17 +++++++++++++ > > 4 files changed, 59 insertions(+) > > rename test/unittest/arrays/{tst.ctf-dynsized-bounds-runtime.d => tst.ctf-dynsized-bounds-runtime-1.d} (100%) > > create mode 100755 test/unittest/arrays/tst.ctf-dynsized-bounds-runtime-1.x > > create mode 100644 test/unittest/arrays/tst.ctf-dynsized-bounds-runtime-2.d > > create mode 100755 test/unittest/arrays/tst.ctf-dynsized-bounds-runtime-2.x > > > > diff --git a/test/unittest/arrays/tst.ctf-dynsized-bounds-runtime.d b/test/unittest/arrays/tst.ctf-dynsized-bounds-runtime-1.d > > similarity index 100% > > rename from test/unittest/arrays/tst.ctf-dynsized-bounds-runtime.d > > rename to test/unittest/arrays/tst.ctf-dynsized-bounds-runtime-1.d > > diff --git a/test/unittest/arrays/tst.ctf-dynsized-bounds-runtime-1.x b/test/unittest/arrays/tst.ctf-dynsized-bounds-runtime-1.x > > new file mode 100755 > > index 00000000..264fa150 > > --- /dev/null > > +++ b/test/unittest/arrays/tst.ctf-dynsized-bounds-runtime-1.x > > @@ -0,0 +1,17 @@ > > +#!/bin/bash > > +# > > +# Oracle Linux DTrace. > > +# Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. > > +# Licensed under the Universal Permissive License v 1.0 as shown at > > +# http://oss.oracle.com/licenses/upl. > > + > > +# Skip this test if mm_struct does not have a cpu_bitmap member. > > + > > +type_id=`bpftool btf dump id 1 | \ > > + awk '/\047mm_struct\047/ { print int(substr($1, 2)); }'` > > + > > +if bpftool btf dump id 1 root_id ${type_id} | grep "'cpu_bitmap'" &>/dev/null; then > > + exit 0 > > +fi > > + > > +exit 2 > > diff --git a/test/unittest/arrays/tst.ctf-dynsized-bounds-runtime-2.d b/test/unittest/arrays/tst.ctf-dynsized-bounds-runtime-2.d > > new file mode 100644 > > index 00000000..5e296d60 > > --- /dev/null > > +++ b/test/unittest/arrays/tst.ctf-dynsized-bounds-runtime-2.d > > @@ -0,0 +1,25 @@ > > +/* > > + * Oracle Linux DTrace. > > + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. > > + * Licensed under the Universal Permissive License v 1.0 as shown at > > + * http://oss.oracle.com/licenses/upl. > > + */ > > + > > +/* > > + * ASSERTION: Array accesses work for CTF-declared arrays of dynamic size > > + * (ensuring the bounds checking is also bypassed at runtime). > > + * > > + * SECTION: Pointers and Arrays/Array Declarations and Storage > > + */ > > + > > +BEGIN > > +{ > > + i = pid - pid; /* Non-constant 0 value. */ > > + trace(curthread->mm->flexible_array[i]); > > + exit(0); > > +} > > + > > +ERROR > > +{ > > + exit(1); > > +} > > diff --git a/test/unittest/arrays/tst.ctf-dynsized-bounds-runtime-2.x b/test/unittest/arrays/tst.ctf-dynsized-bounds-runtime-2.x > > new file mode 100755 > > index 00000000..17aa06df > > --- /dev/null > > +++ b/test/unittest/arrays/tst.ctf-dynsized-bounds-runtime-2.x > > @@ -0,0 +1,17 @@ > > +#!/bin/bash > > +# > > +# Oracle Linux DTrace. > > +# Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. > > +# Licensed under the Universal Permissive License v 1.0 as shown at > > +# http://oss.oracle.com/licenses/upl. > > + > > +# Skip this test if mm_struct does not have a flexible_array member. > > + > > +type_id=`bpftool btf dump id 1 | \ > > + awk '/\047mm_struct\047/ { print int(substr($1, 2)); }'` > > + > > +if bpftool btf dump id 1 root_id ${type_id} | grep "'flexible_array'" &>/dev/null; then > > + exit 0 > > +fi > > + > > +exit 2