-
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.
Support inet_ntoa() for addresses that are not DTrace pointers
If the input argument to inet_ntoa() is not a DTrace pointer, the BPF verifier cannot confirm it is safe. So first copy the input data to the BPF stack using the probe_read() helper function. Signed-off-by: Eugene Loh <eugene.loh@oracle.com> Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
- Loading branch information
Showing
7 changed files
with
101 additions
and
12 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
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2022, 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 | ||
|
||
BEGIN | ||
{ | ||
system("printf '\xc0\xa8\x01\x17' > /dev/null 2>&1"); | ||
} | ||
|
||
syscall::write:entry | ||
/ppid == $pid/ | ||
{ | ||
p = alloca(4); | ||
copyinto(arg1, 4, p); | ||
printf("%s\n", inet_ntoa(p)); | ||
exit(0); | ||
} | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
192.168.1.23 | ||
|
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2022, 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 | ||
|
||
BEGIN | ||
{ | ||
system("printf '\xc0\xa8\x01\x17' > /dev/null 2>&1"); | ||
} | ||
|
||
syscall::write:entry | ||
/ppid == $pid/ | ||
{ | ||
printf("%s\n", inet_ntoa(copyin(arg1,4))); | ||
exit(0); | ||
} | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
192.168.1.23 | ||
|
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2022, 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 | ||
|
||
BEGIN | ||
{ | ||
system("printf '\xc0\xa8\x01\x17' > /dev/null 2>&1"); | ||
} | ||
|
||
syscall::write:entry | ||
/ppid == $pid/ | ||
{ | ||
printf("%s\n", inet_ntoa((void *)arg1)); | ||
exit(0); | ||
} | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
192.168.1.23 | ||
|