tst.badcopyinstr.d revision 178477
198524Sfenner/* 298524Sfenner * CDDL HEADER START 398524Sfenner * 498524Sfenner * The contents of this file are subject to the terms of the 598524Sfenner * Common Development and Distribution License (the "License"). 698524Sfenner * You may not use this file except in compliance with the License. 798524Sfenner * 898524Sfenner * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 998524Sfenner * or http://www.opensolaris.org/os/licensing. 1098524Sfenner * See the License for the specific language governing permissions 1198524Sfenner * and limitations under the License. 1298524Sfenner * 1398524Sfenner * When distributing Covered Code, include this CDDL HEADER in each 1498524Sfenner * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1598524Sfenner * If applicable, add the following below this CDDL HEADER, with the 1698524Sfenner * fields enclosed by brackets "[]" replaced with your own identifying 1798524Sfenner * information: Portions Copyright [yyyy] [name of copyright owner] 1898524Sfenner * 19127668Sbms * CDDL HEADER END 20190207Srpaulo */ 2198524Sfenner 2298524Sfenner/* 2398524Sfenner * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 2498524Sfenner * Use is subject to license terms. 2598524Sfenner */ 2698524Sfenner 27127668Sbms#pragma ident "%Z%%M% %I% %E% SMI" 28127668Sbms 2998524Sfenner/* 3098524Sfenner * ASSERTION: 3198524Sfenner * On IA/32, there is a single 32-bit address space that is partitioned 3298524Sfenner * between user-level and kernel-level. copyin()/copyinstr() and 3398524Sfenner * copyout()/copyoutstr() must check that addresses specified as 3498524Sfenner * user-level addresses are actually at user-level. This test attempts 3598524Sfenner * to perform an illegal copyinstr() from a kernel address. It asserts 3698524Sfenner * that the fault type is DTRACEFLT_BADADDR and that the bad address is 3798524Sfenner * set to the kernel address from which the copyinstr() was attempted. 3898524Sfenner * 3998524Sfenner * SECTION: Actions and Subroutines/copyinstr(); 4098524Sfenner * User Process Tracing/copyin() and copyinstr() 4198524Sfenner */ 4298524Sfenner 4398524SfennerBEGIN 4498524Sfenner{ 4598524Sfenner os = copyinstr((uintptr_t)&`utsname); 4698524Sfenner exit(1); 4798524Sfenner} 4898524Sfenner 4998524SfennerERROR 5098524Sfenner{ 5198524Sfenner exit(arg4 == DTRACEFLT_BADADDR && arg5 == (uint64_t)&`utsname ? 0 : 1); 5298524Sfenner} 5398524Sfenner