tst.badcopyinstr.d revision 178476
1272343Sngie/* 2272343Sngie * CDDL HEADER START 3272343Sngie * 4272343Sngie * The contents of this file are subject to the terms of the 5272343Sngie * Common Development and Distribution License (the "License"). 6272343Sngie * You may not use this file except in compliance with the License. 7272343Sngie * 8272343Sngie * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9272343Sngie * or http://www.opensolaris.org/os/licensing. 10272343Sngie * See the License for the specific language governing permissions 11272343Sngie * and limitations under the License. 12272343Sngie * 13272343Sngie * When distributing Covered Code, include this CDDL HEADER in each 14272343Sngie * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15272343Sngie * If applicable, add the following below this CDDL HEADER, with the 16272343Sngie * fields enclosed by brackets "[]" replaced with your own identifying 17272343Sngie * information: Portions Copyright [yyyy] [name of copyright owner] 18272343Sngie * 19272343Sngie * CDDL HEADER END 20272343Sngie */ 21272343Sngie 22272343Sngie/* 23272343Sngie * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24272343Sngie * Use is subject to license terms. 25272343Sngie */ 26272343Sngie 27272343Sngie#pragma ident "%Z%%M% %I% %E% SMI" 28272343Sngie 29272343Sngie/* 30272343Sngie * ASSERTION: 31272343Sngie * On IA/32, there is a single 32-bit address space that is partitioned 32272343Sngie * between user-level and kernel-level. copyin()/copyinstr() and 33272343Sngie * copyout()/copyoutstr() must check that addresses specified as 34272343Sngie * user-level addresses are actually at user-level. This test attempts 35272343Sngie * to perform an illegal copyinstr() from a kernel address. It asserts 36272343Sngie * that the fault type is DTRACEFLT_BADADDR and that the bad address is 37272343Sngie * set to the kernel address from which the copyinstr() was attempted. 38272343Sngie * 39272343Sngie * SECTION: Actions and Subroutines/copyinstr(); 40272343Sngie * User Process Tracing/copyin() and copyinstr() 41272343Sngie */ 42272343Sngie 43272343SngieBEGIN 44272343Sngie{ 45272343Sngie os = copyinstr((uintptr_t)&`utsname); 46272343Sngie exit(1); 47272343Sngie} 48272343Sngie 49272343SngieERROR 50272343Sngie{ 51272343Sngie exit(arg4 == DTRACEFLT_BADADDR && arg5 == (uint64_t)&`utsname ? 0 : 1); 52272343Sngie} 53272343Sngie