* [PATCH] dlibs: fix access to `major_names data
@ 2024-07-26 19:35 Kris Van Hees
2024-07-29 15:27 ` Nick Alcock
0 siblings, 1 reply; 2+ messages in thread
From: Kris Van Hees @ 2024-07-26 19:35 UTC (permalink / raw)
To: dtrace, dtrace-devel
On systems that lack CTF data, all kernel variable have a default type of
uintptr_t. That means that an explicit &-operator needs to be applied
is the kernel variable is e.g. the address of an array because it will not
be recognized as a ref-type.
Fix this for `major_names access in the io translators.
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
---
dlibs/aarch64/5.11/io.d | 2 +-
dlibs/aarch64/5.12/io.d | 2 +-
dlibs/aarch64/5.14/io.d | 2 +-
dlibs/aarch64/5.16/io.d | 2 +-
dlibs/aarch64/5.2/io.d | 2 +-
dlibs/aarch64/5.6/io.d | 2 +-
dlibs/aarch64/6.1/io.d | 2 +-
dlibs/aarch64/6.10/io.d | 2 +-
dlibs/x86_64/5.11/io.d | 2 +-
dlibs/x86_64/5.12/io.d | 2 +-
dlibs/x86_64/5.14/io.d | 2 +-
dlibs/x86_64/5.16/io.d | 2 +-
dlibs/x86_64/5.2/io.d | 2 +-
dlibs/x86_64/5.6/io.d | 2 +-
dlibs/x86_64/6.1/io.d | 2 +-
dlibs/x86_64/6.10/io.d | 2 +-
16 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/dlibs/aarch64/5.11/io.d b/dlibs/aarch64/5.11/io.d
index b1958418..c153d5a2 100644
--- a/dlibs/aarch64/5.11/io.d
+++ b/dlibs/aarch64/5.11/io.d
@@ -131,7 +131,7 @@ translator devinfo_t < struct bio *B > {
dev_instance = 0;
dev_name = B->bi_disk == NULL
? "nfs"
- : stringof(((struct blk_major_name **)`major_names)[
+ : stringof(((struct blk_major_name **)&`major_names)[
getmajor(B->bi_disk->part_tbl->part[B->bi_partno]->bd_dev) % 255
]->name);
dev_statname = B->bi_disk == NULL ? "nfs" :
diff --git a/dlibs/aarch64/5.12/io.d b/dlibs/aarch64/5.12/io.d
index 8c2830cd..09968d5a 100644
--- a/dlibs/aarch64/5.12/io.d
+++ b/dlibs/aarch64/5.12/io.d
@@ -131,7 +131,7 @@ translator devinfo_t < struct bio *B > {
dev_instance = 0;
dev_name = B->bi_bdev == NULL
? "nfs"
- : stringof(((struct blk_major_name **)`major_names)[
+ : stringof(((struct blk_major_name **)&`major_names)[
getmajor(B->bi_bdev->bd_dev) % 255
]->name);
dev_statname = B->bi_bdev == NULL ? "nfs" :
diff --git a/dlibs/aarch64/5.14/io.d b/dlibs/aarch64/5.14/io.d
index 8c2830cd..09968d5a 100644
--- a/dlibs/aarch64/5.14/io.d
+++ b/dlibs/aarch64/5.14/io.d
@@ -131,7 +131,7 @@ translator devinfo_t < struct bio *B > {
dev_instance = 0;
dev_name = B->bi_bdev == NULL
? "nfs"
- : stringof(((struct blk_major_name **)`major_names)[
+ : stringof(((struct blk_major_name **)&`major_names)[
getmajor(B->bi_bdev->bd_dev) % 255
]->name);
dev_statname = B->bi_bdev == NULL ? "nfs" :
diff --git a/dlibs/aarch64/5.16/io.d b/dlibs/aarch64/5.16/io.d
index 8c2830cd..09968d5a 100644
--- a/dlibs/aarch64/5.16/io.d
+++ b/dlibs/aarch64/5.16/io.d
@@ -131,7 +131,7 @@ translator devinfo_t < struct bio *B > {
dev_instance = 0;
dev_name = B->bi_bdev == NULL
? "nfs"
- : stringof(((struct blk_major_name **)`major_names)[
+ : stringof(((struct blk_major_name **)&`major_names)[
getmajor(B->bi_bdev->bd_dev) % 255
]->name);
dev_statname = B->bi_bdev == NULL ? "nfs" :
diff --git a/dlibs/aarch64/5.2/io.d b/dlibs/aarch64/5.2/io.d
index 972917fb..5111df28 100644
--- a/dlibs/aarch64/5.2/io.d
+++ b/dlibs/aarch64/5.2/io.d
@@ -131,7 +131,7 @@ translator devinfo_t < struct bio *B > {
dev_instance = 0;
dev_name = B->bi_disk == NULL
? "nfs"
- : stringof(((struct blk_major_name **)`major_names)[
+ : stringof(((struct blk_major_name **)&`major_names)[
getmajor(B->bi_disk->part_tbl->part[B->bi_partno]->__dev.devt) % 255
]->name);
dev_statname = B->bi_disk == NULL ? "nfs" :
diff --git a/dlibs/aarch64/5.6/io.d b/dlibs/aarch64/5.6/io.d
index 972917fb..5111df28 100644
--- a/dlibs/aarch64/5.6/io.d
+++ b/dlibs/aarch64/5.6/io.d
@@ -131,7 +131,7 @@ translator devinfo_t < struct bio *B > {
dev_instance = 0;
dev_name = B->bi_disk == NULL
? "nfs"
- : stringof(((struct blk_major_name **)`major_names)[
+ : stringof(((struct blk_major_name **)&`major_names)[
getmajor(B->bi_disk->part_tbl->part[B->bi_partno]->__dev.devt) % 255
]->name);
dev_statname = B->bi_disk == NULL ? "nfs" :
diff --git a/dlibs/aarch64/6.1/io.d b/dlibs/aarch64/6.1/io.d
index 8c2830cd..09968d5a 100644
--- a/dlibs/aarch64/6.1/io.d
+++ b/dlibs/aarch64/6.1/io.d
@@ -131,7 +131,7 @@ translator devinfo_t < struct bio *B > {
dev_instance = 0;
dev_name = B->bi_bdev == NULL
? "nfs"
- : stringof(((struct blk_major_name **)`major_names)[
+ : stringof(((struct blk_major_name **)&`major_names)[
getmajor(B->bi_bdev->bd_dev) % 255
]->name);
dev_statname = B->bi_bdev == NULL ? "nfs" :
diff --git a/dlibs/aarch64/6.10/io.d b/dlibs/aarch64/6.10/io.d
index ffccf5b3..d6cb0c83 100644
--- a/dlibs/aarch64/6.10/io.d
+++ b/dlibs/aarch64/6.10/io.d
@@ -131,7 +131,7 @@ translator devinfo_t < struct bio *B > {
dev_instance = 0;
dev_name = B->bi_bdev == NULL
? "nfs"
- : stringof(((struct blk_major_name **)`major_names)[
+ : stringof(((struct blk_major_name **)&`major_names)[
getmajor(B->bi_bdev->bd_dev) % 255
]->name);
dev_statname = B->bi_bdev == NULL ? "nfs" :
diff --git a/dlibs/x86_64/5.11/io.d b/dlibs/x86_64/5.11/io.d
index a9f718dd..ae4b62c3 100644
--- a/dlibs/x86_64/5.11/io.d
+++ b/dlibs/x86_64/5.11/io.d
@@ -131,7 +131,7 @@ translator devinfo_t < struct bio *B > {
dev_instance = 0;
dev_name = B->bi_disk == NULL
? "nfs"
- : stringof(((struct blk_major_name **)`major_names)[
+ : stringof(((struct blk_major_name **)&`major_names)[
getmajor(B->bi_disk->part_tbl->part[B->bi_partno]->bd_dev) % 255
]->name);
dev_statname = B->bi_disk == NULL ? "nfs" :
diff --git a/dlibs/x86_64/5.12/io.d b/dlibs/x86_64/5.12/io.d
index 3101a4ec..0432b02c 100644
--- a/dlibs/x86_64/5.12/io.d
+++ b/dlibs/x86_64/5.12/io.d
@@ -131,7 +131,7 @@ translator devinfo_t < struct bio *B > {
dev_instance = 0;
dev_name = B->bi_bdev == NULL
? "nfs"
- : stringof(((struct blk_major_name **)`major_names)[
+ : stringof(((struct blk_major_name **)&`major_names)[
getmajor(B->bi_bdev->bd_dev) % 255
]->name);
dev_statname = B->bi_bdev == NULL ? "nfs" :
diff --git a/dlibs/x86_64/5.14/io.d b/dlibs/x86_64/5.14/io.d
index 3101a4ec..0432b02c 100644
--- a/dlibs/x86_64/5.14/io.d
+++ b/dlibs/x86_64/5.14/io.d
@@ -131,7 +131,7 @@ translator devinfo_t < struct bio *B > {
dev_instance = 0;
dev_name = B->bi_bdev == NULL
? "nfs"
- : stringof(((struct blk_major_name **)`major_names)[
+ : stringof(((struct blk_major_name **)&`major_names)[
getmajor(B->bi_bdev->bd_dev) % 255
]->name);
dev_statname = B->bi_bdev == NULL ? "nfs" :
diff --git a/dlibs/x86_64/5.16/io.d b/dlibs/x86_64/5.16/io.d
index 3101a4ec..0432b02c 100644
--- a/dlibs/x86_64/5.16/io.d
+++ b/dlibs/x86_64/5.16/io.d
@@ -131,7 +131,7 @@ translator devinfo_t < struct bio *B > {
dev_instance = 0;
dev_name = B->bi_bdev == NULL
? "nfs"
- : stringof(((struct blk_major_name **)`major_names)[
+ : stringof(((struct blk_major_name **)&`major_names)[
getmajor(B->bi_bdev->bd_dev) % 255
]->name);
dev_statname = B->bi_bdev == NULL ? "nfs" :
diff --git a/dlibs/x86_64/5.2/io.d b/dlibs/x86_64/5.2/io.d
index 20b6c3a9..415bbb4c 100644
--- a/dlibs/x86_64/5.2/io.d
+++ b/dlibs/x86_64/5.2/io.d
@@ -131,7 +131,7 @@ translator devinfo_t < struct bio *B > {
dev_instance = 0;
dev_name = B->bi_disk == NULL
? "nfs"
- : stringof(((struct blk_major_name **)`major_names)[
+ : stringof(((struct blk_major_name **)&`major_names)[
getmajor(B->bi_disk->part_tbl->part[B->bi_partno]->__dev.devt) % 255
]->name);
dev_statname = B->bi_disk == NULL ? "nfs" :
diff --git a/dlibs/x86_64/5.6/io.d b/dlibs/x86_64/5.6/io.d
index 20b6c3a9..415bbb4c 100644
--- a/dlibs/x86_64/5.6/io.d
+++ b/dlibs/x86_64/5.6/io.d
@@ -131,7 +131,7 @@ translator devinfo_t < struct bio *B > {
dev_instance = 0;
dev_name = B->bi_disk == NULL
? "nfs"
- : stringof(((struct blk_major_name **)`major_names)[
+ : stringof(((struct blk_major_name **)&`major_names)[
getmajor(B->bi_disk->part_tbl->part[B->bi_partno]->__dev.devt) % 255
]->name);
dev_statname = B->bi_disk == NULL ? "nfs" :
diff --git a/dlibs/x86_64/6.1/io.d b/dlibs/x86_64/6.1/io.d
index 3101a4ec..0432b02c 100644
--- a/dlibs/x86_64/6.1/io.d
+++ b/dlibs/x86_64/6.1/io.d
@@ -131,7 +131,7 @@ translator devinfo_t < struct bio *B > {
dev_instance = 0;
dev_name = B->bi_bdev == NULL
? "nfs"
- : stringof(((struct blk_major_name **)`major_names)[
+ : stringof(((struct blk_major_name **)&`major_names)[
getmajor(B->bi_bdev->bd_dev) % 255
]->name);
dev_statname = B->bi_bdev == NULL ? "nfs" :
diff --git a/dlibs/x86_64/6.10/io.d b/dlibs/x86_64/6.10/io.d
index de693c18..d67181b4 100644
--- a/dlibs/x86_64/6.10/io.d
+++ b/dlibs/x86_64/6.10/io.d
@@ -131,7 +131,7 @@ translator devinfo_t < struct bio *B > {
dev_instance = 0;
dev_name = B->bi_bdev == NULL
? "nfs"
- : stringof(((struct blk_major_name **)`major_names)[
+ : stringof(((struct blk_major_name **)&`major_names)[
getmajor(B->bi_bdev->bd_dev) % 255
]->name);
dev_statname = B->bi_bdev == NULL ? "nfs" :
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] dlibs: fix access to `major_names data
2024-07-26 19:35 [PATCH] dlibs: fix access to `major_names data Kris Van Hees
@ 2024-07-29 15:27 ` Nick Alcock
0 siblings, 0 replies; 2+ messages in thread
From: Nick Alcock @ 2024-07-29 15:27 UTC (permalink / raw)
To: Kris Van Hees; +Cc: dtrace, dtrace-devel
On 26 Jul 2024, Kris Van Hees outgrape:
> On systems that lack CTF data, all kernel variable have a default type of
> uintptr_t. That means that an explicit &-operator needs to be applied
> is the kernel variable is e.g. the address of an array because it will not
> be recognized as a ref-type.
>
> Fix this for `major_names access in the io translators.
Ugh. Nasty, and presumably every *other* translator doing a stringof
might have this problem too. (But most are unaffected because they're
doing struct derefs or other things that need the types in scope
anyway.)
> diff --git a/dlibs/aarch64/5.11/io.d b/dlibs/aarch64/5.11/io.d
> index b1958418..c153d5a2 100644
> --- a/dlibs/aarch64/5.11/io.d
> +++ b/dlibs/aarch64/5.11/io.d
> @@ -131,7 +131,7 @@ translator devinfo_t < struct bio *B > {
> dev_instance = 0;
> dev_name = B->bi_disk == NULL
> ? "nfs"
> - : stringof(((struct blk_major_name **)`major_names)[
> + : stringof(((struct blk_major_name **)&`major_names)[
> getmajor(B->bi_disk->part_tbl->part[B->bi_partno]->bd_dev) % 255
> ]->name);
> dev_statname = B->bi_disk == NULL ? "nfs" :
I wish this wasn't necessary, and hope that in the future we can reverse
it, but at least it's minimally invasive:
Reviewed-by: Nick Alcock <nick.alcock@oracle.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-29 15:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-26 19:35 [PATCH] dlibs: fix access to `major_names data Kris Van Hees
2024-07-29 15:27 ` Nick Alcock
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox