-
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.
Add support for copyinto() subroutine
The copyinto() subroutine is a near-identical copy of bcopy() other than that the arguments are ordered differently, and it reads from userspace addresses rather than kernel addresses. A new function is added to implement the shared functionality (dt_cg_subr_bcopy_impl). Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com> Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
- Loading branch information
Showing
18 changed files
with
370 additions
and
52 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
23 changes: 23 additions & 0 deletions
23
test/unittest/funcs/copyinto/err.D_PROTO_ARG.non_alloca_arg3-2.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,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. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: Argument 3 for copyinto() must be an alloca() pointer. | ||
* | ||
* SECTION: Actions and Subroutines/copyinto() | ||
*/ | ||
|
||
BEGIN | ||
{ | ||
copyinto(1, 2, &`max_pfn); | ||
exit(1); | ||
} | ||
|
||
ERROR | ||
{ | ||
exit(0); | ||
} |
23 changes: 23 additions & 0 deletions
23
test/unittest/funcs/copyinto/err.D_PROTO_ARG.non_alloca_arg3.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,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. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: Argument 3 for copyinto() must be an alloca() pointer. | ||
* | ||
* SECTION: Actions and Subroutines/copyinto() | ||
*/ | ||
|
||
BEGIN | ||
{ | ||
copyinto(1, 2, ""); | ||
exit(1); | ||
} | ||
|
||
ERROR | ||
{ | ||
exit(0); | ||
} |
23 changes: 23 additions & 0 deletions
23
test/unittest/funcs/copyinto/err.D_PROTO_ARG.non_ptr_arg3.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,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. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: Argument 3 for copyinto() must be a pointer. | ||
* | ||
* SECTION: Actions and Subroutines/copyinto() | ||
*/ | ||
|
||
BEGIN | ||
{ | ||
copyinto(1, 2, 3); | ||
exit(1); | ||
} | ||
|
||
ERROR | ||
{ | ||
exit(0); | ||
} |
23 changes: 23 additions & 0 deletions
23
test/unittest/funcs/copyinto/err.D_PROTO_ARG.non_scalar_arg1.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,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. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: Argument 1 for copyinto() must be a scalar. | ||
* | ||
* SECTION: Actions and Subroutines/copyinto() | ||
*/ | ||
|
||
BEGIN | ||
{ | ||
copyinto("1", 2, 3); | ||
exit(1); | ||
} | ||
|
||
ERROR | ||
{ | ||
exit(0); | ||
} |
23 changes: 23 additions & 0 deletions
23
test/unittest/funcs/copyinto/err.D_PROTO_ARG.non_scalar_arg2.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,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. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: Argument 2 for copyinto() must be a scalar. | ||
* | ||
* SECTION: Actions and Subroutines/copyinto() | ||
*/ | ||
|
||
BEGIN | ||
{ | ||
copyinto(1, "2", 3); | ||
exit(1); | ||
} | ||
|
||
ERROR | ||
{ | ||
exit(0); | ||
} |
23 changes: 23 additions & 0 deletions
23
test/unittest/funcs/copyinto/err.D_PROTO_LEN.missing_arg.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,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. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: Arguments are required for copyinto(). | ||
* | ||
* SECTION: Actions and Subroutines/copyinto() | ||
*/ | ||
|
||
BEGIN | ||
{ | ||
copyinto(); | ||
exit(1); | ||
} | ||
|
||
ERROR | ||
{ | ||
exit(0); | ||
} |
23 changes: 23 additions & 0 deletions
23
test/unittest/funcs/copyinto/err.D_PROTO_LEN.too_few_args.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,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. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: Three arguments are required for copyinto(). | ||
* | ||
* SECTION: Actions and Subroutines/copyinto() | ||
*/ | ||
|
||
BEGIN | ||
{ | ||
copyinto(1, 2); | ||
exit(1); | ||
} | ||
|
||
ERROR | ||
{ | ||
exit(0); | ||
} |
23 changes: 23 additions & 0 deletions
23
test/unittest/funcs/copyinto/err.D_PROTO_LEN.too_many_args.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,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. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: Exactly three Arguments are required for copyinto(). | ||
* | ||
* SECTION: Actions and Subroutines/copyinto() | ||
*/ | ||
|
||
BEGIN | ||
{ | ||
copyin(1, 2, 3, 4); | ||
exit(1); | ||
} | ||
|
||
ERROR | ||
{ | ||
exit(0); | ||
} |
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,24 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: Using copyinto() with an invalid source address reports a fault. | ||
* | ||
* SECTION: Actions and Subroutines/copyinto() | ||
*/ | ||
|
||
BEGIN | ||
{ | ||
ptr = (char *)alloca(256); | ||
copyinto(0x1234, 8, ptr); | ||
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,6 @@ | ||
FUNCTION:NAME | ||
:ERROR | ||
|
||
-- @@stderr -- | ||
dtrace: script 'test/unittest/funcs/copyinto/err.badaddr.d' matched 2 probes | ||
dtrace: error on enabled probe ID 3 (ID 1: dtrace:::BEGIN): invalid address ({ptr}) in action #1 at BPF pc NNN |
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,24 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: The copyinto() size must not exceed the allocated space. | ||
* | ||
* SECTION: Actions and Subroutines/copyinto() | ||
*/ | ||
|
||
BEGIN | ||
{ | ||
ptr = (char *)alloca(64); | ||
copyinto(curthread->mm->env_start, 65, ptr); | ||
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,6 @@ | ||
FUNCTION:NAME | ||
:ERROR | ||
|
||
-- @@stderr -- | ||
dtrace: script 'test/unittest/funcs/copyinto/err.badsize.d' matched 2 probes | ||
dtrace: error on enabled probe ID 3 (ID 1: dtrace:::BEGIN): invalid size ({ptr}) in action #1 at BPF pc NNN |
Oops, something went wrong.