All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] [PATCH 2/2] um: disable compile-time buffer checks
@ 2011-06-12 11:14 Florian Fainelli
  2011-06-12 11:56 ` Richard Weinberger
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2011-06-12 11:14 UTC (permalink / raw)
  To: Richard Weinberger, user-mode-linux-devel

From: Nicolas Thill <nico@openwrt.org>

Ubuntu 8.10 and newer enable compile-time buffer checks by default,
which can sometime cause build failures like this:

  LD      vmlinux
  SYSMAP  System.map
  SYSMAP  .tmp_System.map
  LINK linux
  Building modules, stage 2.
  MODPOST 51 modules
ERROR: "__sprintf_chk" [arch/um/drivers/harddog.ko] undefined!

disable compile-time buffer checks to avoid such errors.

Signed-off-by: Nicolas Thill <nico@openwrt.org>
---
diff --git a/arch/um/Makefile-os-Linux b/arch/um/Makefile-os-Linux
index 2c8a598..2968e0d 100644
--- a/arch/um/Makefile-os-Linux
+++ b/arch/um/Makefile-os-Linux
@@ -6,4 +6,7 @@
 # To get a definition of F_SETSIG
 USER_CFLAGS += -D_GNU_SOURCE -D_LARGEFILE64_SOURCE
 KBUILD_CFLAGS += -D_LARGEFILE64_SOURCE
+# disable compile-time buffer checks, enabled by default on Ubuntu 8.10
+# and later
+KBUILD_CFLAGS += $(call cc-option,-U_FORTIFY_SOURCE)
 DEV_NULL_PATH = \"/dev/null\"
-- 
1.7.4.1


------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [uml-devel] [PATCH 2/2] um: disable compile-time buffer checks
  2011-06-12 11:14 [uml-devel] [PATCH 2/2] um: disable compile-time buffer checks Florian Fainelli
@ 2011-06-12 11:56 ` Richard Weinberger
  2011-06-12 21:52   ` Florian Fainelli
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2011-06-12 11:56 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: nico, user-mode-linux-devel

Am Sonntag 12 Juni 2011, 13:14:41 schrieb Florian Fainelli:
> From: Nicolas Thill <nico@openwrt.org>
> 
> Ubuntu 8.10 and newer enable compile-time buffer checks by default,
> which can sometime cause build failures like this:
> 
>   LD      vmlinux
>   SYSMAP  System.map
>   SYSMAP  .tmp_System.map
>   LINK linux
>   Building modules, stage 2.
>   MODPOST 51 modules
> ERROR: "__sprintf_chk" [arch/um/drivers/harddog.ko] undefined!

Hmm, now I'm wondering why no other Ubuntu users have noticed this.
Are also current versions of Ubuntu affected?

Thanks,
//richard

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [uml-devel] [PATCH 2/2] um: disable compile-time buffer checks
  2011-06-12 11:56 ` Richard Weinberger
@ 2011-06-12 21:52   ` Florian Fainelli
  2011-06-12 22:56     ` Richard Weinberger
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2011-06-12 21:52 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: nico, user-mode-linux-devel

Le dimanche 12 juin 2011 13:56:14, Richard Weinberger a écrit :
> Am Sonntag 12 Juni 2011, 13:14:41 schrieb Florian Fainelli:
> > From: Nicolas Thill <nico@openwrt.org>
> > 
> > Ubuntu 8.10 and newer enable compile-time buffer checks by default,
> > 
> > which can sometime cause build failures like this:
> >   LD      vmlinux
> >   SYSMAP  System.map
> >   SYSMAP  .tmp_System.map
> >   LINK linux
> >   Building modules, stage 2.
> >   MODPOST 51 modules
> > 
> > ERROR: "__sprintf_chk" [arch/um/drivers/harddog.ko] undefined!
> 
> Hmm, now I'm wondering why no other Ubuntu users have noticed this.
> Are also current versions of Ubuntu affected?

Without this patch, I get the exact same modpost error on Ubuntu 11.04:

  SYSMAP  System.map
  LINK linux
  Building modules, stage 2.
  MODPOST 39 modules
ERROR: "__sprintf_chk" [arch/um/drivers/harddog.ko] undefined!
make[5]: *** [__modpost] Error 1
make[4]: *** [modules] Error 2
--
Florian

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [uml-devel] [PATCH 2/2] um: disable compile-time buffer checks
  2011-06-12 21:52   ` Florian Fainelli
@ 2011-06-12 22:56     ` Richard Weinberger
  2011-06-13 12:39       ` Florian Fainelli
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2011-06-12 22:56 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: nico, user-mode-linux-devel

[-- Attachment #1: Type: Text/Plain, Size: 1098 bytes --]

Am Sonntag 12 Juni 2011, 23:52:35 schrieb Florian Fainelli:
> Le dimanche 12 juin 2011 13:56:14, Richard Weinberger a écrit :
> > Am Sonntag 12 Juni 2011, 13:14:41 schrieb Florian Fainelli:
> > > From: Nicolas Thill <nico@openwrt.org>
> > > 
> > > Ubuntu 8.10 and newer enable compile-time buffer checks by default,
> > > 
> > > which can sometime cause build failures like this:
> > >   LD      vmlinux
> > >   SYSMAP  System.map
> > >   SYSMAP  .tmp_System.map
> > >   LINK linux
> > >   Building modules, stage 2.
> > >   MODPOST 51 modules
> > > 
> > > ERROR: "__sprintf_chk" [arch/um/drivers/harddog.ko] undefined!
> > 
> > Hmm, now I'm wondering why no other Ubuntu users have noticed this.
> > Are also current versions of Ubuntu affected?
> 
> Without this patch, I get the exact same modpost error on Ubuntu 11.04:

Okay, found the real problem.
We have to export the *_chk functions.
Nobody noticed it because most UML kernels are CONFIG_MODULES=n
and harddog.ko is not part of the defaultconfig.

Can you please test the attached patch?

Thanks,
//richard

[-- Attachment #2: test.diff --]
[-- Type: text/x-patch, Size: 561 bytes --]

diff --git a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c
index 05f5ea8..9e71e7e 100644
--- a/arch/um/os-Linux/user_syms.c
+++ b/arch/um/os-Linux/user_syms.c
@@ -18,6 +18,9 @@ extern void *memmove(void *, const void *, size_t);
 extern void *memset(void *, int, size_t);
 extern int printf(const char *, ...);
 
+extern int __sprintf_chk(char *str, int flag, size_t strlen, const char *format);
+EXPORT_SYMBOL(__sprintf_chk);
+
 /* If it's not defined, the export is included in lib/string.c.*/
 #ifdef __HAVE_ARCH_STRSTR
 EXPORT_SYMBOL(strstr);

[-- Attachment #3: Type: text/plain, Size: 318 bytes --]

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev

[-- Attachment #4: Type: text/plain, Size: 194 bytes --]

_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [uml-devel] [PATCH 2/2] um: disable compile-time buffer checks
  2011-06-12 22:56     ` Richard Weinberger
@ 2011-06-13 12:39       ` Florian Fainelli
  0 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2011-06-13 12:39 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: nico, user-mode-linux-devel

Le lundi 13 juin 2011 00:56:12, Richard Weinberger a écrit :
> Am Sonntag 12 Juni 2011, 23:52:35 schrieb Florian Fainelli:
> > Le dimanche 12 juin 2011 13:56:14, Richard Weinberger a écrit :
> > > Am Sonntag 12 Juni 2011, 13:14:41 schrieb Florian Fainelli:
> > > > From: Nicolas Thill <nico@openwrt.org>
> > > > 
> > > > Ubuntu 8.10 and newer enable compile-time buffer checks by default,
> > > > 
> > > > which can sometime cause build failures like this:
> > > >   LD      vmlinux
> > > >   SYSMAP  System.map
> > > >   SYSMAP  .tmp_System.map
> > > >   LINK linux
> > > >   Building modules, stage 2.
> > > >   MODPOST 51 modules
> > > > 
> > > > ERROR: "__sprintf_chk" [arch/um/drivers/harddog.ko] undefined!
> > > 
> > > Hmm, now I'm wondering why no other Ubuntu users have noticed this.
> > > Are also current versions of Ubuntu affected?
> > 
> > Without this patch, I get the exact same modpost error on Ubuntu 11.04:
> Okay, found the real problem.
> We have to export the *_chk functions.
> Nobody noticed it because most UML kernels are CONFIG_MODULES=n
> and harddog.ko is not part of the defaultconfig.
> 
> Can you please test the attached patch?

Your patch works, thank you!

Feel free to add my Testbed-by: Florian Fainelli <florian@openwrt.org to the 
final patch.
--
Florian

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-06-13 12:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-12 11:14 [uml-devel] [PATCH 2/2] um: disable compile-time buffer checks Florian Fainelli
2011-06-12 11:56 ` Richard Weinberger
2011-06-12 21:52   ` Florian Fainelli
2011-06-12 22:56     ` Richard Weinberger
2011-06-13 12:39       ` Florian Fainelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.