public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] test: account for member name change in mm_struct
@ 2026-02-03 16:23 Kris Van Hees
  2026-02-03 20:41 ` [DTrace-devel] " Eugene Loh
  0 siblings, 1 reply; 3+ messages in thread
From: Kris Van Hees @ 2026-02-03 16:23 UTC (permalink / raw)
  To: dtrace, dtrace-devel

mm_struct->cpu_bitmap has been renamed mm_struct->flexible_array

Add support for both variants.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
---
 ....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
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-03 21:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-03 16:23 [PATCH] test: account for member name change in mm_struct Kris Van Hees
2026-02-03 20:41 ` [DTrace-devel] " Eugene Loh
2026-02-03 21:03   ` Kris Van Hees

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox