annotate doc/manual/manual_epilog.tex @ 467:b47168dacba6

manual: - adding aggregate passing and returning info for x64 (win and sysv, however, *only* w/ respect to types supported by dyncall) - python binding text cleanup and sync with current binding version - added suite_aggrs description and cleaned up other test suite descriptions a bit - update list of calling convention modes - cleanup and minor other fixes (e.g. changed \newpage in many places to \clearpage to avoid hitting float limit, crlf->cr, ...)
author Tassilo Philipp
date Fri, 04 Feb 2022 23:54:42 +0100
parents e932e6331f35
children 17287342e273
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 %//////////////////////////////////////////////////////////////////////////////
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2 %
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 % Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>,
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4 % Tassilo Philipp <tphilipp@potion-studios.com>
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 %
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 % Permission to use, copy, modify, and distribute this software for any
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 % purpose with or without fee is hereby granted, provided that the above
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8 % copyright notice and this permission notice appear in all copies.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9 %
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 % THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 % WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 % MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 % ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14 % WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 % ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 % OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 %
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 %//////////////////////////////////////////////////////////////////////////////
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19
467
b47168dacba6 manual:
Tassilo Philipp
parents: 90
diff changeset
20 \clearpage
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22 \section{Epilog}
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24 \subsection{Stability and security considerations}
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26 Since the \product{dyncall} library doesn't know anything about the called
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27 function itself (except its address), no parameter-type validation is done.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 This means that in order to avoid crashes, data corruption, etc., the user is
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
29 required to ascertain the number and types of parameters. It is strongly advised to
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30 double check the parameter types of every function to be called, and not to
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
31 call unknown functions at all.\\
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
32
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
33 Consider a simple program that issues a call by directly passing some
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
34 unchecked command line arguments to the call itself, or even worse, by indirectly
90
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
35 choosing a library to load and a function to call without verification.
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
36 Such unchecked input data can quite easily be used to intentionally crash the
90
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
37 program or to take over control of the program flow.\\
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
38 If not used with care, programs depending on the \product{dyncall},
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
39 \product{dyncallback} and \product{dynload} libraries, can be exploited as
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
40 arbitrary function call dispatchers through manipulation of their input data.
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
41 Successful exploits of badly formed programs like outlined above can be misused
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
42 as powerful tools for a wide variety of malicious attacks, \ldots
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
44
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45 \subsection{Embedding}
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
46
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
47 The \product{dyncall} library strives to have a minimal set of dependencies,
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
48 meaning no required runtime dependencies and usually only the necessary tools
90
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
49 to build the library as build-time dependencies, like a compiler and assembler,
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
50 linker, etc..
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51 The library uses some heap-memory to store the CallVM and uses by default the
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52 platform's \capi{malloc()} and \capi{free()} calls. However, providing custom
90
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
53 \capi{dcAllocMem} and \capi{dcFreeMem} C-preprocessor definitions will override
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
54 the default behaviour.
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
55 See \shell{dyncall/dyncall\_alloc.h} for details.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
57
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58 \subsection{Multi-threading}
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
59
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
60 The \product{dyncall} library is thread-safe and reentrant, by means that it
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
61 works correctly during execution of multiple threads if, and only if there is
90
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
62 at most a single thread pushing arguments to one CallVM. Since there's no
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
63 limitation on the number of created CallVM objects, it is recommended to keep a
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
64 copy per thread if mutliple threads make use of \product{dyncall} in parallel.
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
65 Invoking the call should always be thread-safe, however, whether the called
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
66 function is thread-safe is up to the programmer to verify, of course.
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
67
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
68 \subsection{Supported types}
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
69
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
70 Currently, the \product{dyncall} library supports all of ANSI C's integer,
90
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
71 floating point and pointer types as function call arguments and return values.
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
72 Additionally, C++'s \capi{bool} and C99's \capi{\_Bool} types are supported.
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
73 Due to the still rare and often incomplete support of the \capi{long double}
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
74 type on various platforms, the latter is currently not officially supported.
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
75
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
76 \subsection{Roadmap}
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
77
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
78 The \product{dyncall} library should be extended by a wide variety of other
90
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
79 calling conventions and ported to other and more esoteric platforms. With its
e932e6331f35 - manual improvements
cslag
parents: 0
diff changeset
80 low memory footprint it surely comes in handy on embedded systems.
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
81 Furthermore, the authors plan to provide more scripting language bindings,
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
82 examples, and other projects based on \product{dyncall}.\\
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
83 Besides \product{dyncall} and \product{dyncallback}, the \product{dynload}
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
84 library needs to be extended with support for other shared library formats
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
85 (e.g. AmigaOS .library or GEM \cite{.ldg} files).
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
86
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
87
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
88 \subsection{Related libraries}
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
89
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
90 Besides the \product{dyncall} library, there are other free and open projects
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
91 with similar goals. The most noteworthy libraries are libffi \cite{libffi},
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
92 C/Invoke \cite{cinvoke} and libffcall \cite{libffcall}.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
93