|
|||
Prex Home / Browse Source - Prex Version: 0.9.0 |
|||
root/usr/test/attack/attack.c/* [<][>][^][v][top][bottom][index][help] */DEFINITIONSThis source file includes following definitions.1 /*- 2 * Copyright (c) 2008, Kohsuke Ohtani 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the author nor the names of any co-contributors 14 * may be used to endorse or promote products derived from this software 15 * without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30 /* 31 * attack.c - invalid parameter attack. 32 */ 33 34 #include <sys/prex.h> 35 36 #include <stdlib.h> 37 #include <stdio.h> 38 39 #define NATTACKS 1000 40 41 void 42 attack(void) 43 { 44 object_t *objp = (object_t *)random(); 45 object_t obj = (object_t)random(); 46 char *name = (char *)random(); 47 void *msg = (void *)random(); 48 size_t size = (size_t)random(); 49 task_t self = task_self(); 50 void *addr = (void *)random(); 51 int attr = random() & 7; 52 thread_t t = (thread_t)random(); 53 thread_t *tp = (thread_t *)random(); 54 55 object_create(NULL, NULL); 56 object_create(NULL, objp); 57 object_create(name, NULL); 58 object_create(name, objp); 59 60 object_destroy(0); 61 object_destroy(obj); 62 63 object_lookup(NULL, objp); 64 object_lookup(name, NULL); 65 object_lookup(name, objp); 66 67 msg_send(0, msg, size); 68 msg_send(obj, NULL, size); 69 msg_send(obj, msg, 0); 70 msg_send(0, msg, 0); 71 msg_send(0, NULL, size); 72 msg_send(obj, msg, size); 73 74 msg_receive(0, msg, size); 75 msg_receive(obj, NULL, size); 76 msg_receive(obj, msg, 0); 77 msg_receive(0, msg, 0); 78 msg_receive(0, NULL, size); 79 msg_receive(obj, msg, size); 80 81 msg_reply(0, msg, size); 82 msg_reply(obj, NULL, size); 83 msg_reply(obj, msg, 0); 84 msg_reply(0, msg, 0); 85 msg_reply(0, NULL, size); 86 msg_reply(obj, msg, size); 87 88 vm_allocate(self, addr, size, 1); 89 vm_allocate(self, &addr, size, 1); 90 91 vm_free(self, addr); 92 vm_attribute(self, addr, attr); 93 vm_map(self, addr, size, &addr); 94 95 thread_create(self, tp); 96 thread_suspend(t); 97 thread_terminate(t); 98 } 99 100 int 101 main(int argc, char *argv[]) 102 { 103 int i; 104 105 printf("starting invalid parameter attack.\n"); 106 107 for (i = 0; i < NATTACKS; i++) 108 attack(); 109 110 printf("test complete\n"); 111 return 0; 112 } /* [<][>][^][v][top][bottom][index][help] */ | |||
Copyright© 2005-2009 Kohsuke Ohtani |