Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 423649 - net-misc/dhcpcd-5.5.6 with ABI=x32 - dhcpcd[1979]: eth0: open_socket: Invalid argument // dhcpcd[1979]: eth0: send_raw_packet: Bad file descriptor
Summary: net-misc/dhcpcd-5.5.6 with ABI=x32 - dhcpcd[1979]: eth0: open_socket: Invalid...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: https://lkml.org/lkml/2012/8/18/152
Whiteboard:
Keywords:
Depends on:
Blocks: x32
  Show dependency tree
 
Reported: 2012-06-26 13:52 UTC by Mads
Modified: 2012-10-01 07:25 UTC (History)
3 users (show)

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


Attachments
My /proc/config.gz from gentoo-sources-3.4.4 (config.gz,15.22 KB, application/gzip)
2012-06-26 13:54 UTC, Mads
Details
strace log (dhcpcd.x32.log,471.79 KB, text/plain)
2012-06-29 18:15 UTC, Mads
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mads 2012-06-26 13:52:59 UTC
Installed the stage3 release candidate and set up a new kernel with support for x32, but I cannot figure out why DHCP won't work.


localhost ~ # dhcpcd eth0
dhcpcd[1979]: version 5.5.6 starting
dhcpcd[1979]: eth0: broadcasting for a lease
dhcpcd[1979]: eth0: open_socket: Invalid argument
dhcpcd[1979]: eth0: send_raw_packet: Bad file descriptor

I've got CONFIG_PACKET enabled:

localhost ~ # zgrep -i -E 'packet|unix' /proc/config.gz 
CONFIG_UNIXWARE_DISKLABEL=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_UNIX_DIAG=y
# CONFIG_NET_PACKET_ENGINE is not set
CONFIG_UNIX98_PTYS=y

localhost ~ # uname -a
Linux localhost 3.4.4-gentoo #1 SMP PREEMPT Tue Jun 26 11:52:25 CEST 2012 x86_64 Intel(R) Core(TM)2 Duo CPU T7100 @ 1.80GHz GenuineIntel GNU/Linux

I have even tested with glibc-9999, but the problem did not disappear. Is there a simple kernel CONFIG I have missed?

dhcpcd is version 5.5.6, the same happens with dhclient from net-misc/dhcp.
Comment 1 Mads 2012-06-26 13:53:18 UTC
localhost ~ # emerge --info
Portage 2.2.0_alpha112 (default/linux/amd64/10.0/x32, gcc-4.7.1, glibc-2.15-r2, 3.4.4-gentoo x86_64)
=================================================================
System uname: Linux-3.4.4-gentoo-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T7100_@_1.80GHz-with-gentoo-2.1
Timestamp of tree: Mon, 25 Jun 2012 19:00:01 +0000
app-shells/bash:          4.2_p29
dev-lang/python:          2.7.3-r2, 3.2.3-r1
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.10.3
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.69
sys-devel/automake:       1.12.1
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.7.1
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.4 (virtual/os-headers)
sys-libs/glibc:           2.15-r2
Repositories: gentoo
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA Oracle-BCLA-JavaSE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=native -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles multilib-strict news parallel-fetch parse-eapi-ebuild-head preserve-libs protect-owned sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en en_US"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="acl amd64 bzip2 cli cracklib crypt cryptsetup cups cxx dbus device-mapper dri fortran gdbm gpm hvm iconv icu lto lzma mmx modules mudflap multilib ncurses nls nptl openmp pam pcre pgo pppd readline session sse sse2 sse3 ssl ssse3 systemd tcpd threads unicode xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem 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 cgi cgid 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" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_US" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 2 Mads 2012-06-26 13:54:36 UTC
Created attachment 316303 [details]
My /proc/config.gz from gentoo-sources-3.4.4
Comment 3 SpanKY gentoo-dev 2012-06-29 04:46:35 UTC
could you strace it and post the log as an attachment ?

strace -f -s 4096 -o log dhcpcd eth0
Comment 4 Mads 2012-06-29 18:15:03 UTC
Created attachment 316641 [details]
strace log

strace -f -s 4096 -o dhcpcd.x32.log dhcpcd eth0
Comment 5 William Hubbs gentoo-dev 2012-07-01 16:15:08 UTC
Hi Roy,

can you take a look at this?

Thanks,

William
Comment 6 SpanKY gentoo-dev 2012-07-01 19:04:11 UTC
i've debugged it a bit.  pretty sure it's a bug in the kernel for the x32 abi.  i'll send a patch to the kernel mailing list for it.
Comment 7 Roy Marples 2012-07-02 08:22:41 UTC
Probably the wrong place to ask but what is x32 and why should dhcpcd care about it?

Thanks for looking into it Mike :)
Comment 8 Diego Elio Pettenò (RETIRED) gentoo-dev 2012-07-02 09:16:28 UTC
Roy it's the a new ABI for x86-64 (http://blog.flameeyes.eu/tag/x32 fwiw).

Basically what could happen in this situation is that it's using the wrong parameters' size when doing syscalls — it's x86-64 with 32-bit long and pointers, but a number of data types are also moved to 64-bit like if LFS was forced on.
Comment 9 William Hubbs gentoo-dev 2012-07-14 22:21:40 UTC
Is there any more information on this bug? Is there a fix or dependency
needed for dhcpcd?

Thanks,

William
Comment 10 nvinson234 2012-08-06 01:41:49 UTC
(In reply to comment #9)
> Is there any more information on this bug? Is there a fix or dependency
> needed for dhcpcd?
> 
> Thanks,
> 
> William

I don't have a fix, but I do have a workaround:

Steps:
1. add '=net-misc/dhcpcd-5.5.6 dhcpcd_amd64' to /etc/portage/package.env
2. add 'CFLAGS="${CFLAGS} -m64"' to /etc/portage/env/dhcpcd_amd64
3. add 'CXXFLAGS="${CXXFLAGS} -m64"' to/etc/portage/env/dhcpcd_amd64
4. add 'LDFLAGS="${LDFLAGS} -Wl,-m,elf_x86_64 -m64"' to /etc/portage/env/dhcpcd_amd64
5. re-emerge dhcpcd

Of course, this forces dhcpcd to use the amd64 ABI, but should be good enough until a fix can be creaated.
Comment 11 Roy Marples 2012-08-06 06:49:23 UTC
Looking @ the strace, the error in question is
setsockopt(11, SOL_SOCKET, SO_ATTACH_FILTER, "\t\0\0\0@[A\0", 8)

So that's basically when we try to install the BPF filter for the interface.
dhclient does the same operation - so does that fail in the same way?
Comment 12 Mads 2012-08-06 07:19:16 UTC
(In reply to comment #11)
> Looking @ the strace, the error in question is
> setsockopt(11, SOL_SOCKET, SO_ATTACH_FILTER, "\t\0\0\0@[A\0", 8)
> 
> So that's basically when we try to install the BPF filter for the interface.
> dhclient does the same operation - so does that fail in the same way?
Yes, it does.
Comment 13 Roy Marples 2012-08-06 09:32:23 UTC
IIRC busybox dhcpc client also implements a BPF filter so testing that would be helpful also.
The only other thing I know of in userland that uses this kind of filtering is tcpdump/wireshark and friends. Can you use basic filtering there?

sudo tcpdump -i eth0 'udp[2:2] == 68'
Comment 14 SpanKY gentoo-dev 2012-08-18 20:13:03 UTC
finally got around to setting a qemu image and testing this out and it's what i thought -- we need the compat syscalls for the x32 api

i've sent the patch upstream.  unfortunately, you'll need to do:
 - apply patch to your kernel
 - apply patch to linux-headers
 - rebuild glibc

then dhcpcd will work
Comment 15 SpanKY gentoo-dev 2012-08-18 20:34:18 UTC
(In reply to comment #14)

err, and obviously rebuild & reboot your kernel
Comment 16 Greg Kubaryk 2012-09-15 21:52:57 UTC
FWIW, the Changelog for Linux kernel 3.5.4 indicates that SpanKY's patch has landed.
Comment 17 SpanKY gentoo-dev 2012-09-27 05:09:30 UTC
upstream has accepted my patches and put into various stable branches.  only thing left is to wait for new versions to be released, and upgrades will fix this automatically.  nothing left to do afaict.
Comment 18 SpanKY gentoo-dev 2012-10-01 05:58:22 UTC
linux-3.6 is out.  if you upgrade your kernel to 3.6, upgrade your linux-headers to 3.6, and then rebuild your glibc against that, things should work for you.
Comment 19 Mads 2012-10-01 07:25:31 UTC
Thanks! Nice work!