Modify

Opened 4 years ago

Last modified 3 years ago

#16679 new defect

XMail package error Failed to create for eventfd

Reported by: skonvols2k Owned by: developers
Priority: normal Milestone: Chaos Calmer 15.05
Component: packages Version: Trunk
Keywords: Cc:

Description

Hi,
on last trunk build r40896 the xmail package on start returns error: "Failed to create for eventfd".

the problem is described in https://forum.openwrt.org/viewtopic.php?id=49547

please fix
Thanks

Attachments (5)

xmail_fix_eventfd_initialization.patch (847 bytes) - added by НКВД 4 years ago.
Workaround for uClibc eventfd EFD_* / fcntl O_* mismatches on some architectures.
eventfd_add_arch_specific_flags.patch (9.9 KB) - added by НКВД 3 years ago.
Backport of uClibc master git commit fd355bc1dbcb794ae1abf0fad1459e28d8567ba0 (eventfd.h: Use new "bits/" scheme for arch-specific flags)
xmail_1.27-1_ar71xx.ipk (165.4 KB) - added by НКВД 3 years ago.
xmail package (with eventfd support) built using barrier breaker (14.07) sdk.
xmail_fix_eventfd_support_detection.patch (924 bytes) - added by НКВД 3 years ago.
Fix eventfd(2) support detection at compile time.
xmail_eventfd_fixes.patch (1.7 KB) - added by НКВД 3 years ago.
Includes both "xmail_fix_eventfd_initialization" and "xmail_fix_eventfd_support_detection" patches.

Download all attachments as: .zip

Change History (18)

comment:1 Changed 4 years ago by НКВД

Hi.

This problem looks like a lot as this one: #9338, which was fixed at r26794.

For more details, see the explanation of the workaround patch committed at r26794.

Changed 4 years ago by НКВД

Workaround for uClibc eventfd EFD_* / fcntl O_* mismatches on some architectures.

comment:2 Changed 4 years ago by anonymous

great, many thanks.
now with your patch xmail is again working on brcm47xx

comment:3 Changed 3 years ago by anonymous

Hi,
same problem again with r42056 (14.07 rc3) please fix.
Thanks a lot

comment:4 follow-up: Changed 3 years ago by НКВД

Doing a backport of uClibc master git commit fd355bc1dbcb794ae1abf0fad1459e28d8567ba0 should fix this problem.

comment:5 in reply to: ↑ 4 Changed 3 years ago by НКВД

Replying to НКВД:

Doing a backport of uClibc master git commit fd355bc1dbcb794ae1abf0fad1459e28d8567ba0 should fix this problem.

Here is the backported patch:

Index: toolchain/uClibc/patches-0.9.33.2/999-eventfd_use_bits_scheme.patch
===================================================================
diff --git a/toolchain/uClibc/patches-0.9.33.2/999-eventfd_use_bits_scheme.patch b/toolchain/uClibc/patches-0.9.33.2/999-eventfd_use_bits_scheme.patch
new file mode 100644
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/999-eventfd_use_bits_scheme.patch
@@ -0,0 +1,269 @@
+From fd355bc1dbcb794ae1abf0fad1459e28d8567ba0 Mon Sep 17 00:00:00 2001
+From: Hiroaki KAWAI <kawai@stratosphere.co.jp>
+Date: Fri, 19 Apr 2013 01:09:35 +0000
+Subject: eventfd.h: Use new "bits/" scheme for arch-specific flags
+
+As in timerfd.h, eventfd.h needs arch-specific definition files.
+alpha, mips and sparc needs separate file, all the other arch
+will use common definition.
+
+This problem is already fixed in glibc.
+
+Also sanitize and provide bits for hppa.
+Make sure not to install the new bits/eventfd unless eventfd support is
+enabled.
+
+Signed-off-by: Hiroaki KAWAI <kawai@stratosphere.co.jp>
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+---
+diff --git a/Makefile.in b/Makefile.in
+index 3d3ba3d..da865db 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -272,6 +272,7 @@ HEADERS_RM-$(UCLIBC_HAS_XATTR)               += sys/xattr.h
+ HEADERS_RM-$(UCLIBC_HAS_XLOCALE)             += xlocale.h
+ HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC)          += sys/eventfd.h sys/fsuid.h \
+ 	bits/inotify.h \
++	bits/eventfd.h \
+ 	sys/inotify.h \
+ 	sys/kdaemon.h \
+ 	sys/perm.h \
+diff --git a/libc/sysdeps/linux/alpha/bits/eventfd.h b/libc/sysdeps/linux/alpha/bits/eventfd.h
+new file mode 100644
+index 0000000..b5a7e41
+--- /dev/null
++++ b/libc/sysdeps/linux/alpha/bits/eventfd.h
+@@ -0,0 +1,31 @@
++/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#ifndef	_SYS_EVENTFD_H
++# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
++#endif
++
++/* Flags for eventfd.  */
++enum
++  {
++    EFD_SEMAPHORE = 000000001,
++#define EFD_SEMAPHORE EFD_SEMAPHORE
++    EFD_CLOEXEC   = 010000000,
++#define EFD_CLOEXEC EFD_CLOEXEC
++    EFD_NONBLOCK  = 000000004
++#define EFD_NONBLOCK EFD_NONBLOCK
++  };
+diff --git a/libc/sysdeps/linux/common/bits/eventfd.h b/libc/sysdeps/linux/common/bits/eventfd.h
+new file mode 100644
+index 0000000..ef49c61
+--- /dev/null
++++ b/libc/sysdeps/linux/common/bits/eventfd.h
+@@ -0,0 +1,31 @@
++/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#ifndef	_SYS_EVENTFD_H
++# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
++#endif
++
++/* Flags for eventfd.  */
++enum
++  {
++    EFD_SEMAPHORE = 00000001,
++#define EFD_SEMAPHORE EFD_SEMAPHORE
++    EFD_CLOEXEC = 02000000,
++#define EFD_CLOEXEC EFD_CLOEXEC
++    EFD_NONBLOCK = 00004000
++#define EFD_NONBLOCK EFD_NONBLOCK
++  };
+diff --git a/libc/sysdeps/linux/common/sys/eventfd.h b/libc/sysdeps/linux/common/sys/eventfd.h
+index c46c2a5..1bf785f 100644
+--- a/libc/sysdeps/linux/common/sys/eventfd.h
++++ b/libc/sysdeps/linux/common/sys/eventfd.h
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
++/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
+    This file is part of the GNU C Library.
+ 
+    The GNU C Library is free software; you can redistribute it and/or
+@@ -21,21 +21,12 @@
+ 
+ #include <stdint.h>
+ 
++/* Get the platform-dependent flags.  */
++#include <bits/eventfd.h>
+ 
+ /* Type for event counter.  */
+ typedef uint64_t eventfd_t;
+ 
+-/* Flags for signalfd.  */
+-enum
+-  {
+-    EFD_SEMAPHORE = 1,
+-#define EFD_SEMAPHORE EFD_SEMAPHORE
+-    EFD_CLOEXEC = 02000000,
+-#define EFD_CLOEXEC EFD_CLOEXEC
+-    EFD_NONBLOCK = 04000
+-#define EFD_NONBLOCK EFD_NONBLOCK
+-  };
+-
+ 
+ __BEGIN_DECLS
+ 
+@@ -43,6 +34,16 @@ __BEGIN_DECLS
+    value to COUNT.  */
+ extern int eventfd (int __count, int __flags) __THROW;
+ 
++#if 0 /* not (yet) implemented in uClibc */
++
++/* Read event counter and possibly wait for events.  */
++extern int eventfd_read (int __fd, eventfd_t *__value);
++
++/* Increment event counter.  */
++extern int eventfd_write (int __fd, eventfd_t __value);
++
++#endif
++
+ __END_DECLS
+ 
+ #endif /* sys/eventfd.h */
+diff --git a/libc/sysdeps/linux/hppa/bits/eventfd.h b/libc/sysdeps/linux/hppa/bits/eventfd.h
+new file mode 100644
+index 0000000..6182c07
+--- /dev/null
++++ b/libc/sysdeps/linux/hppa/bits/eventfd.h
+@@ -0,0 +1,32 @@
++/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library.  If not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#ifndef	_SYS_EVENTFD_H
++# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
++#endif
++
++/* Flags for signalfd.  */
++enum
++  {
++    EFD_SEMAPHORE = 000000001,
++#define EFD_SEMAPHORE EFD_SEMAPHORE
++    EFD_CLOEXEC   = 010000000,
++#define EFD_CLOEXEC EFD_CLOEXEC
++/* the below value looks suspicious, should be 000200004 for consistency */
++    EFD_NONBLOCK  = 00200004 /* HPUX has separate NDELAY & NONBLOCK */
++#define EFD_NONBLOCK EFD_NONBLOCK
++  };
+diff --git a/libc/sysdeps/linux/mips/bits/eventfd.h b/libc/sysdeps/linux/mips/bits/eventfd.h
+new file mode 100644
+index 0000000..17b2f46
+--- /dev/null
++++ b/libc/sysdeps/linux/mips/bits/eventfd.h
+@@ -0,0 +1,31 @@
++/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#ifndef	_SYS_EVENTFD_H
++# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
++#endif
++
++/* Flags for eventfd.  */
++enum
++  {
++    EFD_SEMAPHORE = 00000001,
++#define EFD_SEMAPHORE EFD_SEMAPHORE
++    EFD_CLOEXEC = 02000000,
++#define EFD_CLOEXEC EFD_CLOEXEC
++    EFD_NONBLOCK = 00000200
++#define EFD_NONBLOCK EFD_NONBLOCK
++  };
+diff --git a/libc/sysdeps/linux/sparc/bits/eventfd.h b/libc/sysdeps/linux/sparc/bits/eventfd.h
+new file mode 100644
+index 0000000..bed9f09
+--- /dev/null
++++ b/libc/sysdeps/linux/sparc/bits/eventfd.h
+@@ -0,0 +1,31 @@
++/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#ifndef	_SYS_EVENTFD_H
++# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
++#endif
++
++/* Flags for eventfd.  */
++enum
++  {
++    EFD_SEMAPHORE = 1,
++#define EFD_SEMAPHORE EFD_SEMAPHORE
++    EFD_CLOEXEC = 0x400000,
++#define EFD_CLOEXEC EFD_CLOEXEC
++    EFD_NONBLOCK = 0x004000
++#define EFD_NONBLOCK EFD_NONBLOCK
++  };
+--
+cgit v0.9.1

Changed 3 years ago by НКВД

Backport of uClibc master git commit fd355bc1dbcb794ae1abf0fad1459e28d8567ba0 (eventfd.h: Use new "bits/" scheme for arch-specific flags)

comment:6 follow-up: Changed 3 years ago by anonymous

This problem also happens in Barrier Breaker r42682

comment:7 in reply to: ↑ 6 Changed 3 years ago by skonvols2k

Replying to anonymous:

This problem also happens in Barrier Breaker r42682

Yes for me too. Can someone please update Barrier Breaker repo with corrected ipk package?
Thanks a lot

comment:8 follow-up: Changed 3 years ago by anonymous

The patch proposed at comment:5 was committed to trunk.

But, backport of that commit to BB branch is still pending...

comment:9 in reply to: ↑ 8 ; follow-up: Changed 3 years ago by skonvols2k

Replying to anonymous:

The patch proposed at comment:5 was committed to trunk.

But, backport of that commit to BB branch is still pending...

Hi, which package is update this patch: xmail, uclibcxx and/or others?
I cannot find on http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages xmail package (on BB there is a oldpackages folder that in trunk isn't).

If only uclibcxx was involved i would like to try install the package from Trunk in BB, do you think is possible?

Thanks
Regards

comment:10 in reply to: ↑ 9 Changed 3 years ago by anonymous

Replying to skonvols2k:

Replying to anonymous:

The patch proposed at comment:5 was committed to trunk.

But, backport of that commit to BB branch is still pending...

Hi, which package is update this patch: xmail, uclibcxx and/or others?
I cannot find on http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages xmail package (on BB there is a oldpackages folder that in trunk isn't).

If only uclibcxx was involved i would like to try install the package from Trunk in BB, do you think is possible?

Thanks
Regards

The patch at comment:5 is against uclibc (which is packaged as libc_0.9.33.2-1_<platform_name>.ipk). But the patch only fixes architecture-specific EFD_* flags, so trying to install the libc package from trunk to BB does not do the trick (aside for any potential ABI incompatibilities which can leave the system unusable), as flags/macros are hardcoded into any programs/libraries which use them, in this specific case the XMail executable (still broken on BB branch).

So, the most straight option for now (as no packages from oldpackages feed are built as snapshots) is compiling the xmail package (which must be patched first with the patch at 1st. attachment) with the BB SDK.

Replying to anonymous:

The patch proposed at comment:5 was committed to trunk.

But, backport of that commit to BB branch is still pending...

BB branch was released (14.07), and as a release, only critical/security fixes are being applied by the devs (e.g. hostapd CVE-2014-3686 fixes). Non-critical fixes are likely to be applied on future releases (perhaps 14.07.1).

comment:11 Changed 3 years ago by skonvols2k

Hi,
i compiled with patch at 1st. attachment but still not working, some one was able to obtain a working ipk for ar71xx and can share his ipk and/or the method to obtain it compiling?
Thanks

Changed 3 years ago by НКВД

xmail package (with eventfd support) built using barrier breaker (14.07) sdk.

Changed 3 years ago by НКВД

Fix eventfd(2) support detection at compile time.

Changed 3 years ago by НКВД

Includes both "xmail_fix_eventfd_initialization" and "xmail_fix_eventfd_support_detection" patches.

comment:12 Changed 3 years ago by НКВД

Hi all.

I have uploaded a xmail package (with eventfd(2) support fixed) for ar71xx platform, built using Barrier Breaker (14.07) SDK. See third attachment.

Additionally, I have uploaded a new patch (see fifth attachment), which includes the patch at first attachment (still required due to uClibc shipped with Barrier Breaker SDK having broken eventfd flags for MIPS architecture) plus some Makefile fixes (to avoid eventfd support misdetection, as xmail linux-specific makefile - Makefile.lnx - tries to detect eventfd support by checking for /usr/include/sys/eventfd.h, which is a host-specific header, instead of checking for the SDK-specific sys/eventfd.h header - located at staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/include/ - ).

To build xmail package with the Barrier Breaker (14.07) SDK for ar71xx platform, do the following steps:

# · Download the BB 14.07 SDK tarball for ar71xx (http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2).
# · Uncompress it.
# · cd to the SDK folder.
# · Download openwrt's xmail package definition from SVN (putting it in the package/ folder):
svn co svn://svn.openwrt.org/openwrt/packages/mail/xmail package/xmail
# · Download the patch at fifth attachment (named "xmail_eventfd_fixes.patch"):
wget --no-check-certificate https://dev.openwrt.org/raw-attachment/ticket/16679/xmail_eventfd_fixes.patch
# · Apply the patch:
cat xmail_eventfd_fixes.patch | patch -N -p0
# Note: After applying this patch, you should have two new patches at package/xmail/patches/ folder:
#     060-fix_eventfd_initialization.patch
#     070-fix_eventfd_support_detection.patch
# · Build the package.

comment:13 Changed 3 years ago by skonvols2k

Thanks a lot НКВД !!!

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.