tst.badcopyout.d revision 256281
16316Seschrock/*
26316Seschrock * CDDL HEADER START
36316Seschrock *
46316Seschrock * The contents of this file are subject to the terms of the
56316Seschrock * Common Development and Distribution License (the "License").
66316Seschrock * You may not use this file except in compliance with the License.
76316Seschrock *
86316Seschrock * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
96316Seschrock * or http://www.opensolaris.org/os/licensing.
106316Seschrock * See the License for the specific language governing permissions
116316Seschrock * and limitations under the License.
126316Seschrock *
136316Seschrock * When distributing Covered Code, include this CDDL HEADER in each
146316Seschrock * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
156316Seschrock * If applicable, add the following below this CDDL HEADER, with the
166316Seschrock * fields enclosed by brackets "[]" replaced with your own identifying
176316Seschrock * information: Portions Copyright [yyyy] [name of copyright owner]
186316Seschrock *
196316Seschrock * CDDL HEADER END
206316Seschrock */
216316Seschrock
226316Seschrock/*
236316Seschrock * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
246316Seschrock * Use is subject to license terms.
256316Seschrock */
266316Seschrock
276316Seschrock#pragma ident	"%Z%%M%	%I%	%E% SMI"
286316Seschrock
29/*
30 * ASSERTION:
31 *	On IA/32, there is a single 32-bit address space that is partitioned
32 *	between user-level and kernel-level.  copyin()/copyinstr() and
33 *	copyout()/copyoutstr() must check that addresses specified as
34 *	user-level addresses are actually at user-level.  This test attempts
35 *	to perform an illegal copyout() to a kernel address.  It asserts that
36 *	the fault type is DTRACEFLT_BADADDR and that the bad address is set to
37 *	the kernel address to which the copyout() was attempted.
38 *
39 * SECTION: Actions and Subroutines/copyout()
40 *
41 */
42
43#pragma D option destructive
44
45BEGIN
46{
47	this->a = (uint32_t *)alloca(4);
48	*this->a = -1;
49	copyout(this->a, (uintptr_t)&`clock, 4);
50	exit(1);
51}
52
53ERROR
54{
55	exit(arg4 == DTRACEFLT_BADADDR && arg5 == (uint64_t)&`clock ? 0 : 1);
56}
57