Merge branch 'master' of ssh://pkgs.fedoraproject.org/clamav

Conflicts:
	clamav.spec
This commit is contained in:
Robert Scheck 2014-01-15 11:41:38 +01:00
commit 1f72798844
3 changed files with 102 additions and 32 deletions

View File

@ -1,30 +0,0 @@
Patch by Robert Scheck <robert@fedoraproject.org> for clamav <= 0.98 which adds support for
ARM. The syscall is taken from arch/arm/include/asm/unistd.h from the Linux kernel. Without
this patch building on (at least) ARMv7 fails like this:
In file included from fan.c:38:0:
fan-syscalllib.h:14:3: error: #error "System call numbers not defined for this architecture"
# error "System call numbers not defined for this architecture"
^
fan-syscalllib.h: In function 'fanotify_init':
fan-syscalllib.h:19:17: error: '__NR_fanotify_init' undeclared (first use in this function)
return syscall(__NR_fanotify_init, flags, event_f_flags);
^
fan-syscalllib.h:19:17: note: each undeclared identifier is reported only once for each function it appears in
fan-syscalllib.h: In function 'fanotify_mark':
fan-syscalllib.h:25:17: error: '__NR_fanotify_mark' undeclared (first use in this function)
return syscall(__NR_fanotify_mark, fanotify_fd, flags, mask,
^
--- clamav-0.98/clamd/fan-syscalllib.h 2013-09-16 21:28:14.000000000 +0200
+++ clamav-0.98/clamd/fan-syscalllib.h.arm-fanotify 2013-10-06 22:29:26.000000000 +0200
@@ -10,6 +10,9 @@
#elif defined(__i386__)
# define __NR_fanotify_init 338
# define __NR_fanotify_mark 339
+#elif defined(__ARM_EABI__)
+# define __NR_fanotify_init 367
+# define __NR_fanotify_mark 368
#else
# error "System call numbers not defined for this architecture"
#endif

View File

@ -0,0 +1,95 @@
From 4cd8ed07d0313bca37b01064208eafa842f1a169 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Wed, 9 Oct 2013 12:17:30 +0200
Subject: [PATCH] switch to glibc functions for fanotify
Switch to glibc functions for fanotify instead of using the incomplete
hand-crafted support. It makes possible to build clamav on non-x86
Linux architectures.
---
clamd/fan-syscalllib.h | 28 ----------------------------
clamd/fan.c | 3 +--
configure | 4 ++--
configure.ac | 2 +-
4 files changed, 4 insertions(+), 33 deletions(-)
delete mode 100644 clamd/fan-syscalllib.h
diff --git a/clamd/fan-syscalllib.h b/clamd/fan-syscalllib.h
deleted file mode 100644
index 288cd99..0000000
--- a/clamd/fan-syscalllib.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef __FANOTIFY_SYSCALL_LIB
-#define __FANOTIFY_SYSCALL_LIB
-
-#include <unistd.h>
-#include <linux/types.h>
-
-#if defined(__x86_64__)
-# define __NR_fanotify_init 300
-# define __NR_fanotify_mark 301
-#elif defined(__i386__)
-# define __NR_fanotify_init 338
-# define __NR_fanotify_mark 339
-#else
-# error "System call numbers not defined for this architecture"
-#endif
-
-static inline int fanotify_init(unsigned int flags, unsigned int event_f_flags)
-{
- return syscall(__NR_fanotify_init, flags, event_f_flags);
-}
-
-static inline int fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
- int dfd, const char *pathname)
-{
- return syscall(__NR_fanotify_mark, fanotify_fd, flags, mask,
- dfd, pathname);
-}
-#endif
diff --git a/clamd/fan.c b/clamd/fan.c
index 303f52e..66d2932 100644
--- a/clamd/fan.c
+++ b/clamd/fan.c
@@ -34,8 +34,7 @@
#include <string.h>
#include <errno.h>
-#include <linux/fanotify.h>
-#include "fan-syscalllib.h"
+#include <sys/fanotify.h>
#include "fan.h"
#include "libclamav/clamav.h"
diff --git a/configure b/configure
index a570707..b75e740 100755
--- a/configure
+++ b/configure
@@ -17840,8 +17840,8 @@ $as_echo "#define C_LINUX 1" >>confdefs.h
THREAD_LIBS="-lpthread"
TH_SAFE="-thread-safe"
if test "$want_fanotify" = "yes"; then
- ac_fn_c_check_header_mongrel "$LINENO" "linux/fanotify.h" "ac_cv_header_linux_fanotify_h" "$ac_includes_default"
-if test "x$ac_cv_header_linux_fanotify_h" = xyes; then :
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/fanotify.h" "ac_cv_header_sys_fanotify_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_fanotify_h" = xyes; then :
$as_echo "#define FANOTIFY 1" >>confdefs.h
diff --git a/configure.ac b/configure.ac
index 8ea9dac..4dba8f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1001,7 +1001,7 @@ linux*)
THREAD_LIBS="-lpthread"
TH_SAFE="-thread-safe"
if test "$want_fanotify" = "yes"; then
- AC_CHECK_HEADER([linux/fanotify.h],AC_DEFINE([FANOTIFY],1,[use fanotify]),)
+ AC_CHECK_HEADER([sys/fanotify.h],AC_DEFINE([FANOTIFY],1,[use fanotify]),)
fi
fi
;;
--
1.8.1.4

View File

@ -79,7 +79,9 @@ Patch27: clamav-0.98-umask.patch
Patch29: clamav-0.98-jitoff.patch
# https://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/Intercept.cpp?r1=128086&r2=137567
Patch30: llvm-glibc.patch
Patch31: clamav-0.98-arm-fanotify.patch
# use glibc fanotify instead of limited hand-crafted support
# https://bugzilla.clamav.net/show_bug.cgi?id=9156
Patch31: clamav-0.98-glibc-fanotify.patch
BuildRoot: %_tmppath/%name-%version-%release-root
Requires: clamav-lib = %version-%release
Requires: data(clamav)
@ -393,7 +395,7 @@ The systemd initscripts for clamav-scanner.
%apply -n27 -p1 -b .umask
%apply -n29 -p1 -b .jitoff
%apply -n30 -p1
%apply -n31 -p1 -b .arm-fanotify
%apply -n31 -p1 -b .glibc-fanotify
%{?apply_end}
install -p -m0644 %SOURCE300 clamav-milter/
@ -859,6 +861,9 @@ test "$1" != "0" || /sbin/initctl -q stop clamav-milter || :
* Wed Jan 15 2014 Robert Scheck <robert@fedoraproject.org> - 0.98.1-1
- Upgrade to 0.98.1 and updated daily.cvd (#1053400)
* Wed Oct 09 2013 Dan Horák <dan[at]danny.cz> - 0.98-2
- Use fanotify from glibc instead of the limited hand-crafted version
* Sun Oct 06 2013 Robert Scheck <robert@fedoraproject.org> - 0.98-1
- Upgrade to 0.98 and updated main.cvd and daily.cvd (#1010168)