Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 294470 - [PATCH] sys-libs/glibc-2.11: SOCK_CLOEXEC and SOCK_NONBLOCK definitions incorrect on hppa
Summary: [PATCH] sys-libs/glibc-2.11: SOCK_CLOEXEC and SOCK_NONBLOCK definitions incor...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on: 301642 307651
Blocks: 297452
  Show dependency tree
 
Reported: 2009-11-24 19:24 UTC by Tobias Klausmann (RETIRED)
Modified: 2010-06-29 05:36 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
1. patch to create bits/socket.h on alpha (0001-Create-bits-socket.h-for-alpha-correct-SOCK_CLOEXEC-.patch,14.41 KB, patch)
2010-04-14 17:38 UTC, Matt Turner
Details | Diff
2. patch to add missing pieces to bits/socket.h on alpha (0002-Really-commit-intended-version-of-Alpha-bits-socket..patch,2.46 KB, patch)
2010-04-14 17:39 UTC, Matt Turner
Details | Diff
3. patch to fix SOCK_CLOEXEC on hppa (0001-Fix-SOCK_CLOEXEC-on-HPPA-to-match-O_CLOEXEC.patch,499 bytes, patch)
2010-04-14 17:39 UTC, Matt Turner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Klausmann (RETIRED) gentoo-dev 2009-11-24 19:24:15 UTC
I recently updated to udev udev-147 and during boot, udev startup failed with:

Nov 24 20:07:54 sheldon udevd[12139]: error getting socket: Invalid argument
Nov 24 20:07:54 sheldon udevd[12139]: error initializing netlink socket

So I updated to 147-r1 - same problem. Backdating to current stable on alpha (146-r1) makes it work again, so it's probably not a setup/config problem. This might be alpha specific since I can't reproduce the error with my amd64 workstation.

If this is a kernel config problem, it's non-obvious what I did wrong.
Comment 1 Rafał Mużyło 2009-11-24 23:43:59 UTC
There's very little of your info, but
this can be related to the use of SOCK_CLOEXEC.
So, what's your glib/kernel/kernel headers version ?
Comment 2 Tobias Klausmann (RETIRED) gentoo-dev 2009-11-25 19:49:36 UTC
(sorry, I was sure I had included emerge --info)

$ uname -a
Linux sheldon 2.6.31.3 #1 Sun Oct 11 15:37:38 CEST 2009 alpha EV68AL Nautilus GNU/Linux
$ eix -Iec glib 
[I] dev-libs/glib (2.22.2(2)@11/22/09): The GLib library of C routines
$ eix -Iec linux-headers
[I] sys-kernel/linux-headers (2.6.30-r1@08/09/09): Linux system headers
$ emerge --info
Portage 2.1.7.6 (default/linux/alpha/10.0, gcc-4.3.4, glibc-2.10.1-r1, 2.6.31.3 alpha)
=================================================================
System uname: Linux-2.6.31.3-alpha-EV68AL-with-gentoo-2.0.1
Timestamp of tree: Tue, 24 Nov 2009 18:45:01 +0000
distcc 3.1 alpha-unknown-linux-gnu [enabled]
app-shells/bash:     4.0_p35
dev-java/java-config: 2.1.9-r1
dev-lang/python:     2.4.6, 2.5.4-r3, 2.6.4, 2.7_pre20091122, 3.1.1-r1
dev-python/pycrypto: 2.1.0_beta1
dev-util/cmake:      2.6.4-r3
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.5.2-r2
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.10.2, 1.11
sys-devel/binutils:  2.20
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="alpha ~alpha"
ACCEPT_LICENSE="* -@EULA"
CBUILD="alpha-unknown-linux-gnu"
CFLAGS="-mieee -pipe -O2 -mcpu=ev67"
CHOST="alpha-unknown-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-mieee -pipe -O2 -mcpu=ev67"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests distcc distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans usepkg userfetch"
GENTOO_MIRRORS="http://gentoo.tiscali.nl/ http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/python"
SYNC="rsync://rsync5.de.gentoo.org/gentoo-portage"
USE="X acl alpha alsa apache2 audiofile bash-completion berkdb bmp bzip2 calendar cdparanoia cdr cli cracklib crypt dio dri encode ethereal exif ffmpeg fftw firefox flac fortran ftp gdbm gpm iconv imlib2 jpeg kdeenablefinal libcaca lua mad matroska mmap mng modules moznocompose moznoirc moznomail mozsvg mpeg mudflap ncurses network-cron nls nptl nptlonly offensive ogg pam pcre pdflib perl png pnm ppds pppd python rar readline recode reflection session sharedmem sockets sox spl ssl svg sysfs szip tcpd tetex theora truetype unicode usb v4l v4l2 vcd vidix vim vim-pager vlm vorbis xcb xorg xosd xpm xvid zlib" ALSA_CARDS="ali5451 als4000 bt87x ca0106 cmipci emu10k1 ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 maestro3 trident usb-audio via82xx ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="vga glint mga nvidia vesa r128 " 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 Tobias Klausmann (RETIRED) gentoo-dev 2009-11-25 19:57:37 UTC
I've also noticed this during build:

CCLD   udev/udevadm
udev/udev-watch.o: In function `udev_watch_init':
(.text+0x8b8): warning: warning: inotify_init1 is not implemented and will always fail
udev/udev-watch.o: In function `udev_watch_init':
(.text+0x8b8): warning: warning: inotify_init1 is not implemented and will always fail
Making all in libudev/docs

Comment 4 Rafał Mużyło 2009-11-25 22:38:32 UTC
Right, it's arch problem:
there are results if you search for it in
kernel tree under arch/x86, but not in arch/alpha.

Should this be considered udev upstream bug ?
Comment 5 Tobias Klausmann (RETIRED) gentoo-dev 2009-11-26 08:39:39 UTC
I'd say so: either the udev guys rely on something that isn't available in every kernel or the kernel guys implemented only half of a new feature...
Comment 6 Tobias Klausmann (RETIRED) gentoo-dev 2009-11-26 08:40:18 UTC
Also, I'll mask >=udev-147 on alpha until this is fixed.
Comment 7 Tobias Klausmann (RETIRED) gentoo-dev 2009-11-28 10:56:58 UTC
Not this email exchange:

http://lists.debian.org/debian-devel/2009/11/msg00466.html

So apparently, future version might be fixed. I'll keep an eye on it.
Comment 8 Matthias Schwarzott gentoo-dev 2009-12-05 17:27:30 UTC
udev-149 is in tree, but I doubt it fixes this bug.
If you have a tested patch to be applied, please attach it here.
Comment 9 Tobias Klausmann (RETIRED) gentoo-dev 2009-12-06 13:46:37 UTC
I just tested udev-149 (no patch) and it failed exactly the same way.

So we have to either wait until someone implements that syscall or do it ourselves (my kernel-fu is way to weak to do that).
Comment 10 Matthias Schwarzott gentoo-dev 2009-12-06 13:57:11 UTC
If the linked debian page is right, it could work to change the inotify_init1(IN_CLOEXEC) to code like this:

inotify_fd = inotify_init1(IN_CLOEXEC);
if (inotify_fd < 0) { /* better condition needed, maybe errno == ENOSYS */
  /* fallback to inotify_init */
  inotify_fd = inotify_init();
  if (inotify_fd >= 0)
    util_set_fd_cloexec(inotify_fd);
}
if (inotify_fd < 0)
  err(udev, "inotify_init failed: %m\n");
Comment 11 Matt Turner gentoo-dev 2009-12-24 00:40:30 UTC
The inotify_init1 syscall glue is in 2.6.33. I just tried a kernel with this in it, and patched linux-headers to have the correct defines in asm/unistd.h, but no luck.

 * Mounting /dev ...                                                      [ ok ]
 * Starting udevd ...udevd[488]: error getting socket: Invalid argument

error initializing netlink socket
udevd[488]: error initializing netlink socket

                                                     [ !! ]
No /sbin/udevd found running; none killed.
 * Mounting devpts at /dev/pts ...                                        [ ok ]
 * Checking root filesystem ...fsck.ext3: No such file or directory while trying to open /dev/sda1
/dev/sda1: 
The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>


 * Filesystem couldn't be fixed :(
                                                                          [ !! ]
Comment 12 Tobias Klausmann (RETIRED) gentoo-dev 2009-12-24 08:08:17 UTC
Note that you don't have to install udev to see if it's broken: The linker warns about the absence of said syscall during build time (near the end, so it's easy to find).
Comment 13 Jeroen Roovers (RETIRED) gentoo-dev 2010-04-05 13:08:34 UTC
Same for HPPA. Didn't notice that before.

elmer ~ # /etc/init.d/udev restart
 * WARNING: you are stopping a sysinit service
 * Caching service dependencies ...                                               [ ok ]
 * Stopping udevd ...
 * start-stop-daemon: no matching processes found                                 [ ok ]
 * Starting udevd ...
error initializing netlink socket
 * start-stop-daemon: failed to start `/sbin/udevd'                               [ !! ]
 * start-stop-daemon: no matching processes found
 * ERROR: udev failed to start
Comment 14 Matt Turner gentoo-dev 2010-04-05 14:14:27 UTC
The problem is that the SOCK_CLOEXEC values in glibc didn't match the kernel.

I've fixed it for Alpha and HPPA, and confirmed that udev does run on Alpha with a fixed glibc.

Relevant commits are 

HPPA
http://sourceware.org/git/?p=glibc-ports.git;a=commit;h=fa1b9bae63e87161783dafaf3187251901216bad
http://sourceware.org/git/?p=glibc-ports.git;a=commit;h=f3ed03373affbd13ee8dbbeb933959381ae492bb

Alpha
http://sourceware.org/git/?p=glibc-ports.git;a=commit;h=0b37400ae41a175fa7f89bdf5411ff5d297e5ae4
http://sourceware.org/git/?p=glibc-ports.git;a=commit;h=b6c131119cff4a2a11f1766132f306464d9457da

SOCK_NONBLOCK was also broken on Alpha. I don't remember if it was right on HPPA. 
Comment 15 Matt Turner gentoo-dev 2010-04-14 17:38:23 UTC
Created attachment 227781 [details, diff]
1. patch to create bits/socket.h on alpha
Comment 16 Matt Turner gentoo-dev 2010-04-14 17:39:20 UTC
Created attachment 227783 [details, diff]
2. patch to add missing pieces to bits/socket.h on alpha
Comment 17 Matt Turner gentoo-dev 2010-04-14 17:39:42 UTC
Created attachment 227785 [details, diff]
3. patch to fix SOCK_CLOEXEC on hppa
Comment 18 Matt Turner gentoo-dev 2010-05-11 20:44:00 UTC
OK, so once glibc-2.12 (it contains these patches) is in the tree, we can have >=udev-147 depend on it, and we can remove the mask.
Comment 19 Matt Turner gentoo-dev 2010-06-05 17:28:04 UTC
Ugh, I thought I'd reassigned this to toolchain a long time ago and that you guys were just ignoring us. Turns out it was my fault. :)
Comment 20 SpanKY gentoo-dev 2010-06-05 20:14:13 UTC
i thought we already added the fix for alpha

hppa doesnt even build with glibc-2.11, so no regression there
Comment 21 Matt Turner gentoo-dev 2010-06-05 21:23:56 UTC
Looks like you're right. I'm entirely out of it it seems.

So >=udev-147 can be unmasked on alpha, and depend on >=glibc-2.11.1.

Going to remove myself and alpha@ from CC before I do some damage. :)
Comment 22 SpanKY gentoo-dev 2010-06-08 04:21:54 UTC
added 1508_all_glibc-2.11-hppa-SOCK_CLOEXEC.patch to the glibc-2.11.2 patchset; not that it matters too much till Bug 301642 is fixed ...
Comment 23 Matt Turner gentoo-dev 2010-06-28 21:59:26 UTC
Ugh. 6028_all_alpha-fix-SOCK_NONBLOCK.patch is wrong. I'm not sure what happened here, but it's got the wrong SOCK_CLOEXEC definition.

Please kill it and add the first two patches I've attached to replace it.
Comment 24 SpanKY gentoo-dev 2010-06-29 05:36:49 UTC
this bug is for hppa only.  we already have an alpha-specific bug 307651, so there is no value in re-opening multiple bugs.