-
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.
cg, test: fix copyinstr() implementation to use a tstring
Since copyinstr() returns a string, it should be using a temporary string like other string functions. Also, semantics needed fixing to apply strsize as an upper limit to the optional size rather than triggering a fault if the size is greater than strsize. Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com> Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
- Loading branch information
Showing
5 changed files
with
47 additions
and
38 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
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
test/unittest/funcs/copyinstr/tst.copyinstr-high-maxsize.d
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,30 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2006, 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. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: It is possible to read a string from userspace addresses. | ||
* | ||
* SECTION: Actions and Subroutines/copyinstr() | ||
* User Process Tracing/copyin() and copyinstr() Subroutines | ||
*/ | ||
/* @@trigger: delaydie */ | ||
|
||
#pragma D option quiet | ||
#pragma D option strsize=12 | ||
|
||
syscall::write:entry | ||
/pid == $target/ | ||
{ | ||
printf("%s char match\n", (s = copyinstr(arg1, 96))[4] == 'y' ? "good" : "BAD"); | ||
printf("'%s'", s); | ||
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,4 @@ | ||
good char match | ||
'Delay in ns' | ||
-- @@stderr -- | ||
Delay in ns needed in delay env var. |