Move Source From Main Repo

Source is based keymgr-30
This commit is contained in:
Thomas A 2023-01-31 21:56:42 -08:00
commit bc92c5d0da
23 changed files with 25898 additions and 0 deletions

32
CMakeLists.txt Normal file
View File

@ -0,0 +1,32 @@
project(keymgr)
cmake_minimum_required(VERSION 3.10)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdinc")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -nostdlib")
add_definitions(-DHAVE_STDINT_H=1)
set(keymgr_sources
keymgr.c
)
set(DYLIB_INSTALL_NAME "/usr/lib/system/libkeymgr.dylib")
add_circular(keymgr FAT
SOURCES
${keymgr_sources}
SIBLINGS
system_c
system_dyld
system_malloc
system_pthread
platform
system_kernel
)
#target_link_libraries(keymgr PRIVATE system_c system_dyld system_malloc system_pthread)
#make_fat(keymgr)
add_darling_static_library(keymgr_static SOURCES ${keymgr_sources})
make_fat(keymgr_static)
install(TARGETS keymgr DESTINATION libexec/darling/usr/lib/system)

340
COPYING Normal file
View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

850
keymgr.c Normal file
View File

@ -0,0 +1,850 @@
/* Copyright (C) 1999-2005, 2012 Apple Inc.
Copyright (C) 1997, 2001 Free Software Foundation, Inc.
This file is part of KeyMgr.
KeyMgr is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License,
Apple Computer and the Free Software Foundation gives you unlimited
permission to link the compiled version of this file into combinations
with other programs, and to distribute those combinations without any
restriction coming from the use of this file. (The General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked into
a combine executable.)
KeyMgr is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with KeyMgr; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* The FSF-copyright part is the definition of 'struct
old_object'. It was taken from unwind-dw2-fde.h from GCC 3.1. */
/*
* keymgr - Create and maintain process-wide global data known to
* all threads across all dynamic libraries.
*
*/
#include <mach-o/dyld.h>
#include <dlfcn.h>
#include <pthread.h>
#include <errno.h>
#include <stdlib.h>
#include <libkern/OSAtomic.h>
#include <stdint.h>
#if __has_include(<os/alloc_once_private.h>)
#include <os/alloc_once_private.h>
#if defined(OS_ALLOC_ONCE_KEY_LIBKEYMGR)
#define _HAS_ALLOC_ONCE 1
#endif
#endif
#include "keymgr.h"
/* On x86 or later platforms, there's no need to support the TLS SPIs.
The only reason to support them on ppc64 is because the tools
shipped with Tiger included a libsupc++.a which used these
functions. (To do: investigate whether anyone ever actually used
that library for ppc64.) */
#if defined(__ppc__) || defined(__ppc64__)
#define WANT_TLS_SPIS 1
#endif
/* On Mac OS X 10.6, unwinding is down by libunwind in libSystem.B.dylib
Normally, the object list is not used, but some applications that dynamically
generate code directly use keymgr to find the KEYMGR_GCC3_DW2_OBJ_LIST
list and insert frame information. The problem is those apps don't check
if KEYMGR_GCC3_DW2_OBJ_LIST is currently NULL. The fix is to statically
allocate the object list head struct and set KEYMGR_GCC3_DW2_OBJ_LIST to
point to it <rdar://problem/6599778>. */
#if defined(__i386__)
#define PR_6599778 1
#endif
#ifndef ESUCCESS
#define ESUCCESS 0
#endif
/* Types of node, used for error checking. */
typedef enum node_kinds {
NODE_PROCESSWIDE_PTR=1,
#ifdef WANT_TLS_SPIS
NODE_THREAD_SPECIFIC_DATA
#endif
} TnodeKind;
/* These values are internal; the subflags of NM_ENHANCED_LOCKING are
defined in keymgr.h and are not internal. */
enum {
NM_ENHANCED_LOCKING=3
};
/* Base node kind for keymgr node list; also used to represent per
thread variables (NODE_THREAD_SPECIFIC_DATA). */
typedef struct Skey_data {
struct Skey_data * next;
unsigned int handle; /* Key id of variable. */
unsigned char node_kind; /* What kind of variable is this? */
unsigned char flags; /* Flags controlling behavior of variable. */
unsigned short refcount; /* If recursion has been enabled, reference
count. */
void *ptr; /* Data associated with variable. */
pthread_mutex_t thread_lock; /* Semaphore for this specific variable. */
} Tkey_Data;
typedef struct Sinfo_Node {
unsigned int size; /* Size of this node. */
unsigned short major_version; /* API major version. */
unsigned short minor_version; /* API minor version. */
} Tinfo_Node;
/* Static variables for initial __keymgr_global values. */
static const Tinfo_Node keymgr_info = {
sizeof (Tinfo_Node),
KEYMGR_API_REV_MAJOR,
KEYMGR_API_REV_MINOR
};
/* __keymgr_global - contains pointers to keymgr data that needs to be
global and known across all dlls/plugins. */
static struct {
/* Formerly, a pthreads semaphore for accessing the keymgr global data.
Now unused. */
void *unused;
/* Formerly the keymgr_globals pointer. Moved to os_alloc_once allocation. */
void *unused2;
/* Pointer to keymgr information node. This is part of the semi-public
ABI of keymgr. */
const Tinfo_Node *keymgr_info;
} const __attribute__((aligned (32))) __keymgr_global = {
NULL,
NULL,
&keymgr_info
};
struct keymgr_globals_s {
/* Pointer to keymgr global list. This pointer was previously contained
in the second word of __keymgr_global static data. Moved here to avoid
diryting a __DATA page in each process.
Prior to that, contained in __eh_global_dataptr. */
Tkey_Data * volatile keymgr_globals;
#ifdef PR_6599778
/* Used to statically allocate the head of the object list.
The struct is 4 pointers long and must be initially zero filled. */
void *km_object_list_head[4];
#endif
};
typedef struct keymgr_globals_s *keymgr_globals_t;
__attribute__((__pure__))
static inline keymgr_globals_t
_keymgr_globals(void) {
#if _HAS_ALLOC_ONCE
return (keymgr_globals_t)os_alloc_once(OS_ALLOC_ONCE_KEY_LIBKEYMGR,
sizeof(struct keymgr_globals_s), NULL);
#else
static struct keymgr_globals_s storage;
return &storage;
#endif
}
#if defined(__ppc__)
/* Initialize keymgr. */
void _init_keymgr (void)
{
/* This routine is now empty, but is part of keymgr's ABI on ppc and
so can't be completely removed. */
}
#endif
/* Find any Tkey_Data associated with KEY. If none exists, or KIND
does not match, return NULL. */
static Tkey_Data *
get_key_element (unsigned int key, TnodeKind kind)
{
Tkey_Data *keyArray;
for (keyArray = _keymgr_globals()->keymgr_globals;
keyArray != NULL;
keyArray = keyArray->next)
if (keyArray->handle == key)
{
if (keyArray->node_kind == kind)
return keyArray;
else
return NULL;
}
return NULL;
}
/* Find any Tkey_Data associated with KEY. If none exists, create one
and add it to the list. Put it in *RESULT.
On success, return 0, otherwise:
[EINVAL] The node existed but was not of type KIND.
[ENOMEM] Out of memory, couldn't create node.
[EAGAIN] The mutex associated with the new node couldn't be created.
This can only happen when KIND == NODE_PROCESSWIDE_PTR.
The aims of this routine are:
- After execution, there should be exactly one element in the list
with HANDLE set to KEY.
- The pointer to that element should be returned in *RESULT.
In addition, we know that:
- The list only has elements added, never removed, and they are
always added to the head of the list.
*/
static int
get_or_create_key_element (unsigned int key, TnodeKind kind,
Tkey_Data **result)
{
Tkey_Data *searchEnd = NULL;
Tkey_Data *newEntry = NULL;
for (;;)
{
Tkey_Data *keyArrayStart = _keymgr_globals()->keymgr_globals;
Tkey_Data *keyArray;
/* At this point, we know that we have not searched the elements
between keyArrayStart and searchEnd, but we have previously searched
searchEnd (if not NULL) and all the elements after it. */
for (keyArray = keyArrayStart;
keyArray != searchEnd;
keyArray = keyArray->next)
if (keyArray->handle == key)
{
/* Found an existing entry for KEY. Free any new entry we
created in a previous pass through the loop. */
if (newEntry)
{
if (kind == NODE_PROCESSWIDE_PTR)
/* This call should never fail. */
if (pthread_mutex_destroy (&newEntry->thread_lock)
!= ESUCCESS)
abort ();
free (newEntry);
}
if (keyArray->node_kind != kind)
return EINVAL;
*result = keyArray;
return ESUCCESS;
}
/* At this point, we know that there is no entry after keyArrayStart
which matches KEY. We will try to add one. */
if (! newEntry)
{
/* Create the new entry. */
newEntry = (Tkey_Data *) malloc (sizeof (Tkey_Data));
if (newEntry == NULL)
return ENOMEM;
if (kind == NODE_PROCESSWIDE_PTR)
{
pthread_mutexattr_t attr;
int errnum;
newEntry->refcount = 0;
newEntry->flags = 0;
errnum = pthread_mutexattr_init (&attr);
if (errnum == ESUCCESS)
{
pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_ERRORCHECK);
errnum = pthread_mutex_init (&newEntry->thread_lock, &attr);
pthread_mutexattr_destroy (&attr);
}
if (errnum != ESUCCESS)
{
free (newEntry);
return errnum;
}
}
newEntry->handle = key;
newEntry->ptr = NULL;
newEntry->node_kind = kind;
}
/* The compare-and-swap will succeed only if the list head is
keyArrayStart, and we are prepending newEntry onto the list,
so the next element after newEntry should be keyArrayStart. */
newEntry->next = keyArrayStart;
/* The barrier is necessary to ensure that newEntry->next is seen
to be set by any thread that sees newEntry in the list. */
/* If the compare-and-swap succeeds, it means that the head of
the list did not change between the search above and the
store of newEntry. Therefore, since we searched all the
elements from the head at that time, we can be sure that the
entry we're adding is not in the list. */
#ifdef __LP64__
if (OSAtomicCompareAndSwap64Barrier (
(int64_t) keyArrayStart,
(int64_t) newEntry,
(int64_t *) &_keymgr_globals()->keymgr_globals))
#else
if (OSAtomicCompareAndSwap32Barrier (
(int32_t) keyArrayStart,
(int32_t) newEntry,
(int32_t *) &_keymgr_globals()->keymgr_globals))
#endif
{
*result = newEntry;
return ESUCCESS;
}
/* Another thread changed the list. The entries between
keyArrayStart and searchEnd were searched above, so now we
can stop searching at keyArrayStart. We know we will make
progress in the next loop iteration because the new searchEnd
will not be equal to __keymgr_global.keymgr_globals and so we
will search at least one new element. Since the list can
have at most one element for each valid key, eventually there
will be no more elements to search and so we will stop reaching
this point and looping. */
searchEnd = keyArrayStart;
}
}
#ifdef WANT_TLS_SPIS
/* Return the data associated with KEY for the current thread.
Return NULL if there is no such data. */
void *
_keymgr_get_per_thread_data (unsigned int key)
{
Tkey_Data * keyArray;
void * key_data;
keyArray = get_key_element (key, NODE_THREAD_SPECIFIC_DATA);
/* If the element hasn't been set, the answer is always NULL. */
if (keyArray == NULL)
return NULL;
/* On all platforms we run on, a pointer-sized load from an aligned
address is atomic. */
key_data = keyArray->ptr;
/* key_data might be NULL if this entry is in the process of being
created. In that case, return NULL. */
if (key_data == NULL)
return NULL;
return pthread_getspecific ((pthread_key_t) key_data);
}
/* Set the data for KEY for this thread to be KEYDATA. Return 0 on success,
or:
[ENOMEM] Out of memory.
[EINVAL] The KEY was previously used to store process-wide data.
[EAGAIN] The system lacked the necessary resources to create
another thread-specific data key, or the system- imposed
limit on the total number of keys per process
[PTHREAD_KEYS_MAX] would be exceeded. This error can't
happen after the first successful call to
_keymgr_set_per_thread_data from a particular thread with
a particular KEY.
*/
int
_keymgr_set_per_thread_data (unsigned int key, void *keydata)
{
volatile Tkey_Data * keyArray;
pthread_key_t pthread_key;
void *ptr;
int errnum;
errnum = get_or_create_key_element (key, NODE_THREAD_SPECIFIC_DATA,
(Tkey_Data **)&keyArray);
if (errnum != ESUCCESS)
return errnum;
/* This routine doesn't lock *keyArray. Instead, it relies on the
fact that keyArray->ptr is either NULL or a valid pthread key value,
and it only changes once, from NULL to a valid value. */
ptr = keyArray->ptr;
if (ptr == NULL)
{
void (*destructor)(void *);
bool neededInit;
switch (key)
{
case KEYMGR_EH_CONTEXT_KEY:
case KEYMGR_EH_GLOBALS_KEY:
destructor = free;
break;
default:
destructor = NULL;
break;
}
if ((errnum = pthread_key_create (&pthread_key, destructor)) != 0)
return errnum;
#ifdef __LP64__
neededInit = OSAtomicCompareAndSwap64 ((int64_t) NULL,
(int64_t) pthread_key,
(int64_t *) &keyArray->ptr);
#else
neededInit = OSAtomicCompareAndSwap32 ((int32_t) NULL,
(int32_t) pthread_key,
(int32_t *) &keyArray->ptr);
#endif
if (!neededInit)
pthread_key_delete (pthread_key);
ptr = keyArray->ptr;
}
pthread_key = (pthread_key_t) ptr;
return pthread_setspecific (pthread_key, keydata);
}
#endif /* WANT_TLS_SPIS */
/*
* These routines provide management of a process wide, thread safe,
* persistent pointer. If a pointer is created by a bundle/plug-in
* and placed in here, it will persist for the life of the process,
* even after the bundle has been unloaded. This is especially useful
* for data shared across plugins and across repeated plugin loads and
* unloads.
*/
/* Get the processwide data associated with KEY into *RESULT,
and lock a lock associated with KEY.
On success, return 0, otherwise:
[EINVAL] KEY was previously used to store thread-specific data.
[ENOMEM] Out of memory, couldn't create node.
[EAGAIN] The mutex associated with the new node couldn't be created.
[EDEADLK] A deadlock would occur if the thread blocked waiting
for the lock.
*/
int
_keymgr_get_and_lock_processwide_ptr_2 (unsigned int key, void ** result)
{
Tkey_Data *keyArray;
int errnum;
errnum = get_or_create_key_element (key, NODE_PROCESSWIDE_PTR, &keyArray);
if (errnum != ESUCCESS)
return errnum;
if ((errnum = pthread_mutex_lock (&keyArray->thread_lock)) != ESUCCESS)
return errnum;
keyArray->refcount++;
*result = keyArray->ptr;
return ESUCCESS;
}
/* For backwards compatibility; like _keymgr_get_and_lock_processwide_ptr_2
but returns the pointer or NULL on error. */
void *
_keymgr_get_and_lock_processwide_ptr (unsigned int key)
{
void *result = NULL;
_keymgr_get_and_lock_processwide_ptr_2 (key, &result);
return result;
}
/* Unlock the lock associated with NODE. Return 0 on success.
Returns EPERM if the lock is not locked by the current thread. */
static int
unlock_node (Tkey_Data *node)
{
int result;
node->refcount--;
result = pthread_mutex_unlock (&node->thread_lock);
if (result != ESUCCESS)
node->refcount++;
return result;
}
/* Set the processwide data associated with KEY to PTR, and unlock
the lock associated with KEY.
On success, returns 0. On failure, returns:
[EINVAL] KEY was previously used to store thread-specific data.
[ENOMEM] Out of memory, couldn't create node.
[EAGAIN] The mutex associated with the new node couldn't be created.
[EPERM] The lock was not locked by the current thread.
*/
int
_keymgr_set_and_unlock_processwide_ptr (unsigned int key, void *ptr)
{
Tkey_Data *keyArray;
int result;
result = get_or_create_key_element (key, NODE_PROCESSWIDE_PTR, &keyArray);
if (result != ESUCCESS)
return result;
keyArray->ptr = ptr;
return unlock_node (keyArray);
}
/* Unlock the lock associated with KEY.
On success, returns 0. On failure, returns:
[EINVAL] KEY was not previously used to store process-specific data.
[EPERM] The lock was not locked by the current thread.
*/
int
_keymgr_unlock_processwide_ptr (unsigned int key)
{
Tkey_Data *keyArray;
keyArray = get_key_element (key, NODE_PROCESSWIDE_PTR);
if (keyArray == NULL)
return EINVAL;
return unlock_node (keyArray);
}
/* Set the locking mode of KEY to MODE. This should not be done while
KEY is locked or another thread might be using KEY.
On success, returns 0. On failure, returns:
[EINVAL] KEY was previously used to store thread-specific data.
[ENOMEM] Out of memory.
[EBUSY] The mutex associated with the node was locked.
*/
int
_keymgr_set_lockmode_processwide_ptr (unsigned int key, unsigned int mode)
{
Tkey_Data *keyArray;
pthread_mutexattr_t attr;
int type;
int result;
result = get_or_create_key_element (key, NODE_PROCESSWIDE_PTR, &keyArray);
if (result != ESUCCESS)
return result;
if (mode == keyArray->flags)
return ESUCCESS;
result = pthread_mutexattr_init (&attr);
if (result != ESUCCESS)
return result;
if (mode == NM_ALLOW_RECURSION)
type = PTHREAD_MUTEX_RECURSIVE;
else
type = PTHREAD_MUTEX_ERRORCHECK;
pthread_mutexattr_settype (&attr, type);
/* Delete the old mutex and create a new one. */
result = pthread_mutex_destroy (&keyArray->thread_lock);
/* Apple's implementation of pthread_mutex_init can't fail in this
situation. */
if (result == ESUCCESS)
result = pthread_mutex_init (&keyArray->thread_lock, &attr);
pthread_mutexattr_destroy (&attr);
if (result == ESUCCESS)
keyArray->flags = mode;
return result;
}
/* Returns the locking mode of the lock associated with KEY, if any,
or 0 if there is no such lock. */
unsigned int
_keymgr_get_lockmode_processwide_ptr (unsigned int key)
{
Tkey_Data *keyArray;
keyArray = get_key_element (key, NODE_PROCESSWIDE_PTR);
if (keyArray == NULL)
return 0;
return keyArray->flags;
}
/* Return the number of locks on KEY. To call this routine safely,
you should be holding one of them, thus 0 is an error return. */
int
_keymgr_get_lock_count_processwide_ptr (unsigned int key)
{
Tkey_Data *keyArray;
keyArray = get_key_element (key, NODE_PROCESSWIDE_PTR);
if (keyArray == NULL)
return 0;
return keyArray->refcount;
}
/*********************************************/
#include <mach-o/getsect.h>
/* Beware, this is an API. */
struct __live_images {
unsigned long this_size; /* sizeof (__live_images) */
const struct mach_header *mh; /* the image info */
intptr_t vm_slide;
void (*destructor)(struct __live_images *); /* destructor for this */
struct __live_images *next;
unsigned long examined_p;
void *fde;
void *object_info;
unsigned long info[2]; /* GCC3 use */
};
/* Bits in the examined_p field of struct live_images. */
enum {
EXAMINED_IMAGE_MASK = 1, /* We've seen this one. */
ALLOCED_IMAGE_MASK = 2, /* The FDE entries were allocated by
malloc, and must be freed. This isn't
used by newer libgcc versions. */
IMAGE_IS_TEXT_MASK = 4, /* This image is in the TEXT segment. */
DESTRUCTOR_MAY_BE_CALLED_LIVE = 8 /* The destructor may be called on an
object that's part of the live
image list. */
};
#ifdef __ppc__
struct old_object
{
void *pc_begin;
void *pc_end;
struct dwarf_fde *fde_begin;
struct dwarf_fde **fde_array;
size_t count;
struct old_object *next;
long section_size;
};
static const char __DWARF2_UNWIND_SECTION_TYPE[] = "__TEXT";
static const char __DWARF2_UNWIND_SECTION_NAME[] = "__dwarf2_unwind";
#endif
#if !__x86_64__
/* Called by dyld when an image is added to the executable.
If it has a dwarf2_unwind section, register it so the C++ runtime
can get at it. All of this is protected by dyld thread locks. */
static void dwarf2_unwind_dyld_add_image_hook (const struct mach_header *mh,
intptr_t vm_slide)
{
#ifdef __ppc__
uint32_t sz;
char *fde;
/* See if the image has a __TEXT __dwarf2_unwind section. This
is for backwards compatibility with old GCCs. */
fde = getsectdatafromheader (mh, __DWARF2_UNWIND_SECTION_TYPE,
__DWARF2_UNWIND_SECTION_NAME, &sz);
if (fde != 0)
{
struct old_object *obp;
obp = (struct old_object *) calloc (1, sizeof (struct old_object) + 8);
if (obp == NULL)
return;
obp->section_size = sz;
obp->fde_begin = (struct dwarf_fde *) (fde + vm_slide);
if (_keymgr_get_and_lock_processwide_ptr_2 (KEYMGR_ZOE_IMAGE_LIST,
(void **) &obp->next) == 0)
_keymgr_set_and_unlock_processwide_ptr (KEYMGR_ZOE_IMAGE_LIST, obp);
}
#endif
{
struct __live_images *l = (struct __live_images *) calloc (1, sizeof (*l));
if (l == NULL)
return;
l->mh = mh;
l->vm_slide = vm_slide;
l->this_size = sizeof (*l);
if (_keymgr_get_and_lock_processwide_ptr_2 (KEYMGR_GCC3_LIVE_IMAGE_LIST,
(void **) &l->next) == 0)
_keymgr_set_and_unlock_processwide_ptr (KEYMGR_GCC3_LIVE_IMAGE_LIST, l);
}
}
static void
dwarf2_unwind_dyld_remove_image_hook (const struct mach_header *mh,
intptr_t vm_slide)
{
#ifdef __ppc__
uint32_t sz;
char *fde;
/* See if the image has a __TEXT __dwarf2_unwind section. */
fde = getsectdatafromheader (mh, __DWARF2_UNWIND_SECTION_TYPE,
__DWARF2_UNWIND_SECTION_NAME, &sz);
if (fde != 0)
{
struct old_object *objlist, **obp;
if (_keymgr_get_and_lock_processwide_ptr_2 (KEYMGR_ZOE_IMAGE_LIST,
(void **) &objlist) != 0)
goto get_zoe_failed;
for (obp = &objlist; *obp; obp = &(*obp)->next)
if ((char *)(*obp)->fde_begin == fde + vm_slide)
{
struct old_object *p = *obp;
*obp = p->next;
if (p->pc_begin)
free (p->fde_array);
free (p);
break;
}
_keymgr_set_and_unlock_processwide_ptr (KEYMGR_ZOE_IMAGE_LIST, objlist);
get_zoe_failed:
;
}
#endif
{
struct __live_images *top, **lip, *destroy = NULL;
/* This is a bit of cache. _dyld_get_image_header_containing_address
can be expensive, but most of the time the destructors come from
one or two objects and are consecutive in the list. */
void (*prev_destructor)(struct __live_images *) = NULL;
int was_in_object = 0;
/* Look for it in the list of live images and delete it.
Also, call any destructors in case they are in this image and about
to be unloaded. The test with DESTRUCTOR_MAY_BE_CALLED_LIVE is
because in GCC 3.1, the destructor would (uselessly) try to acquire
the LIVE_IMAGE_LIST lock, and it's not practical to call it in
that case (deadlock ensues, unless we release the lock, in which
case the concurrency issues become impossible). */
if (_keymgr_get_and_lock_processwide_ptr_2 (KEYMGR_GCC3_LIVE_IMAGE_LIST,
(void **) &top) != 0)
goto get_live_image_failed;
lip = &top;
while (*lip != NULL)
{
if ((*lip)->destructor
&& ((*lip)->examined_p & DESTRUCTOR_MAY_BE_CALLED_LIVE))
{
if (! was_in_object && (*lip)->destructor != prev_destructor)
{
Dl_info info;
prev_destructor = (*lip)->destructor;
was_in_object = (dladdr (prev_destructor, &info) != 0
&& info.dli_fbase == mh);
}
if ((*lip)->destructor == prev_destructor && was_in_object)
(*lip)->destructor (*lip);
}
if ((*lip)->mh == mh && (*lip)->vm_slide == vm_slide)
{
destroy = *lip;
*lip = destroy->next; /* unlink DESTROY */
if (destroy->this_size != sizeof (*destroy)) /* sanity check */
abort ();
continue;
}
lip = &(*lip)->next;
}
_keymgr_set_and_unlock_processwide_ptr (KEYMGR_GCC3_LIVE_IMAGE_LIST, top);
/* Now that we have unlinked this from the image list, toss it.
The destructor gets called here only to handle the GCC 3.1 case. */
if (destroy != NULL)
{
if (destroy->destructor != NULL)
(*destroy->destructor) (destroy);
free (destroy);
}
get_live_image_failed:
;
}
}
#endif // !x86_64
void __keymgr_dwarf2_register_sections (void)
{
/* This function needs to remain for binary compatibiliity */
/* with old programs which were linked with a crt1.o that */
/* explicitly called __keymgr_dwarf2_register_sections() */
}
/* call by libSystem's initializer */
void __keymgr_initializer (void)
{
#ifdef PR_6599778
_keymgr_get_and_lock_processwide_ptr(KEYMGR_GCC3_DW2_OBJ_LIST);
_keymgr_set_and_unlock_processwide_ptr(KEYMGR_GCC3_DW2_OBJ_LIST, &_keymgr_globals()->km_object_list_head);
#endif
#if __x86_64__
/* On Mac OS X 10.6, libunwind in libSystem.dylib implements all unwinding functionality. */
/* libunwind does not use keymgr, so there is no need to maintain KEYMGR_GCC3_LIVE_IMAGE_LIST */
/* in sync with dyld's list of images. But there might be some i386 or ppc applications that */
/* carry around there own copy of the unwinder (from libgcc.a) and need KEYMGR_GCC3_LIVE_IMAGE_LIST. */
#else
/* register with dyld so that we are notified about all loaded mach-o images */
_dyld_register_func_for_add_image (dwarf2_unwind_dyld_add_image_hook);
_dyld_register_func_for_remove_image (dwarf2_unwind_dyld_remove_image_hook);
#endif /* __x86_64__ */
}

137
keymgr.h Normal file
View File

@ -0,0 +1,137 @@
/* Copyright (C) 1999, 2000, 2001, 2002, 2003 Apple Computer, Inc.
This file is part of KeyMgr.
KeyMgr is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License,
Apple Computer gives you unlimited permission to link the compiled
version of this file into combinations with other programs, and to
distribute those combinations without any restriction coming from the
use of this file. (The General Public License restrictions do apply
in other respects; for example, they cover modification of the file,
and distribution when not linked into a combine executable.)
KeyMgr is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with KeyMgr; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#ifndef __KEYMGR_H
#define __KEYMGR_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* keymgr - Create and maintain process-wide global data known to
* all threads across all dynamic libraries.
*
*/
enum {
NM_ALLOW_RECURSION = 1,
NM_RECURSION_ILLEGAL = 2
};
#if defined(__ppc__) || defined(__ppc64__)
extern void * _keymgr_get_per_thread_data (unsigned int key);
extern int _keymgr_set_per_thread_data (unsigned int key, void *keydata);
#endif
extern void *_keymgr_get_and_lock_processwide_ptr (unsigned int key);
extern int _keymgr_get_and_lock_processwide_ptr_2 (unsigned int key, void **);
extern int _keymgr_set_and_unlock_processwide_ptr (unsigned int key,
void *ptr);
extern int _keymgr_unlock_processwide_ptr (unsigned int key);
extern int _keymgr_set_lockmode_processwide_ptr (unsigned int key,
unsigned int mode);
extern unsigned int _keymgr_get_lockmode_processwide_ptr (unsigned int key);
extern int _keymgr_get_lock_count_processwide_ptr (unsigned int key);
extern void __keymgr_dwarf2_register_sections (void);
/*
* Keys currently in use:
*/
/* Head pointer of exception context node. */
#define KEYMGR_EH_CONTEXT_KEY 1
/* New handler. */
#define KEYMGR_NEW_HANDLER_KEY 2
/* Unexpected exception handler. */
#define KEYMGR_UNEXPECTED_HANDLER_KEY 3
/* Terminate handler. */
#define KEYMGR_TERMINATE_HANDLER_KEY 4
/* Runtime mode bits. */
#define KEYMGR_MODE_BITS 5
/* Head pointer of the list of open streams. */
#define KEYMGR_IO_LIST 6
/* libstdc++ for GCC 2.95 stdin. */
#define KEYMGR_IO_STDIN 7
/* libstdc++ for GCC 2.95 stdout. */
#define KEYMGR_IO_STDOUT 8
/* libstdc++ for GCC 2.95 stdout. */
#define KEYMGR_IO_STDERR 9
/* Number of plugins/main program currently using streams in GCC 2.95. */
#define KEYMGR_IO_REFCNT 10
/* Flags controlling the behavior of C++ I/O. */
#define KEYMGR_IO_MODE_BITS 11
/* Head pointer for list of per image dwarf2 unwind sections. */
#define KEYMGR_ZOE_IMAGE_LIST 12
/* C++ runtime EH global data. */
#define KEYMGR_EH_GLOBALS_KEY 13
/* atexit() and __cxa_atexit routine list. */
#define KEYMGR_ATEXIT_LIST 14
/* KeyMgr 3.x is the first one supporting GCC3 stuff natively. */
#define KEYMGR_API_MAJOR_GCC3 3
/* ... with these keys. */
#define KEYMGR_GCC3_LIVE_IMAGE_LIST 301 /* loaded images */
#define KEYMGR_GCC3_DW2_OBJ_LIST 302 /* Dwarf2 object list */
/*
* Other important data.
*/
/* Major revision number of the keymgr API. */
#define KEYMGR_API_REV_MAJOR 5
/* Minor revision number of the keymgr API. */
#define KEYMGR_API_REV_MINOR 0
/* called by libSystem_initializer */
extern void __keymgr_initializer(void);
/* for inspecting keymgr version */
extern const unsigned char keymgrVersionString[];
extern const double keymgrVersionNumber;
#ifdef __cplusplus
}
#endif
#endif /* __KEYMGR_H */

View File

@ -0,0 +1,169 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
F98F991811A4A86400D21E1F /* keymgr.c in Sources */ = {isa = PBXBuildFile; fileRef = 0597689803D6472D00C9149F /* keymgr.c */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
0597689803D6472D00C9149F /* keymgr.c */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = keymgr.c; sourceTree = "<group>"; tabWidth = 8; usesTabs = 1; };
059768A803D6494200C9149F /* keymgr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = keymgr.h; sourceTree = "<group>"; };
05CA34F70433CFDF00C9149F /* basic-eh-app.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = "basic-eh-app.cc"; path = "testcases/basic-eh-app.cc"; sourceTree = "<group>"; };
F98F991611A4A85000D21E1F /* libkeymgr.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libkeymgr.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
F98F991411A4A85000D21E1F /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
0597688C03D6465000C9149F = {
isa = PBXGroup;
children = (
0597689703D646C100C9149F /* Products */,
0597689803D6472D00C9149F /* keymgr.c */,
059768A803D6494200C9149F /* keymgr.h */,
05CA34F70433CFDF00C9149F /* basic-eh-app.cc */,
);
sourceTree = "<group>";
};
0597689703D646C100C9149F /* Products */ = {
isa = PBXGroup;
children = (
F98F991611A4A85000D21E1F /* libkeymgr.dylib */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
F98F991511A4A85000D21E1F /* libkeymgr.dylib */ = {
isa = PBXNativeTarget;
buildConfigurationList = F98F991911A4A8B900D21E1F /* Build configuration list for PBXNativeTarget "libkeymgr.dylib" */;
buildPhases = (
F98F991311A4A85000D21E1F /* Sources */,
F98F991411A4A85000D21E1F /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = libkeymgr.dylib;
productName = libkeymgr.dylib;
productReference = F98F991611A4A85000D21E1F /* libkeymgr.dylib */;
productType = "com.apple.product-type.library.dynamic";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
0597689003D6465000C9149F /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0450;
};
buildConfigurationList = 05B1F3D7089068690080B6E2 /* Build configuration list for PBXProject "keymgr" */;
compatibilityVersion = "Xcode 2.4";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 0597688C03D6465000C9149F;
productRefGroup = 0597689703D646C100C9149F /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
F98F991511A4A85000D21E1F /* libkeymgr.dylib */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
F98F991311A4A85000D21E1F /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F98F991811A4A86400D21E1F /* keymgr.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
05B1F3D8089068690080B6E2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
};
name = Release;
};
F98F991711A4A85100D21E1F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CURRENT_PROJECT_VERSION = "$(RC_ProjectSourceVersion)";
DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)";
EXECUTABLE_PREFIX = lib;
GCC_ENABLE_SYMBOL_SEPARATION = NO;
GCC_MODEL_TUNING = G5;
GENERATE_TEXT_BASED_STUBS = YES;
INSTALL_PATH = /usr/lib/system;
IS_ZIPPERED = YES;
LINK_WITH_STANDARD_LIBRARIES = NO;
OTHER_CFLAGS = "-nostdlib";
OTHER_LDFLAGS = (
"-L$(SDKROOT)/usr/lib/system",
"-lsystem_kernel",
"-lsystem_platform",
"-lsystem_pthread",
"-lsystem_malloc",
"-lsystem_c",
"-ldyld",
"-Wl,-umbrella,System",
);
OTHER_TAPI_FLAGS = "-extra-public-header keymgr.h";
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
PRODUCT_NAME = keymgr;
SUPPORTS_TEXT_BASED_API = YES;
TAPI_VERIFY_MODE = Pedantic;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
05B1F3D7089068690080B6E2 /* Build configuration list for PBXProject "keymgr" */ = {
isa = XCConfigurationList;
buildConfigurations = (
05B1F3D8089068690080B6E2 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F98F991911A4A8B900D21E1F /* Build configuration list for PBXNativeTarget "libkeymgr.dylib" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F98F991711A4A85100D21E1F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 0597689003D6465000C9149F /* Project object */;
}

8
testcases/3043647/exc.cc Normal file
View File

@ -0,0 +1,8 @@
#include <stdio.h>
extern "C" int do_test(int n)
{
printf ("Entering do_test\n");
printf ("Normal return from do_test.\n");
return 0;
}

46
testcases/3043647/main.cc Normal file
View File

@ -0,0 +1,46 @@
#include <iostream>
#include <stdexcept>
#include <string>
#include <iostream>
void g(int n)
{
if (n == 17) {
std::cerr << "Throwing an exception" << std::endl;
throw std::invalid_argument("17 is a bad number");
}
std::cerr << "Not throwing an exception" << std::endl;
}
int do_test_2(int n)
{
std::cerr << "Entering do_test_2\n";
try {
g(n);
}
catch(const std::invalid_argument& e) {
std::cerr << "Caught an exception: " << e.what() << std::endl;
return 1;
}
catch(...) {
std::cerr << "Caught an unexpected exception" << std::endl;
return 2;
}
std::cerr << "Normal exit from do_test_2\n";
return 0;
}
extern "C" int do_test(int n);
int main()
{
std::cerr << "About to call do_test" << std::endl;
int result = do_test(16);
std::cerr << "Return value is " << result << std::endl;
std::cerr << "About to call do_test_2" << std::endl;
int result2 = do_test_2(17);
std::cerr << "Return value is " << result2 << std::endl;
}

8574
testcases/3043647/main.uu Normal file

File diff suppressed because it is too large Load Diff

60
testcases/3074709/main.cc Normal file
View File

@ -0,0 +1,60 @@
#include <mach-o/dyld.h>
#include <stdio.h>
typedef void (*thrower)();
typedef void (*call_thrower)(thrower);
typedef void (*call_call_thrower)(call_thrower);
int main()
{
NSObjectFileImage image, image2;
NSObjectFileImageReturnCode retCode;
NSModule module, module2;
NSSymbol sym;
call_call_thrower func;
call_thrower do_call_thrower;
retCode = NSCreateObjectFileImageFromFile ("plugin2", &image2);
if (retCode != NSObjectFileImageSuccess)
{
fprintf (stderr, "failed to load plugin2\n");
return 1;
}
module2 = NSLinkModule(image2, "plugin2",
(NSLINKMODULE_OPTION_BINDNOW
| NSLINKMODULE_OPTION_PRIVATE));
sym = NSLookupSymbolInModule (module2, "_do_call_thrower");
if (sym == NULL)
{
fprintf (stderr, "couldn't find `do_call_thrower' in plugin2\n");
return 1;
}
do_call_thrower = (call_thrower) NSAddressOfSymbol (sym);
retCode = NSCreateObjectFileImageFromFile ("plugin", &image);
if (retCode != NSObjectFileImageSuccess)
{
fprintf (stderr, "failed to load plugin\n");
return 1;
}
module = NSLinkModule(image, "plugin",
(NSLINKMODULE_OPTION_BINDNOW
| NSLINKMODULE_OPTION_PRIVATE));
sym = NSLookupSymbolInModule (module, "_func");
if (sym == NULL)
{
fprintf (stderr, "couldn't find `func' in plugin\n");
return 1;
}
func = (call_call_thrower) NSAddressOfSymbol (sym);
func (do_call_thrower);
NSDestroyObjectFileImage (image);
NSUnLinkModule (module, NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES);
NSDestroyObjectFileImage (image2);
NSUnLinkModule (module2, NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES);
return 0;
}

1311
testcases/3074709/main.uu Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,19 @@
#include <stdlib.h>
void throw_an_exception ()
{
throw 1;
}
typedef void (*thrower)();
typedef void (*call_thrower)(thrower);
extern "C" void func(call_thrower do_call_thrower)
{
try {
(*do_call_thrower) (throw_an_exception);
} catch (int x) {
return;
}
abort ();
}

5355
testcases/3074709/plugin.uu Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
typedef void (*thrower)();
extern "C" void
do_call_thrower (thrower do_throw)
{
do_throw();
}

4558
testcases/3074709/plugin2.uu Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
int main(void)
{
extern void _keymgr_set_per_thread_data(unsigned int key, void *keydata) ;
_keymgr_set_per_thread_data (500, 0);
return 0;
}

View File

@ -0,0 +1,379 @@
begin 644 3464244/3464244
M_NWZS@```!(``````````@````H```4`````A0````$````X7U]004=%6D52
M3P```````````````!`````````````````````````````````$`````0``
M`8Q?7U1%6%0````````````````0````(``````````@``````<````%````
M!0````!?7W1E>'0`````````````7U]415A4````````````````(_0```E<
M```3]`````(``````````(``!````````````%]?<&EC<WEM8F]L7W-T=6)?
M7U1%6%0````````````````M4````````!U0`````@``````````@```"```
M```````D7U]S>6UB;VQ?<W1U8@```%]?5$585````````````````"U0````
M````'5`````"``````````"````(`````````!1?7W!I8W-Y;6)O;'-T=6(Q
M7U]415A4````````````````+5````&````=4`````(``````````(``!`@`
M````````(%]?8W-T<FEN9P````````!?7U1%6%0````````````````NT```
M`3```![0`````@```````````````@```````````````0```8Q?7T1!5$$`
M```````````````P````$````"`````0``````<````#````!0````!?7V1A
M=&$`````````````7U]$051!````````````````,``````<```@``````(`
M`````````````````````````%]?;&%?<WEM8F]L7W!T<@!?7T1!5$$`````
M```````````P'````#```"`<`````@``````````````!P````P`````7U]N
M;%]S>6UB;VQ?<'1R`%]?1$%400```````````````#!,````$```($P````"
M```````````````&````&`````!?7V1Y;&0`````````````7U]$051!````
M````````````,%P````<```@7`````(``````````````````````````%]?
M8V]M;6]N``````````!?7T1!5$$````````````````P@````#@`````````
M!````````````````0```````````````0```#A?7TQ)3DM%1$E4````````
M``!`````(````#`````2#`````<````!``````````0````.````'`````PO
M=7-R+VQI8B]D>6QD````````#````#0````80614B@!2`0```0``+W5S<B]L
M:6(O;&EB4WES=&5M+D(N9'EL:6(```````(````8```P`````+@``#E0```(
MO`````L```!0`````````)(```"2````%@```*@````0````````````````
M```````````````````XX````!P`````````````````````````%@```!``
M`#B@````$`````4```"P`````0```"@``"/T````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````!\.@MX."'__%0A`#0X````D`$``)0A
M_\"`>@``.)H`!#MC``%7>Q`Z?*3:%#U@``!A:R0T?6D#IDZ`!"%_X``(?`@"
MIK^!__"0`0`(E"'_H$*?``5_Z`*F?'P;>'R=(WA\OBMX2``$]3Q?``"3@@NX
M/%\``).B"[P\7P``D\(+P#Q?``"`0@P,@8(``"^,``!!O@`,?8D#IDZ`!"$\
M7P``@$(,"(&"```OC```0;X`#'V)`Z9.@`0A2``(Y3Q?``"!@@O(@`P``"^`
M``!!O@`,?8D#IDZ`!"%(``'=2``"O3Q_```X8PJ,.($`0$@`!,6`80!`+X,`
M`$&^``A(``B!.````#Q?``"`0@P$D`(``($]``!](DMX+XD``$&>`&0Y0```
M.6```(@)``!\``=T+X```$&>`#!\`EBN?``'="^``"]`O@`(?4L2%#EK``%]
M(DMX?`E8KGP`!W0O@```0)[_V"^*``!!G@`,.`H``4@```B`'0``/%\``)`"
M"\1_QO-X@!X``"^```!!G@`0A`8`!"^```!`GO_X?X/C>'^DZWA_Q?-X.,8`
M!$@`!W5(``>M?`@"ID*?``5]B`*F/8P``'P(`Z8YC`>@?8D#IDZ`!"!\"`*F
M0I\`!7V(`J8]C```?`@#ICF,!T1]B0.F3H`$('P(`J9"GP`%?8@"ICV,``!\
M"`.F.8P'@'V)`Z9.@`0@?`@"ID*?``5]B`*F/8P``'P(`Z8YC`.4?8D#IDZ`
M!"!\"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)O;$EN
M26UA9V4`````7U]D>6QD7TY3061D<F5S<T]F4WEM8F]L`````&QI8F]B:F,`
M7U]O8FIC26YI=```5&AE(&ME<FYE;"!S=7!P;W)T(&9O<B!T:&4@9'EN86UI
M8R!L:6YK97(@:7,@;F]T('!R97-E;G0@=&\@<G5N('1H:7,@<')O9W)A;2X*
M`````````````````````"[0```L-```*I@``"FT```IC```*8P``"F,```I
MC```*8P``"F,```IC```*8P``"F,```IC```*8P``"F,````````````````
M```````````````````````````````````IC```````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M```````#?F0!`````"/T```#AH`````````````#J(`````````````#NF0!
M`````"0T```#NV0!`````"0T```#U&0!`````"0T```#\CP````````````$
M`0X&`````#`0`````$0!`+$``"0T`````$0!`+P``"18`````$0!`+\``"1<
M`````$0!`,```"1D`````$0!`,$``"1L`````$0!`,,``"1T`````$0!`,0`
M`"2(`````$0!`,4``"20`````$0!`,8``"2D`````$0!`,D``"2L`````$0!
M`,X``"2P`````$0!`,\``"3$`````$0!`-@``"3,`````$0!`-P``"30````
M`$0!`.H``"34`````$0!`.L``"3D`````$0!`.P``"3P`````$0!`.\``"3T
M`````$0!`/$``"4$`````$0!`/(``"44`````$0!`/,``"48`````$0!`/0`
M`"4L`````$0!`/4``"4\`````$0!`/,``"5``````$0!`/<``"58`````$0!
M`/@``"5@`````$0!`/H``"5H`````$0!`04``"5T`````$0!`0H``"60````
M`$0!`0L``"6H```$,20!`+$``"0T```$18`````````````$44```*X````<
M```$?$```*\````=```$I$```+`````>```$L(`````````````$NX``````
M```````$QT```+(````+```$T$```+,````*```$V4```+4````&```$XH``
M`+@```!````$^\`!`````"18```$_.`!`````"6H```$_20```````)T```$
M_@X!`````":H`````$0!`24``":H`````$0!`2@``";``````$0!`2H``";0
M`````$0!`2L``";<```%%"0!`24``":H```%,(```28```!````%.,`!````
M`";````%.>`!`````";P```%.B0```````!H```%.PX!`````"<0`````$0!
M`3D``"<0`````$0!`3T``"<0`````$0!`3X``"<D`````$0!`3T``"<X````
M`$0!`4(``"=````%220!`3D``"<0```%:T```3@````#```%=T```3H````"
M```%@$```3L````#```%C,`!`````"<0```%C>`!`````"=,```%CB0`````
M```\```%CPX!`````"=,`````$0!`4<``"=,`````$0!`4H``"=0`````$0!
M`4L``"=4`````$0!`4P``"=H`````$0!`4H``">$`````$0!`4X``">,```%
MHB0!`4<``"=,```%NT```48````+```%Q4```48````$```%ST```4@````)
M```%V,`!`````"=0```%V>`!`````">,```%VB0```````!````%VPX!````
M`">,`````$0!`5,``">,`````$0!`5T``">D`````$0!`5\``">T`````$0!
M`6$``"?$`````$0!`6,``"?4`````$0!`64``"?D`````$0!`6H``"?T````
M`$0!`6L``"@``````$0!`6P``"@,`````$0!`6T``"@8`````$0!`6X``"@D
M`````$0!`7$``"@P`````$0!`7(``"@\`````$0!`70``"A(`````$0!`74`
M`"A8`````$0!`78``"A<`````$0!`7D``"AP`````$0!`7P``"B(`````$0!
M`7T``"BH`````$0!`7\``"BT`````$0!`8```"B\`````$0!`8$``"C(````
M`$0!`7(``"C,`````$0!`88``"C8```%ZR0!`5,``">,```&`4```50````>
M```&,(`````````````&14```50````=```&4X```58```!````&?X```5<`
M``!$```&K8```5@```!(```&[8```5D```!,```''8```5H```!0```'4,`!
M`````">D```'44```7T````#```'9<`!`````"BH```'9N`!`````"C,```'
M9^`!`````"CL```':"0```````'````':2```"T````````'=R```"X`````
M```'A2```"\````````'E"```#`````````'IB```&X````````'SR```&\`
M```````'[28&`'4``#`0```((V0!`````"E,```()`X)`````#!<```(20X%
M`````"^P```(5PX)`````#!@````(!X!`````"FD````,QX!`````"E,````
M11X!`````"0T````5AX!`````"F,```(<`X!`````"FT```(DPX!`````"J8
M````!`\&`!```#``````#`\&`!```#`$````=0\!`````"PT````%`\&`!``
M`#`,````O@\*`````#"`````X@,``!```!``````_@\*`!```#"$```!%0\*
M`!```#"(```!,@\*`!```#",```!6`\*`!```#"0```!:P\*`!```#"4```!
MA0\*`!```#"8```!H`\*`!```#"<```!O0\*`!```#"@```!UP\*`!```#"D
M```!^`\*`!```#"H```"&@\*`!```#"L```"/@\*`!```#"P````30\&`!``
M`#`(```"?P\!`````"T4```"A0\*`!```#"T````;P\!`````"/T````FP$`
M`0$````````"E@$``0``````````RP$``0`````````"IP$``0$````````"
MR@$``0$````````"\`$``0$````````"_@$``0$````````#)`$``0$`````
M```#80$``0$````````#3`$``0$`````````]@$``0$````````#4P$``0$`
M```````"7P$``0`````````"9@$``0$````````#6P$``0$````````";`$`
M`0`````````!@P```80```(+```"'P```B$```(O```",0```C8```(X```#
M20```[H```/G```$:P``!($```3*```&I````+4```"R````J````*P```"K
M````K0```+8```"Q````KP```*X```"S````L````+4```"R````J````*P`
M``"K````K0```+8```"Q````KP```*X```"S````L````+0```"J````MP``
M`*D`````7TY807)G8P!?3EA!<F=V`%]?7W!R;V=N86UE`%]?9'EL9%]F=6YC
M7VQO;VMU<`!?7V1Y;&1?:6YI=%]C:&5C:P!?7W-T87)T`%]E;G9I<F]N`&1Y
M;&1?<W1U8E]B:6YD:6YG7VAE;'!E<@!S=&%R=`!?7U]D87)W:6Y?9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FXZ*#`L,3,I/2HH,"PQ-"D]9B@P+#@I
M`%]D>6QD7V=E=%]I;6%G95]H96%D97)?9FXZ*#`L,34I/2HH,"PQ-BD]9B@P
M+#$W*3TJ*#`L,3@I/6LH,"PQ*0!.4TQO;VMU<%-Y;6)O;$EN26UA9V5?9FXZ
M*#`L,3DI/2HH,"PR,"D]9B@P+#$W*0!.4T%D9')E<W-/9E-Y;6)O;%]F;CHH
M,"PR,2D]*B@P+#(R*3UF*#`L,C,I/2HH,"PQ*0``7V]B:F-);FET7V9N.G(H
M,"PV*0``````3EA!<F=C.D<H,"PR*0!.6$%R9W8Z1R@P+#,I`&5N=FER;VXZ
M1R@P+#,I`%]?<')O9VYA;64Z1R@P+#0I`&UA8VA?:6YI=%]R;W5T:6YE.D<H
M,"PR-"D]*B@P+#(U*3UF*#`L,BD`7V-T:')E861?:6YI=%]R;W5T:6YE.D<H
M,"PR-"D`<&]I;G1E<E]T;U]?9&%R=VEN7V=C8S-?<')E<F5G:7-T97)?9G)A
M;65?:6YF;SI3*#`L-BD``&1Y;&1?;&%Z>5]S>6UB;VQ?8FEN9&EN9U]E;G1R
M>5]P;VEN=`!E<G)O<E]M97-S86=E`&1Y;&1?9G5N8U]L;V]K=7!?<&]I;G1E
M<@!?9&%R=VEN7W5N=VEN9%]D>6QD7V%D9%]I;6%G95]H;V]K`%]D87)W:6Y?
A=6YW:6YD7V1Y;&1?<F5M;W9E7VEM86=E7VAO;VL`````
`
end

5
testcases/NOTES Normal file
View File

@ -0,0 +1,5 @@
See 'run-tests.sh' for how to run all the tests.
basic-eh-app-tiger-4.0 was built with gcc-4009 on 8A278.
basic-eh-app-10.4u-4.0 was built 3-way universal with gcc-5215 on 8C46,
using a slightly modified 10.4u SDK.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,387 @@
begin 644 basic-eh-app-tiger-4.0
M_NWZS@```!(``````````@````T```:H````A0````$````X7U]004=%6D52
M3P```````````````!`````````````````````````````````$`````0``
M`EA?7U1%6%0````````````````0````(``````````@``````<````%````
M"`````!?7W1E>'0`````````````7U]415A4````````````````(V0```BH
M```39`````(``````````(``!````````````%]?<&EC<WEM8F]L7W-T=6)?
M7U1%6%0````````````````L#````````!P,`````@``````````@```"```
M```````D7U]S>6UB;VQ?<W1U8@```%]?5$585````````````````"P,````
M````'`P````"``````````"````(`````````!1?7W!I8W-Y;6)O;'-T=6(Q
M7U]415A4````````````````+"````(````<(`````4``````````(``!`@`
M````````(%]?8W-T<FEN9P````````!?7U1%6%0````````````````N(```
M`3```!X@`````@```````````````@``````````7U]E:%]F<F%M90``````
M`%]?5$585````````````````"]0````=```'U`````"``````````!H```+
M``````````!?7V-O;G-T<G5C=&]R````7U]415A4````````````````+\0`
M```````?Q````````````````````````````````%]?9&5S=')U8W1O<@``
M``!?7U1%6%0````````````````OQ````````!_$`````0``````````````
M`````````````````0```=!?7T1!5$$````````````````P````$````"``
M```0``````<````#````!@````!?7V1A=&$`````````````7U]$051!````
M````````````,``````<```@``````(``````````````````````````%]?
M;&%?<WEM8F]L7W!T<@!?7T1!5$$````````````````P'````$```"`<````
M`@``````````````!P```!``````7U]N;%]S>6UB;VQ?<'1R`%]?1$%400``
M`````````````#!<````&```(%P````"```````````````&````(`````!?
M7V1Y;&0`````````````7U]$051!````````````````,'0````<```@=```
M``(``````````````````````````%]?9V-C7V5X8V5P=%]T86)?7T1!5$$`
M```````````````PD````"@``""0`````@`````````````"````````````
M7U]C;VUM;VX``````````%]?1$%400```````````````##`````.```````
M```$```````````````!```````````````!````.%]?3$E.2T5$250`````
M`````$`````@````,````!-L````!P````$`````````!`````X````<````
M#"]U<W(O;&EB+V1Y;&0````````,````-````!A!:/M>``<"```'```O=7-R
M+VQI8B]L:6)S=&1C*RLN-BYD>6QI8@``````#````#0````806S2M0`!````
M`0``+W5S<B]L:6(O;&EB9V-C7W,N,2YD>6QI8@````````P````T````&$%D
M5(H`4@$```$``"]U<W(O;&EB+VQI8E-Y<W1E;2Y"+F1Y;&EB```````,````
M,````!A!9'GJ`$(````!```O=7-R+VQI8B]L:6)M>"Y!+F1Y;&EB```````"
M````&```,`````#"```Z$```"5P````+````4`````````"3````DP```!D`
M``"L````%@``````````````````````````````````.7@````F```Y<```
M``$``````````````!8````0```Y&````!8````%````L`````$````H```C
M9```````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````!\.@MX."'__%0A`#0X````D`$``)0A_\"`>@``.)H`
M!#MC``%7>Q`Z?*3:%#U@``!A:R.D?6D#IDZ`!"%_X``(?`@"IK^!__"0`0`(
ME"'_H$*?``5_Z`*F?'P;>'R=(WA\OBMX2``$]3Q?``"3@@Q(/%\``).B#$P\
M7P``D\(,4#Q?``"`0@RL@8(``"^,``!!O@`,?8D#IDZ`!"$\7P``@$(,J(&"
M```OC```0;X`#'V)`Z9.@`0A2``(13Q?``"!@@Q8@`P``"^```!!O@`,?8D#
MIDZ`!"%(``'=2``"O3Q_```X8PIL.($`0$@`!,6`80!`+X,``$&^``A(``?A
M.````#Q?``"`0@RDD`(``($]``!](DMX+XD``$&>`&0Y0```.6```(@)``!\
M``=T+X```$&>`#!\`EBN?``'="^``"]`O@`(?4L2%#EK``%](DMX?`E8KGP`
M!W0O@```0)[_V"^*``!!G@`,.`H``4@```B`'0``/%\``)`"#%1_QO-X@!X`
M`"^```!!G@`0A`8`!"^```!`GO_X?X/C>'^DZWA_Q?-X.,8`!$@`!H5(``<-
M?`@"ID*?``5]B`*F/8P``'P(`Z8YC`<`?8D#IDZ`!"!\"`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!?7V1Y;&1?9V5T7VEM86=E7VAE861E<@!?7V1Y;&1?3E-,;V]K=7!3>6UB
M;VQ);DEM86=E`````%]?9'EL9%].4T%D9')E<W-/9E-Y;6)O;`````!L:6)O
M8FIC`%]?;V)J8TEN:70``%1H92!K97)N96P@<W5P<&]R="!F;W(@=&AE(&1Y
M;F%M:6,@;&EN:V5R(&ES(&YO="!P<F5S96YT('1O(')U;B!T:&ES('!R;V=R
M86TN"@``````&``````!>E!,4@`!?$$'D````0D0$`P!`````"@````@___[
MU````$P$``````0````0#E"?`9X"$4%^!`````0-'@``````*````$S___OT
M````>`0```#G!````!`.8)\!G@*=`Q%!?@0````$#1X`````````````````
M````````````````````````````````````````````````````````````
M`````````````````````"X@```JS```*20``"FL```H_```*/P``"C\```H
M_```*/P``"C\```H_```*/P``"C\```H_```*/P``"C\```H_```*/P``"C\
M```H_```````````````````````````````````````````````````````
M```````H_`````#_`"4#&@```!0````$````'`$````P````,````````0``
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M```````$%V0!`````"-D```$'X`````````````$08`````````````$4V0!
M`````".D```$5&0!`````".D```$;60!`````".D```$BSP````````````$
MF@X)`````#`0`````$0!`+$``".D`````$0!`+P``"/(`````$0!`+\``"/,
M`````$0!`,```"/4`````$0!`,$``"/<`````$0!`,,``"/D`````$0!`,0`
M`"/X`````$0!`,4``"0``````$0!`,8``"04`````$0!`,D``"0<`````$0!
M`,X``"0@`````$0!`,\``"0T`````$0!`-@``"0\`````$0!`-P``"1`````
M`$0!`.H``"1$`````$0!`.L``"14`````$0!`.P``"1@`````$0!`.\``"1D
M`````$0!`/$``"1T`````$0!`/(``"2$`````$0!`/,``"2(`````$0!`/0`
M`"2<`````$0!`/4``"2L`````$0!`/,``"2P`````$0!`/<``"3(`````$0!
M`/@``"30`````$0!`/H``"38`````$0!`04``"3D`````$0!`0H``"4`````
M`$0!`0L``"48```$RB0!`+$``".D```$WH`````````````$ZD```*X````<
M```%%4```*\````=```%/4```+`````>```%28`````````````%5(``````
M```````%8$```+(````+```%:4```+,````*```%<D```+4````&```%>X``
M`+@```!````%E,`!`````"/(```%E>`!`````"48```%EB0```````)T```%
MEPX!`````"88`````$0!`24``"88`````$0!`2@``"8P`````$0!`2H``"9`
M`````$0!`2L``"9,```%K20!`24``"88```%R8```28```!````%T<`!````
M`"8P```%TN`!`````"9@```%TR0```````!H```%U`X!`````":``````$0!
M`3D``":``````$0!`3T``":``````$0!`3X``":4`````$0!`3T``":H````
M`$0!`4(``":P```%XB0!`3D``":````&!$```3@````#```&$$```3H````"
M```&&4```3L````#```&)<`!`````":````&)N`!`````":\```&)R0`````
M```\```&*`X!`````":\`````$0!`4<``":\`````$0!`4H``";``````$0!
M`4L``";$`````$0!`4P``";8`````$0!`4H``";T`````$0!`4X``";\```&
M.R0!`4<``":\```&5$```48````+```&7D```48````$```&:$```4@````)
M```&<<`!`````";````&<N`!`````";\```&<R0```````!````&=`X!````
M`";\`````$0!`5,``";\`````$0!`5T``"<4`````$0!`5\``"<D`````$0!
M`6$``"<T`````$0!`6,``"=$`````$0!`64``"=4`````$0!`6H``"=D````
M`$0!`6L``"=P`````$0!`6P``"=\`````$0!`6T``">(`````$0!`6X``">4
M`````$0!`7$``">@`````$0!`7(``">L`````$0!`70``">X`````$0!`74`
M`"?(`````$0!`78``"?,`````$0!`7D``"?@`````$0!`7P``"?X`````$0!
M`7T``"@8`````$0!`7\``"@D`````$0!`8```"@L`````$0!`8$``"@X````
M`$0!`7(``"@\`````$0!`88``"A(```&A"0!`5,``";\```&FD```50````>
M```&R8`````````````&WD```50````=```&[(```58```!````'&(```5<`
M``!$```'1H```5@```!(```'AH```5D```!,```'MH```5H```!0```'Z<`!
M`````"<4```'ZD```7T````#```'_L`!`````"@8```'_^`!`````"@\```(
M`.`!`````"A<```(`20```````'````(`B```"T````````($"```"X`````
M```('B```"\````````(+2```#`````````(/R```&X````````(:"```&\`
M```````(AB8)`'4``#`0```(O&0!`````"B\```(O0X,`````#!T```(X@X%
M`````"\````(\`X,`````#!X````(!X!`````"D4````,QX!`````"B\````
M11X!`````".D````5AX!`````"C\```)"0X!`````"DD```)+`X!`````"FL
M```)4@X&`````"]0````!`\)`!```#``````#`\)`!```#`$```#80\!````
M`"M(```#>@\&`````"]L````=0\!`````"K,````%`\)`!```#`,````O@\.
M`````##`````X@,``!```!``````_@\.`!```##$```!%0\.`!```##(```!
M,@\.`!```##,```!6`\.`!```##0```!:P\.`!```##4```!A0\.`!```##8
M```!H`\.`!```##<```!O0\.`!```##@```!UP\.`!```##D```!^`\.`!``
M`##H```"&@\.`!```##L```"/@\.`!```##P````30\)`!```#`(```"?P\!
M`````"N4```#E@\&`````"^8```"A0\.`!```##T````;P\!`````"-D```#
MGP$``@$````````#KP$``0`````````#M@$``0$````````#T`$``0$`````
M```#XP$``0$````````#]`$``0$````````$`0$``0``````````FP$``P$`
M```````"E@$``P``````````RP$``P`````````"IP$``P$````````"R@$`
M`P$````````"\`$``P$````````"_@$``P$````````#)`$``P$````````#
M3`$``P$`````````]@$``P$````````#4P$``P$````````"7P$``P``````
M```"9@$``P$````````#6P$``P$````````";`$``P``````````&@``%:``
M`!=J```7<```%W<``!>)```7H@```8,```&$```""P```A\```(A```"+P``
M`C$```(V```#20```[H```/G```$:P``!($```3*```&I```,+0``*U0````
MOP```+P```"S````MP```+T```"[````N0```+H```"V````P````+@```"O
M````L0```*X```"P````K````+\```"\````LP```+<```"]````NP```+D`
M``"Z````M@```,````"X````KP```+$```"N````L````*P```"^````M0``
M`,$```"T````L@```*T`````7TY807)G8P!?3EA!<F=V`%]?7W!R;V=N86UE
M`%]?9'EL9%]F=6YC7VQO;VMU<`!?7V1Y;&1?:6YI=%]C:&5C:P!?7W-T87)T
M`%]E;G9I<F]N`&1Y;&1?<W1U8E]B:6YD:6YG7VAE;'!E<@!S=&%R=`!?7U]D
M87)W:6Y?9V-C,U]P<F5R96=I<W1E<E]F<F%M95]I;F9O`%]?7VME>6UG<E]D
M=V%R9C)?<F5G:7-T97)?<V5C=&EO;G,`7U]C<&QU<U]I;FET`%]?8W1H<F5A
M9%]I;FET7W)O=71I;F4`7U]M:%]E>&5C=71E7VAE861E<@!?871E>&ET`%]C
M871C:%]E>&-E<'1I;VY?<F%I<V4`7V-A=&-H7V5X8V5P=&EO;E]R86ES95]S
M=&%T90!?8V%T8VA?97AC97!T:6]N7W)A:7-E7W-T871E7VED96YT:71Y`%]C
M;&]C:U]A;&%R;5]R97!L>0!?9&]?;6%C:%]N;W1I9GE?9&5A9%]N86UE`%]D
M;U]M86-H7VYO=&EF>5]N;U]S96YD97)S`%]D;U]M86-H7VYO=&EF>5]P;W)T
M7V1E;&5T960`7V1O7VUA8VA?;F]T:69Y7W-E;F1?;VYC90!?9&]?<V5Q;F]S
M7VUA8VA?;F]T:69Y7V1E861?;F%M90!?9&]?<V5Q;F]S7VUA8VA?;F]T:69Y
M7VYO7W-E;F1E<G,`7V1O7W-E<6YO<U]M86-H7VYO=&EF>5]P;W)T7V1E;&5T
M960`7V1O7W-E<6YO<U]M86-H7VYO=&EF>5]S96YD7V]N8V4`7V5R<FYO`%]E
M>&ET`%]M86-H7VEN:71?<F]U=&EN90!?;6%I;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"D`<&]I;G1E<E]T
M;U]?9&%R=VEN7V=C8S-?<')E<F5G:7-T97)?9G)A;65?:6YF;SI3*#`L-BD`
M`&1Y;&1?;&%Z>5]S>6UB;VQ?8FEN9&EN9U]E;G1R>5]P;VEN=`!E<G)O<E]M
M97-S86=E`&1Y;&1?9G5N8U]L;V]K=7!?<&]I;G1E<@!?9&%R=VEN7W5N=VEN
M9%]D>6QD7V%D9%]I;6%G95]H;V]K`%]D87)W:6Y?=6YW:6YD7V1Y;&1?<F5M
9;W9E7VEM86=E7VAO;VL`14A?9G)A;64Q````
`
end

20
testcases/basic-eh-app.cc Normal file
View File

@ -0,0 +1,20 @@
#include <stdlib.h>
/* This is the most basic use of EH you can imagine. It just throws and
catches an exception. It tests a significant fraction of
keymgr. */
void throw_an_exception ()
{
throw 1;
}
int main()
{
try {
throw_an_exception();
} catch (int x) {
return 0;
}
abort ();
}

38
testcases/run-tests.sh Normal file
View File

@ -0,0 +1,38 @@
#!/bin/sh
# Run all the tests in the testsuite.
# The first argument to the shell script may be a directory containing
# an alternative libSystem, good for testing keymgr before installing it.
if [ x"$1" != x ] ; then
DYLD_LIBRARY_PATH=$1
export DYLD_LIBRARY_PATH
fi
for i in basic-eh-app-jaguar-2.95 basic-eh-app-jaguar-3.1 \
basic-eh-app-tiger-4.0 basic-eh-app-10.4u-4.0 \
3043647/main 3464244/3464244 ; do
rm -f $i
uudecode -o $i ${i}.uu || echo "uudecode failed for $i"
chmod +x $i || echo "chmod failed for $i"
if ./$i ; then
echo PASS: $i
else
echo FAIL: $i
fi
done
cd 3074709
for i in main plugin plugin2 ; do
rm -f $i
uudecode -o $i ${i}.uu || echo "uudecode failed for $i"
chmod +x $i || echo "chmod failed for $i"
done
if ./main ; then
echo PASS: 3074709
else
echo FAIL: 3074709
fi
cd ..
exit 0