Hi all,
On a RS/6000 43P-150 (32bit PPC CHRP) box I was compiling zaptel (the drivers that are part of the Asterisk project) and saw the following warnings & error messages:
CC [M] /home/patrick/redhat/BUILD/zaptel-1.2.4/ztdummy.o Building modules, stage 2. MODPOST *** Warning: "__stack_chk_fail" [/home/patrick/redhat/BUILD/zaptel-1.2.4/ztdynamic.ko] undefined! *** Warning: "__stack_chk_fail" [/home/patrick/redhat/BUILD/zaptel-1.2.4/ztd-eth.ko] undefined! *** Warning: "__stack_chk_fail" [/home/patrick/redhat/BUILD/zaptel-1.2.4/zaptel.ko] undefined! *** Warning: "__stack_chk_fail" [/home/patrick/redhat/BUILD/zaptel-1.2.4/wcusb.ko] undefined! *** Warning: "__stack_chk_fail" [/home/patrick/redhat/BUILD/zaptel-1.2.4/wcte11xp.ko] undefined! *** Warning: "__stack_chk_fail" [/home/patrick/redhat/BUILD/zaptel-1.2.4/wctdm24xxp.ko] undefined! *** Warning: "__stack_chk_fail" [/home/patrick/redhat/BUILD/zaptel-1.2.4/wctdm.ko] undefined! *** Warning: "__stack_chk_fail" [/home/patrick/redhat/BUILD/zaptel-1.2.4/wct4xxp.ko] undefined! *** Warning: "__stack_chk_fail" [/home/patrick/redhat/BUILD/zaptel-1.2.4/pciradio.ko] undefined!
RPM builds fine though.
When I modprobe the zaptel module I get:
[root@box ~]# modprobe -v zaptel insmod /lib/modules/2.6.15-1.1955_FC5/extra/zaptel.ko FATAL: Error inserting zaptel (/lib/modules/2.6.15-1.1955_FC5/extra/zaptel.ko): Unknown symbol in module, or unknown parameter (see dmesg)
[root@box ~]# dmesg | grep zaptel zaptel: Unknown symbol __stack_chk_fail zaptel: Unknown symbol __stack_chk_fail
One of the developers of Asterisk told me it is cause by -fstack-protector. This indeed shows up during the compilation of the zaptel kernel modules.
A sugesstion was to turn off -fstack-protector. Anyone have a hint how I do that in e.g. the rpm spec file?
Thanks and regards, Patrick
Patrick said:
One of the developers of Asterisk told me it is cause by -fstack-protector. This indeed shows up during the compilation of the zaptel kernel modules.
A sugesstion was to turn off -fstack-protector. Anyone have a hint how I do that in e.g. the rpm spec file?
One way is to add "-fno-stack-protector" to the compiler flags (e.g., %{optflags} or $RPM_OPT_FLAGS for rpm's building tools).
Of course, another (probably more secure) way is to patch the code so that it works with the stack-protector. :-P
~~Peter
One of the developers of Asterisk told me it is cause by -fstack-protector. This indeed shows up during the compilation of the zaptel kernel modules.
A sugesstion was to turn off -fstack-protector. Anyone have a hint how I do that in e.g. the rpm spec file?
if this rpm is using RPM cflags to build kernel modules it's terminally broken..... kernel modules HAVE to use the EXACT flags the kernel provides, but that is fully automatic if you have a "correct" 2.6 module makefile (see Documentation/kbuild/ for details)
Arjan van de Ven said:
if this rpm is using RPM cflags to build kernel modules it's terminally broken..... kernel modules HAVE to use the EXACT flags the kernel provides, but that is fully automatic if you have a "correct" 2.6 module makefile (see Documentation/kbuild/ for details)
Oh that's right. I completely forgot about kbuild. Please ignore my previous "solution" then. :oops:
~~Peter
On Wed, 2006-02-22 at 20:25 +0100, Arjan van de Ven wrote:
One of the developers of Asterisk told me it is cause by -fstack-protector. This indeed shows up during the compilation of the zaptel kernel modules.
A sugesstion was to turn off -fstack-protector. Anyone have a hint how I do that in e.g. the rpm spec file?
if this rpm is using RPM cflags to build kernel modules it's terminally broken..... kernel modules HAVE to use the EXACT flags the kernel provides, but that is fully automatic if you have a "correct" 2.6 module makefile (see Documentation/kbuild/ for details)
Thanks for the input. I may be a bit in over my head since I'm not exactly sure what you mean. Fwiw compilation of the zaptel modules works fine on FC4. Afaict the flags used in the zaptel Makefile are:
CFLAGS+=-I. $(RPM_OPT_FLAGS) -Wall -DBUILDING_TONEZONE LCFLAGS=-fPIC $(CFLAGS) -DBUILDING_TONEZONE KFLAGS=-I$(KINCLUDES) -O6 KFLAGS+=-DMODULE -D__KERNEL__ -DEXPORT_SYMTAB -I$(KSRC)/drivers/net \ -Wall -I. -Wstrict-prototypes -fomit-frame-pointer -I $(KSRC)/drivers/net/wan -I$(KINCLUDES)/net ifneq (,$(wildcard $(KINCLUDES)/linux/modversions.h)) KFLAGS+=-DMODVERSIONS -include $(KINCLUDES)/linux/modversions.h endif KFLAGS_PPC:=$(shell if uname -m | grep -q ppc; then echo "-msoft-float -fsigned-char"; fi) KFLAGS+=$(KFLAGS_PPC) KFLAGS+=$(shell if uname -r | grep -q 2.4; then if uname -m | grep -q x86_64; then echo "-mcmodel=kernel"; fi; fi)
Is there anything in here that needs fixing or would the solution be something way more elaborate?
Thanks and regards, Patrick
On Wed, 2006-02-22 at 23:13 +0100, Patrick wrote:
On Wed, 2006-02-22 at 20:25 +0100, Arjan van de Ven wrote:
One of the developers of Asterisk told me it is cause by -fstack-protector. This indeed shows up during the compilation of the zaptel kernel modules.
A sugesstion was to turn off -fstack-protector. Anyone have a hint how I do that in e.g. the rpm spec file?
if this rpm is using RPM cflags to build kernel modules it's terminally broken..... kernel modules HAVE to use the EXACT flags the kernel provides, but that is fully automatic if you have a "correct" 2.6 module makefile (see Documentation/kbuild/ for details)
Thanks for the input. I may be a bit in over my head since I'm not exactly sure what you mean. Fwiw compilation of the zaptel modules works fine on FC4. Afaict the flags used in the zaptel Makefile are:
CFLAGS+=-I. $(RPM_OPT_FLAGS) -Wall -DBUILDING_TONEZONE LCFLAGS=-fPIC $(CFLAGS) -DBUILDING_TONEZONE KFLAGS=-I$(KINCLUDES) -O6 KFLAGS+=-DMODULE -D__KERNEL__ -DEXPORT_SYMTAB -I$(KSRC)/drivers/net \ -Wall -I. -Wstrict-prototypes -fomit-frame-pointer -I $(KSRC)/drivers/net/wan -I$(KINCLUDES)/net ifneq (,$(wildcard $(KINCLUDES)/linux/modversions.h)) KFLAGS+=-DMODVERSIONS -include $(KINCLUDES)/linux/modversions.h endif KFLAGS_PPC:=$(shell if uname -m | grep -q ppc; then echo "-msoft-float -fsigned-char"; fi) KFLAGS+=$(KFLAGS_PPC) KFLAGS+=$(shell if uname -r | grep -q 2.4; then if uname -m | grep -q x86_64; then echo "-mcmodel=kernel"; fi; fi)
Is there anything in here that needs fixing or would the solution be something way more elaborate?
yes this is horked beyond belief and will lead to major miscompiles (this will not generate correct modules even on x86, and is incorrect in so many ways it's just not funny anymore).
just delete all of this; a kernel module makefile should be 1 or 2 lines or so, maybe another example:
http://marc.theaimsgroup.com/?l=linux-ia64&m=105676403229397&w=2