-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Use kernel pointer for nonDPTR tests
The nonDPTR tests need to use non-DTrace pointers to be meaningful. They were using pointers in user space, but technically speaking such pointers should first be copied (e.g., with copyin or copyinstr) first. But that makes them DTrace pointers, bypassing the whole point! Use a kernel pointer like `linux_banner. Use short strsize so that .r results files will check consistent "Linux version " strings. Signed-off-by: Eugene Loh <eugene.loh@oracle.com> Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
- Loading branch information
Showing
16 changed files
with
72 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,20 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2022, 2023, 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. | ||
*/ | ||
|
||
#pragma D option quiet | ||
#pragma D option destructive | ||
#pragma D option strsize=14 | ||
|
||
BEGIN | ||
{ | ||
/* "abcdef" */ | ||
system("printf '\x61\x62\x63\x64\x65\x66' > /dev/null 2>&1"); | ||
printf("|%s|\n", strjoin(`linux_banner, `linux_banner)); | ||
exit(0); | ||
} | ||
|
||
syscall::write:entry | ||
/ppid == $pid/ | ||
ERROR | ||
{ | ||
printf("|%s|\n", strjoin((void *)arg1, (void *)arg1)); | ||
exit(0); | ||
exit(1); | ||
} | ||
|
||
ERROR { exit(1); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
|abcdefabcdef| | ||
|Linux version | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,23 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2022, 2023, 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. | ||
*/ | ||
|
||
#pragma D option quiet | ||
#pragma D option destructive | ||
#pragma D option strsize=14 | ||
|
||
BEGIN | ||
{ | ||
/* "abcdef" */ | ||
system("printf '\x61\x62\x63\x64\x65\x66' > /dev/null 2>&1"); | ||
printf("|%s|\n", strtok(`linux_banner, " ")); | ||
printf("|%s|\n", strtok(NULL, " ")); | ||
printf("|%s|\n", strtok("@@@@@ !!!!!", `linux_banner)); | ||
printf("|%s|\n", strtok(NULL, `linux_banner)); | ||
exit(0); | ||
} | ||
|
||
syscall::write:entry | ||
/ppid == $pid/ | ||
ERROR | ||
{ | ||
printf("|%s|\n", strtok((void *)arg1, "defghidEFGHI")); | ||
printf("|%s|\n", strtok(NULL, "fF")); | ||
printf("|%s|\n", strtok("nmlkjihgfFOOBARedcba", (void *)arg1)); | ||
printf("|%s|\n", strtok(NULL, (void *)arg1)); | ||
exit(0); | ||
exit(1); | ||
} | ||
|
||
ERROR { exit(1); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|abc| | ||
|de| | ||
|nmlkjihg| | ||
|FOOBAR| | ||
|Linux| | ||
|version| | ||
|@@@@@| | ||
|!!!!!| | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,21 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2022, 2023, 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. | ||
*/ | ||
|
||
#pragma D option quiet | ||
#pragma D option destructive | ||
#pragma D option strsize=13 | ||
|
||
BEGIN | ||
{ | ||
/* "abcdef" */ | ||
system("printf '\x61\x62\x63\x64\x65\x66' > /dev/null 2>&1"); | ||
printf("|%s|\n", substr(`linux_banner, 1)); | ||
printf("|%s|\n", substr(`linux_banner, 1, 4)); | ||
exit(0); | ||
} | ||
|
||
syscall::write:entry | ||
/ppid == $pid/ | ||
ERROR | ||
{ | ||
printf("|%s|\n", substr((void *)arg1, 1)); | ||
printf("|%s|\n", substr((void *)arg1, 1, 4)); | ||
exit(0); | ||
exit(1); | ||
} | ||
|
||
ERROR { exit(1); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|bcdef| | ||
|bcde| | ||
|inux version | | ||
|inux| | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,20 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2022, 2023, 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. | ||
*/ | ||
|
||
#pragma D option quiet | ||
#pragma D option destructive | ||
#pragma D option strsize=14 | ||
|
||
BEGIN | ||
{ | ||
/* "/foo/bar/baz/.//" */ | ||
system("printf '\x2f\x66\x6f\x6f\x2f\x62\x61\x72\x2f\x62\x61\x7a\x2f\x2e\x2f\x2f' > /dev/null 2>&1"); | ||
printf("|%s|\n", basename(`linux_banner)); | ||
exit(0); | ||
} | ||
|
||
syscall::write:entry | ||
/ppid == $pid/ | ||
ERROR | ||
{ | ||
printf("|%s|\n", basename((void *)arg1)); | ||
exit(0); | ||
exit(1); | ||
} | ||
|
||
ERROR { exit(1); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
|.| | ||
|Linux version | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,20 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2022, 2023, 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. | ||
*/ | ||
|
||
#pragma D option quiet | ||
#pragma D option destructive | ||
#pragma D option strsize=14 | ||
|
||
BEGIN | ||
{ | ||
/* "/foo/bar///baz/" */ | ||
system("printf '\x2f\x66\x6f\x6f\x2f\x62\x61\x72\x2f\x2f\x2f\x62\x61\x7a\x2f' > /dev/null 2>&1"); | ||
printf("|%s|\n", dirname(`linux_banner)); | ||
exit(0); | ||
} | ||
|
||
syscall::write:entry | ||
/ppid == $pid/ | ||
ERROR | ||
{ | ||
printf("|%s|\n", dirname((void *)arg1)); | ||
exit(0); | ||
exit(1); | ||
} | ||
|
||
ERROR { exit(1); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
|/foo/bar| | ||
|.| | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,20 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2022, 2023, 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. | ||
*/ | ||
|
||
#pragma D option quiet | ||
#pragma D option destructive | ||
#pragma D option strsize=14 | ||
|
||
BEGIN | ||
{ | ||
/* "abcdef" */ | ||
system("printf '\x61\x62\x63\x64\x65\x66' > /dev/null 2>&1"); | ||
printf("index is %d, should be 0\n", index(`linux_banner, `linux_banner)); | ||
exit(0); | ||
} | ||
|
||
syscall::write:entry | ||
/ppid == $pid/ | ||
ERROR | ||
{ | ||
printf("index is %d, should be 0\n", index((void *)arg1, (void *)arg1)); | ||
exit(0); | ||
exit(1); | ||
} | ||
|
||
ERROR { exit(1); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2022, 2023, 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. | ||
*/ | ||
|
||
#pragma D option quiet | ||
#pragma D option destructive | ||
#pragma D option strsize=14 | ||
|
||
BEGIN | ||
{ | ||
system("printf '\xc0\xa8\x01\x17' > /dev/null 2>&1"); | ||
/* "Linu" will be 76.105.110.117 */ | ||
printf("%s\n", inet_ntoa(`linux_banner)); | ||
exit(0); | ||
} | ||
|
||
syscall::write:entry | ||
/ppid == $pid/ | ||
ERROR | ||
{ | ||
printf("%s\n", inet_ntoa((void *)arg1)); | ||
exit(0); | ||
exit(1); | ||
} | ||
|
||
ERROR { exit(1); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
192.168.1.23 | ||
76.105.110.117 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,20 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2023, 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. | ||
*/ | ||
|
||
#pragma D option quiet | ||
#pragma D option destructive | ||
#pragma D option strsize=14 | ||
|
||
BEGIN | ||
{ | ||
/* "abcdef" */ | ||
system("printf '\x61\x62\x63\x64\x65\x66' > /dev/null 2>&1"); | ||
printf("rindex is %d, should be 0\n", rindex(`linux_banner, `linux_banner)); | ||
exit(0); | ||
} | ||
|
||
syscall::write:entry | ||
/ppid == $pid/ | ||
ERROR | ||
{ | ||
printf("rindex is %d, should be 0\n", rindex((void *)arg1, (void *)arg1)); | ||
exit(0); | ||
exit(1); | ||
} | ||
|
||
ERROR { exit(1); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,21 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2022, 2023, 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. | ||
*/ | ||
|
||
#pragma D option quiet | ||
#pragma D option destructive | ||
#pragma D option strsize=14 | ||
|
||
BEGIN | ||
{ | ||
/* "abcdef" */ | ||
system("printf '\x61\x62\x63\x64\x65\x66' > /dev/null 2>&1"); | ||
printf("|%s|\n", strchr(`linux_banner, 'x')); | ||
printf("|%s|\n", strrchr(`linux_banner, 'u')); | ||
exit(0); | ||
} | ||
|
||
syscall::write:entry | ||
/ppid == $pid/ | ||
ERROR | ||
{ | ||
printf("|%s|\n", strchr((void *)arg1, 'b')); | ||
printf("|%s|\n", strrchr((void *)arg1, 'b')); | ||
exit(0); | ||
exit(1); | ||
} | ||
|
||
ERROR { exit(1); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|bcdef| | ||
|bcdef| | ||
|x version| | ||
|ux version| | ||
|