From 114a6b262ee4438276d877132fbbc74f0fa1ec67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Wed, 9 Oct 2013 13:10:55 +0200 Subject: [PATCH] - Use fanotify from glibc instead of the limited hand-crafted version --- clamav-0.98-arm-fanotify.patch | 30 ---------- clamav-0.98-glibc-fanotify.patch | 95 ++++++++++++++++++++++++++++++++ clamav.spec | 11 +++- 3 files changed, 103 insertions(+), 33 deletions(-) delete mode 100644 clamav-0.98-arm-fanotify.patch create mode 100644 clamav-0.98-glibc-fanotify.patch diff --git a/clamav-0.98-arm-fanotify.patch b/clamav-0.98-arm-fanotify.patch deleted file mode 100644 index 7a08715..0000000 --- a/clamav-0.98-arm-fanotify.patch +++ /dev/null @@ -1,30 +0,0 @@ -Patch by Robert Scheck 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 diff --git a/clamav-0.98-glibc-fanotify.patch b/clamav-0.98-glibc-fanotify.patch new file mode 100644 index 0000000..8ffba74 --- /dev/null +++ b/clamav-0.98-glibc-fanotify.patch @@ -0,0 +1,95 @@ +From 4cd8ed07d0313bca37b01064208eafa842f1a169 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Dan=20Hor=C3=A1k?= +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 +-#include +- +-#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 + #include + +-#include +-#include "fan-syscalllib.h" ++#include + #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 + diff --git a/clamav.spec b/clamav.spec index 7ad1b72..567f360 100644 --- a/clamav.spec +++ b/clamav.spec @@ -53,7 +53,7 @@ Requires(postun): /bin/systemctl\ Summary: End-user tools for the Clam Antivirus scanner Name: clamav Version: 0.98 -Release: 1%{?dist} +Release: 2%{?dist} License: %{?with_unrar:proprietary}%{!?with_unrar:GPLv2} Group: Applications/File URL: http://www.clamav.net @@ -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/ @@ -856,6 +858,9 @@ test "$1" != "0" || /sbin/initctl -q stop clamav-milter || : %changelog +* Wed Oct 09 2013 Dan HorĂ¡k - 0.98-2 +- Use fanotify from glibc instead of the limited hand-crafted version + * Sun Oct 06 2013 Robert Scheck - 0.98-1 - Upgrade to 0.98 and updated main.cvd and daily.cvd (#1010168)