aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* libsandbox: hoist the *at pre-check functions up a levelMike Frysinger2021-10-281-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The reason we put these in wrapper-funcs/ is because we normally dynamically include them when the corresponding symbol is available. For example, if the C library supports symbol foo, and there is a wrapper-funcs/foo_pre_check.c, we'll automatically include it based on the assumption that wrapper-funcs/foo.c needs it. But if the C library doesn't have a symbol foo, we won't include foo.c or the foo_pre_check.c file at all. Sounds fine. The *at family of functions is a bit different because we end up using them both in the wrapper-funcs/ files, and in the trace code, the latter of which we use unconditionally. This lead to a build issue early on (see commit b27df46f349e850067ae388fe067b043abf3aecb ("libsandbox: fix missing *at pre_checks")) whereby we hacked in these *at pre-check symbols all the time. At which point, having them be in wrapper-funcs/ was more out of convention with how we manage all our other APIs. We want to support running ptrace from the sandbox binary directly which requires linking (most of) libsandbox into it, and to that end, hoist these pre-check functions out of wrapper-funcs. This makes it a bit clearer that we always want to compile these. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* libsandbox: extend symbols format to specify diff syscall nameMike Frysinger2021-10-233-20/+34
| | | | | | | | This enables support for 64-bit time_t syscalls where the glibc symbol name is not the same as the kernel syscall name. Closes: https://bugs.gentoo.org/751241 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* libsandbox: tweak how undefined symbols are declaredMike Frysinger2021-10-231-2/+1
| | | | | | | | | | Rather than always set undefined symbols to the same constant, expand it to a range of constants, and give every symbol a unique value. For dynamic symbol processing, this isn't a big deal as such symbols will never show up, but when handling syscalls that don't have a matching C library symbol, we need to make sure that we have unique entries. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* libsandbox: move symbols.h.in parsing to scriptsMike Frysinger2021-10-233-8/+24
| | | | | | | | | | | In preparation for extending the symbol format, move parsing out of the makefile (which is a basic sed expression) to the awk scripts. This also has a nice side benefit of removing one automake warning. It is slightly more code, but the scripts will be diverging shortly, so it's unavoidable. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* scripts: rewrite main processing loops for significant speedupMike Frysinger2021-10-232-124/+136
| | | | | | | | | | | | | | The awk scripts iterate over all the possible symbols for each line of readelf output. As we add more symbols, and as the C library grows, the number of iterations explodes. We iterate over the list of possible symbols by creating a regex to match against the readelf output. We could create a large regex at the start of the script to match all possible symbols, and then run that against the readelf lines. This avoids the nested loop logic, and speeds up the scripts significantly: from ~1.5sec to ~0.05sec. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* scripts/gen_symbol_header.awk: undefine libc symbol aliasesSergei Trofimovich2019-06-251-0/+4
| | | | | | | | | | | | | | Avoid libc's symbol rename via #define. musl defines aliases as: #define mkstemp64 mkstemp #define mkstemps64 mkstemps This causes libsandbox's aliases to clash with one another, like mkstemp and mkstemp64. The change does not break glibc and restores musl support. Bug: https://bugs.gentoo.org/549108 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Flatten data, etc & scripts MakefilesMichał Górny2019-01-131-4/+0
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* libsandbox: fix missing *at pre_checksMike Frysinger2009-08-251-0/+2
| | | | | | | For systems that lack *at() funcs, make sure we still include the pre-checks as we use these functions in the non-at version. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* libsandbox: add pre checks to static tracingMike Frysinger2009-06-041-0/+5
| | | | | | | | | | The normal wrapped functions go through some "pre checks" where certain normal conditions are not flagged as problematic. The static tracing lacked those pre checks though. URL: http://bugs.gentoo.org/265885 Signed-off-by: Mike Frysinger <vapier@gentoo.org> Reported-by: Daniel Robbins <drobbins@funtoo.org>
* libsandbox: accept flexible syscall definesMike Frysinger2009-04-051-3/+7
| | | | | | | | | Most systems define the syscall numbers as a plain int, but others use a base and an offset (like arm). So work with that format as well. URL: http://bugs.gentoo.org/265020 Signed-off-by: Mike Frysinger <vapier@gentoo.org> Reported-by: Ryan Tandy <tarpman@gmail.com>
* libsandbox: enable tracing for multiple personalitiesMike Frysinger2009-04-051-9/+28
| | | | | | | | | Initial support for tracing non-default personalities. For example, tracing a 32bit binary from a 64bit environment. URL: http://bugs.gentoo.org/264399 Signed-off-by: Mike Frysinger <vapier@gentoo.org> Reported-by: Patrick Lauer <patrick@gentoo.org>
* libsandbox: initial support for tracing of static binaries via ptrace()Mike Frysinger2009-03-182-1/+30
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* scripts: disable wrappers for weak __XXX symbolsMike Frysinger2009-02-202-0/+12
| | | | | | | | | | Since there doesn't seem to be a use for wrapping the __XXX weak symbols, and things aren't using these in normal glibc/uClibc code, stop attempting to handle them. This should work around the FreeBSD infinite recursion issue as well (their getcwd() calls __getcwd(), both of which are public symbols). Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* libsandbox: calculate longest symbol name dynamicallyMike Frysinger2009-02-151-0/+7
| | | | | | | | The longest wrapped symbol name has hit the hard limit of 10 chars, so rather than manually bump it up, calculate it on the fly with the awk scripts. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* gen_symbol_version_map.awk: filter out more symbolsMike Frysinger2009-02-051-0/+5
| | | | | | | Ignore symbols that are not functions, or do not have the proper binding and/or visibility for us to override. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* libsandbox: unify wrapper funcsMike Frysinger2008-12-311-0/+5
| | | | | | Unify a lot of duplicated code in the wrapper-funcs handling. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* libsandbox: make sure SB_NR_* is always definedMike Frysinger2008-12-231-1/+5
| | | | | | | | | If the host libc does not support a wrapped function, then setup a bogus SB_NR_* define for it still. This way we don't need to fill up the source with ugly #ifdef's. The resulting overhead at runtime should be negligible anyways as it's simply one additional integer compare. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* libsandbox: use integers rather than strings for functionsMike Frysinger2008-11-291-0/+3
| | | | | | Rather than doing a buttload of strcmp's on function names, use integers. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* libsandbox.map: beautify outputMike Frysinger2008-11-291-8/+7
| | | | | | Make the output of gen_symbol_version_map.awk a bit more readable. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* simplify awk scriptsMike Frysinger2008-11-292-12/+11
| | | | | | | | Simplify the generation of libsandbox.map and symbols.h and the associated awk scripts. Now we don't have to rely on arbitrary whitespace in the symbols.h.in file. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* ChangeLog: use git to generateMike Frysinger2008-11-282-777/+0
| | | | | | | Now that we're using git rather than svn, update the ChangeLog generation method accordingly. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* svn2cl: make sure we find/use the local xslMike Frysinger2008-11-101-1/+1
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* libsandbox: break function args out into WRAPPER_ARGS and func name into ↵Mike Frysinger2008-11-101-0/+3
| | | | | | STRING_NAME Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* scripts: strip whitespaceMike Frysinger2008-11-102-20/+20
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* svn2cl: also update xsl to 0.9Mike Frysinger2008-11-101-101/+238
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* svn2cl: update to 0.9Mike Frysinger2008-11-091-32/+159
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* use `make dist` to generate tarballsMike Frysinger2007-04-192-36/+0
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* svn2cl: run during `make dist` rather than `./autogen.sh`Mike Frysinger2007-04-191-0/+0
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Add awol commit for renaming of wrapper-funcs commit.Martin Schlemmer2006-07-131-1/+1
| | | | Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
* Split wrappers out to make modifying easier.Martin Schlemmer2006-07-131-2/+12
| | | | Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
* Add needed changes to get a working sandbox on FreeBSDAlex Unleashed2006-07-082-0/+18
| | | | | Signed-off-by: Alex Unleashed <unledev@gmail.com> Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
* Fix symbol/map generation on AlphaMartin Schlemmer2006-04-252-18/+24
| | | | | Signed-off-by: Martin Schlemmer <azarah@gentoo.org> Reported-by: Fernando J. Pereda <ferdy@gentoo.org>
* Update svn2cl and fix parse issue with latest libxslt-1.1.15.Martin Schlemmer2006-02-062-44/+132
| | | | Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
* Cleanup.Martin Schlemmer2005-12-101-1/+1
| | | | Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
* Add support for readelf from elfutils.Martin Schlemmer2005-12-102-2/+2
| | | | Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
* Fix weak symbols on 32bit glibc where it have a different version.Martin Schlemmer2005-12-052-26/+8
| | | | Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
* Also add weak symbols.Martin Schlemmer2005-12-052-7/+99
| | | | Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
* Stop processing when we get to the '.symtab' section.Martin Schlemmer2005-12-052-0/+10
| | | | Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
* Change default prefix '__' to '_DEFAULT' suffix to avoid confusionMartin Schlemmer2005-12-031-1/+1
| | | | | | some people seem to have. Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
* Add dist.sh to make my life easier.Martin Schlemmer2005-12-021-0/+18
| | | | Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
* Do not re-set VERSIONED_LIBC if already set.Martin Schlemmer2005-12-022-3/+4
| | | | Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
* Do not add unversioned symbols if we have a versioned libc.Martin Schlemmer2005-12-022-2/+41
| | | | | | | | Do not add duplicates. This is mostly due to unstripped libc .. bug #114200. URL: http://bugs.gentoo.org/114200 Signed-off-by: Martin Schlemmer <azarah@gentoo.org> Reported-by: James <James@superbug.demon.co.uk>
* Move clean.sh to scripts. Some 'make distcheck' fixes.Martin Schlemmer2005-12-011-0/+18
| | | | Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
* Add scripts/svn2cl.*; move ChangeLog and update autogen.sh toMartin Schlemmer2005-12-012-0/+425
| | | | | | generate ChangeLog. Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
* Some comment touch-ups.Martin Schlemmer2005-12-011-0/+1
| | | | Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
* Fixup comments related to strong aliases.Martin Schlemmer2005-12-011-1/+2
| | | | Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
* Fix non-versioned libc's to also prepend '__' to internal symbols by usingMartin Schlemmer2005-12-011-1/+5
| | | | | | strong aliases. Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
* Use versioned symbols on supported libc's for functions we wrap, as well asMartin Schlemmer2005-11-303-0/+129
provide all versions of specific functions. Some syntax cleanups. Signed-off-by: Martin Schlemmer <azarah@gentoo.org>