Commit graph

25 commits

Author SHA1 Message Date
Kevin Lin
7d05cb15c9 CID 11106 - initialized uninitialized field to NULL 2014-09-23 11:05:35 -04:00
Kevin Lin
5b5be2a65d win32: fixed additional OS specific build issues
bc2llvm: removed redundant macro causing issues in win32
2014-07-25 20:10:23 -04:00
Kevin Lin
0b5550c176 bytecode: various LLVM version specific fixes 2014-07-25 12:47:30 -04:00
Kevin Lin
0ea799f8e8 bytecode: synced clambc-rtcheck pass with compiler version 2014-07-25 12:47:08 -04:00
Kevin Lin
34d8b8cfc7 bb#10981 - applied LLVM 3.1-3.4 patch for testing
Conflicts:

	libclamav/c++/Makefile.am
	libclamav/c++/bytecode2llvm.cpp
2014-07-25 12:26:04 -04:00
David Raynor
26f3bad1a1 bytecode: cid #10622 2013-08-15 16:47:25 -04:00
Török Edvin
59f1b78b51 Support LLVM 3.0 API 2011-09-30 15:32:16 +03:00
Török Edvin
0c79cc5529 Support building with external LLVM 2.9, and drop support for building with external 2.8
Internal version is an LLVM 2.8 with 2 patches backported from LLVM 2.9 to fix a
crash on AVX chips.
So drop support for building with external LLVM 2.8, and add support for
building with external LLVM 2.9 instead.

Caveat:
 stack smashing protection is broken on LLVM 2.9 so it is disabled

Example on Debian:
apt-get install llvm-2.9-dev
./configure --enable-llvm --with-system-llvm=/usr/bin/llvm-config-2.9
2011-05-06 16:16:33 +03:00
Török Edvin
bc0ef08bb7 Fix paranoid mode crash (bb #2434).
Only occurs if Paranoid mode is set in clamd.conf, or unsigned and signed
bytecode are loaded together in --enable-unsigned-bytecode mode.
2011-01-10 23:54:27 +02:00
Török Edvin
dccafff069 define LLVM28, since we are using that now. 2010-11-06 15:50:31 +02:00
Török Edvin
6991d27807 Fix unsigned bytecode load. 2010-09-28 19:24:14 +03:00
Török Edvin
45ba739216 Fix constructors for LLVM 2.8. 2010-09-28 14:45:04 +03:00
Török Edvin
b22af13f7a Merge branch 'llvm2.8'
* llvm2.8:
  Regenerate configure and Makefile.
  LLVM 2.8 changed llvm.mem{cpy,move,set}.* to take 5 arguments.
  LLVM 2.8 API update.
  Don't cast the iterator directly.
  Use CallSite instead of CI->getOperand.
  Support building with external LLVM 2.8.

Conflicts:
	libclamav/c++/Makefile.in
	libclamav/c++/bytecode2llvm.cpp
	libclamav/c++/configure
2010-09-28 14:28:59 +03:00
Török Edvin
1300b00244 Don't cast the iterator directly.
LLVM 2.8 doesn't allow this, first dereference, then cast.
This is compatible with 2.7.
2010-09-28 14:25:22 +03:00
Török Edvin
e25293055d Use CallSite instead of CI->getOperand.
getOperand was made private because order of operands got changed.
CallSite works with both LLVM 2.7 and 2.8.
2010-09-28 14:25:22 +03:00
Török Edvin
6e52ce67c7 Improve bytecode load time and optimization (bb #2278).
Avoid quadratic load times: run module passes at the end, and run
rtcheck inserter at the end also.

Also optimize away some simple situations that the compiler couldn't,
like result of __is_bigendian() which is a constant at load time (but not at
compile time).
If we would have run LLVM's -O1 optimizers these would have been
optimized already, but we don't do that for 2 reasons:
 - optimizations may introduce new bugs
 - may take a bit longer time
Just run some simple transforms, and some custom optimizations for the bigendian
case.
2010-09-21 20:24:06 +03:00
Török Edvin
f1d071c8ed Avoid false 'Verification error' messages (bb #2239).
The fix for bb #1924 already fixed most of these, by using the stackprotectreq
attribute to determine if a function was already verified, not to verify it
twice.
However very simple bytecodes don't get that attribute applied. Fix this by
always applying the stackprotect attribute, and checking for that attribute
instead of stackprotectreq.
2010-09-01 10:04:36 +03:00
Török Edvin
88f0eaace3 Update bytecode verifier from compiler. 2010-05-14 14:44:30 +03:00
Török Edvin
daad92ace3 Relax bounds checks. It was rejecting correct code.
Bounds checks were too strict, causing the bytecode to abort when it shouldn't.
This happened when trying to access the last byte of an array, the verifier
was too conservative and considered to be out of bounds, when in fact it wasn't.

This is an update of the runtime verifier from the bytecode compiler.
2010-05-13 12:41:59 +03:00
Török Edvin
2f995d9abc Fix load of multiple unsigned bytecodes (bb #1924)
All bytecode functions are loaded in a single module, the bounds verifier is
run, and then stack protectors are inserted.
The problem is that when the next bytecode function is loaded, all functions get
run through the verifier again (including those which got the stack protector
applied), and the bounds verifier rejects it (it doesn't know about stack
protectors).

The fix is to skip running the bounds verifier when a function already has the
stack protector applied, when run in libclamav.

This affects only loading of multiple unsigned bytecodes, or an unsigned
bytecode + bytecode.cvd.
Load of a single unsigned bytecode works, and load of multiple signed bytecodes
is not affected (since the verifier is skipped there).
2010-04-05 22:46:52 +03:00
Török Edvin
556eaf0442 Update ClamBCRTChecks.cpp from bytecode compiler:
Check bounds of each pointer passed to/from APIcalls,
forbid recursion.
2010-03-30 23:23:41 +03:00
Török Edvin
b56bea54d3 New API for buffer fill. 2010-03-22 11:18:28 +02:00
Török Edvin
aa745db74d Add clamscan commandline to load bytecode in debug mode. 2010-03-12 13:13:08 +02:00
Török Edvin
dcd3e8019b nullcheck. 2010-03-10 12:20:06 +02:00
Török Edvin
a45651d4cb add another missing file 2010-02-15 17:45:33 +02:00