Bug 223051 - net-proxy/squid will not work when compiled against >=sys-kernel/linux-headers-2.6.25
Bug#: 223051 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: net-proxy@gentoo.org Reported By: phantom4@gmx.net
Component: Ebuilds
URL: 
Summary: net-proxy/squid will not work when compiled against >=sys-kernel/linux-headers-2.6.25
Keywords:  
Status Whiteboard: 
Opened: 2008-05-21 12:10 0000
Description:   Opened: 2008-05-21 12:10 0000
sys-kernel/linux-headers-2.6.25 and up changed _LINUX_CAPABILITY_VERSION.
As a result, if squid (2 and 3) is compiled against those headers, it will not
be usable (although it will compile without complaining).

Recompiling squid with sys-kernel/linux-headers-2.6.24 solves the
problem.

Maybe it's a duplicate of Bug 221971.


Reproducible: Always

Steps to Reproduce:
1. compile squid with >=sys-kernel/linux-headers-2.6.25
2. start squid

Actual Results:  
/etc/init.d/squid start
 * Initializing cache directories ...
*** glibc detected *** /usr/sbin/squid: free(): invalid next size (fast):
0x088659b0 ***
======= Backtrace: =========
/lib/libc.so.6[0xb7c0f7ff]
/lib/libc.so.6(cfree+0x89)[0xb7c114f9]
/usr/sbin/squid[0x81244e2]
======= Memory map: ========
...

------- Comment #1 From Jochen Schlick 2008-05-22 16:04:20 0000 -------
after a world rebuild I had the same problem

sys-kernel/linux-headers-2.6.25-r3

------- Comment #2 From Alin Năstac 2008-05-25 20:08:12 0000 -------
Did you guys tried to recompile glibc after you installed the new version of
linux-headers?

------- Comment #3 From Per Pomsel 2008-05-26 05:47:42 0000 -------
Yes, I tried to recompile glibc after I installed the new version of
linux-headers. It doesn't solve the problem.
Installing sys-kernel/linux-headers-2.6.24 without recompiling glibc fixed it.

------- Comment #4 From Martin von Gagern 2008-05-27 01:58:09 0000 -------
Trying to valgrind or mudflap this issue, I found two upstream bugs:
http://www.squid-cache.org/bugs/show_bug.cgi?id=2350
http://www.squid-cache.org/bugs/show_bug.cgi?id=2359

Neither of these solved the issue, though. Both valgrind and mudflap cause
squid to start up without this glibc error message. There are some
uninitialized writes in valgrind, and mudflap keeps complaining about
CurrentDebug for reasons unknown, but I have no clue what all this has to do
with the linux headers.

------- Comment #5 From Alin Năstac 2008-05-27 22:19:04 0000 -------
Hmm... I cannot reproduce the bug.

Steps I did:
  - emerge =sys-kernel/linux-headers-2.6.25-r3
  - set CFLAGS=-g and FEATURES=nostrip
  - emerge =squid-2.6.20
  - rm -rf /var/cache/squid/*
  - /etc/init.d/squid start
  - echo success

Probably I would have to re-emerge glibc for reproducing it.

------- Comment #6 From Martin von Gagern 2008-05-28 13:37:53 0000 -------
I compiled against both 2.6.24 and 2.6.25-r3, disassembled all object files,
and compared the resulting assembly code. The only relevant difference was in
src/tools.o and resulted from a different value for _LINUX_CAPABILITY_VERSION.

This reminded me of a comment I had read in an upstream post, and in fact,
http://www.squid-cache.org/bugs/show_bug.cgi?id=2350#c3 comment 3 mentions an
issue with that constant while comment 4 contains a patch to fix it.

So with both patches from the attachments of upstream bug 2350 in place, squid
compiles and starts cleanly with sys-kernel/linux-headers-2.6.25-r3.
Please add these patches to a new revision of the squid ebuild to close this.

------- Comment #7 From Martin von Gagern 2008-05-28 13:47:30 0000 -------
(In reply to comment #0)
> Maybe it's a duplicate of Bug 221971.

Yes, it is the same reason, the value of _LINUX_CAPABILITY_VERSION. If I had
read that before, I might perhaps have saved some time. On the other hand,
diffing assembly code of whole projects was a new experience, and the upstream
report is still useful for the actual fix. And maybe bug 221971 can profit from
these findings.

------- Comment #8 From Alin Năstac 2008-05-28 19:51:37 0000 -------
Fixed in squid-2.6.20-r1 and squid-3.0.6-r1. Thanks!

P.S. I still cannot reproduce the bug on squid-2.6.20.