Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 947613 - net-firewall/iptables >=1.8.11 segfault when adding a rule
Summary: net-firewall/iptables >=1.8.11 segfault when adding a rule
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-06 16:01 UTC by MickKi
Modified: 2025-04-22 15:50 UTC (History)
2 users (show)

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


Attachments
emerge.info (emerge.info,6.77 KB, text/plain)
2025-01-06 16:02 UTC, MickKi
Details
CPU FLAGS (cpuflags.txt,67 bytes, text/plain)
2025-01-06 16:02 UTC, MickKi
Details
Backtrace (gdb.txt,2.32 KB, text/plain)
2025-01-06 16:04 UTC, MickKi
Details
valgrind capture (valgrind.log,11.65 KB, text/x-log)
2025-01-06 16:06 UTC, MickKi
Details
Additional backtrace (backtrace2.txt,2.79 KB, text/plain)
2025-04-06 13:09 UTC, MickKi
Details
iptables-draft-bug.txt (file_947613.txt,4.38 KB, text/plain)
2025-04-17 02:12 UTC, Sam James
Details

Note You need to log in before you can comment on or make changes to this bug.
Description MickKi 2025-01-06 16:01:04 UTC
net-firewall/iptables 1.8.11 and 1.8.11-r1 segfault when invoked as:

/usr/bin/iptables -A HOST_BLOCK_SRC_DROP -m limit --limit 1/m --limit-burst 1 -j LOG --log-level info --log-prefix FW:Blocked inbound host:

Reproducible: Always

Steps to Reproduce:
1.Run "/usr/bin/iptables -A HOST_BLOCK_SRC_DROP -m limit --limit 1/m --limit-burst 1 -j LOG --log-level info --log-prefix FW:Blocked inbound host:"
2.
3.
Actual Results:  
~ # /sbin/iptables -A HOST_BLOCK_SRC_DROP -m limit --limit 1/m --limit-burst 1 -j LOG --log-level info --log-prefix FW:Blocked inbound host:
iptables v1.8.11 (legacy): Segmentation fault
~ # /sbin/ip6tables -A HOST_BLOCK_SRC_DROP -m limit --limit 1/m --limit-burst 1 -j LOG --log-level info --log-prefix FW:Blocked inbound host: 
ip6tables v1.8.11 (legacy): Segmentation fault


The syslog shows:

kernel: iptables[2914]: segfault at 10000000a ip 00007f5f13bbd6da sp 00007ffe57577908 error 4 in libc.so.6[7f5f13b36000+158000] likely on CPU 0 (core 0, socket 0)
kernel: ip6tables[2919]: segfault at 10000000a ip 00007fbdf773e6da sp 00007ffc64202408 error 4 in libc.so.6[7fbdf76b7000+158000] likely on CPU 7 (core 3, socket 0)

net-firewall/iptables =<1.8.10-r1 run with no such problems.
Comment 1 MickKi 2025-01-06 16:02:03 UTC
Created attachment 915994 [details]
emerge.info

emerge --info - attachment.
Comment 2 MickKi 2025-01-06 16:02:55 UTC
Created attachment 915995 [details]
CPU FLAGS

CPU FLAGS - attachment.
Comment 3 MickKi 2025-01-06 16:04:07 UTC
Created attachment 915996 [details]
Backtrace

Backtrace - attachment.
Comment 4 MickKi 2025-01-06 16:06:40 UTC
Created attachment 915997 [details]
valgrind capture

valgrind capture - attachment.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-04-01 00:29:33 UTC
Could you rebuild with more debug info & sources (https://wiki.gentoo.org/wiki/Debugging#Per-package)? Line numbers would be helpful.
Comment 6 MickKi 2025-04-06 13:09:07 UTC
Created attachment 923608 [details]
Additional backtrace

I hope this backtrace has enough information.
Comment 7 MickKi 2025-04-06 13:12:31 UTC
Hi Sam,

(In reply to MickKi from comment #6)
> Created attachment 923608 [details]
> Additional backtrace
> 
> I hope this backtrace has enough information.

I've followed the debugging wiki page, but I am not sure if I've missed anything.  Please let me know what additional info may be required.
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-04-17 02:10:54 UTC
Thanks! I've attempted to report it upstream but their Bugzilla isn't working for me. I've emailed their administrators for help.
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-04-17 02:12:43 UTC
Created attachment 925000 [details]
iptables-draft-bug.txt

Attached my draft text for the upstream bug so I don't lose it.
Comment 10 Phil 2025-04-18 22:36:04 UTC
The crash seems impossible looking at the code. Do you perhaps have a stale DSO in /usr/lib64/xtables/? Could you please paste the output of 'ls /usr/lib64/xtables/lib*_LOG.so'?
Comment 11 MickKi 2025-04-19 06:53:31 UTC
Thank you Phil, I seem to have three files listed:

~ # ls -la /usr/lib64/xtables/lib*_LOG.so
-rwxr-xr-x 1 root root 14616 Nov 20  2022 /usr/lib64/xtables/libip6t_LOG.so
-rwxr-xr-x 1 root root 14616 Nov 20  2022 /usr/lib64/xtables/libipt_LOG.so
-rwxr-xr-x 1 root root 15208 Apr  6 13:58 /usr/lib64/xtables/libxt_LOG.so
Comment 12 MickKi 2025-04-20 20:43:43 UTC
(In reply to MickKi from comment #11)
> Thank you Phil, I seem to have three files listed:
> 
> ~ # ls -la /usr/lib64/xtables/lib*_LOG.so
> -rwxr-xr-x 1 root root 14616 Nov 20  2022 /usr/lib64/xtables/libip6t_LOG.so
> -rwxr-xr-x 1 root root 14616 Nov 20  2022 /usr/lib64/xtables/libipt_LOG.so
> -rwxr-xr-x 1 root root 15208 Apr  6 13:58 /usr/lib64/xtables/libxt_LOG.so

The last file belongs to iptables, but qfile did not come up with any owners for the first two.  I moved these out of the way and the latest iptables version no longer segfaults.

Clearly my segfault problem was caused by these two files and not by an iptables bug.  Thank you for pointing me to the cause of it and sorry for the noise.

Any idea what had left behind libip6t_LOG.so and libipt_LOG.so?
Comment 13 Phil 2025-04-21 07:16:52 UTC
(In reply to MickKi from comment #12)
> (In reply to MickKi from comment #11)
> > Thank you Phil, I seem to have three files listed:
> > 
> > ~ # ls -la /usr/lib64/xtables/lib*_LOG.so
> > -rwxr-xr-x 1 root root 14616 Nov 20  2022 /usr/lib64/xtables/libip6t_LOG.so
> > -rwxr-xr-x 1 root root 14616 Nov 20  2022 /usr/lib64/xtables/libipt_LOG.so
> > -rwxr-xr-x 1 root root 15208 Apr  6 13:58 /usr/lib64/xtables/libxt_LOG.so
> 
> The last file belongs to iptables, but qfile did not come up with any owners
> for the first two.  I moved these out of the way and the latest iptables
> version no longer segfaults.

I'm glad we found the cause.

> Clearly my segfault problem was caused by these two files and not by an
> iptables bug.  Thank you for pointing me to the cause of it and sorry for
> the noise.
> 
> Any idea what had left behind libip6t_LOG.so and libipt_LOG.so?

That's a question for the packager(s). Upstream, we merged libip6t_LOG and libipt_LOG into libxt_LOG at some point. So these should have been removed during an update.
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-04-22 12:25:22 UTC
Thank you very much both of you! I'll ask around but so far, nobody seems to have any idea if there was some historical reason that could've happened.
Comment 15 MickKi 2025-04-22 12:58:53 UTC
Thank you Sam, the only historical reason I can think of is this system was recovered from a failing drive.  Following the recovery the whole @system and @world was rebuilt.  Perhaps some shrapnel was left behind which caused these obsolete files to hang around?  No other systems have come up with this error, which with hindsight makes me conclude this is very much an one off and filesystem specific problem.  Please don't waste any more time on it - I can see you're busy enough as it is!  :-)
Comment 16 Mike Gilbert gentoo-dev 2025-04-22 15:50:36 UTC
(In reply to MickKi from comment #15)

Ah, it is likely that /var/db/pkg was out-of-sync, which caused some files to be orphaned when iptables was reinstalled.