Skip to contentSkip to conversation

um: disable compile-time buffer checks

PATCH In review Florian Fainelli 2 participants 5 messages Jun 12, 2011 – Jun 13, 2011 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 um: disable compile-time buffer checks

From: Nicolas Thill <[email protected]>

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.

---

arch/um/Makefile-os-Linux +3 -0
index 2c8a598..2968e0d 100644
@@ -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\"
Signature · 12 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#1 lore raw

Am Sonntag 12 Juni 2011, 13:14:41 schrieb Florian Fainelli:

Quoted 5 lines

From: Nicolas Thill <[email protected]>

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

Quoted 7 lines
  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 [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#2 lore raw
Quoted 13 lines · Richard Weinberger

Am Sonntag 12 Juni 2011, 13:14:41 schrieb Florian Fainelli:

Quoted 12 lines

From: Nicolas Thill <[email protected]>

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

Quoted 4 lines
Quoted 1 line

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 [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#3 lore raw

Am Sonntag 12 Juni 2011, 23:52:35 schrieb Florian Fainelli:

Quoted 14 lines · Richard Weinberger
Quoted 13 lines

Am Sonntag 12 Juni 2011, 13:14:41 schrieb Florian Fainelli:

Quoted 12 lines

From: Nicolas Thill <[email protected]>

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

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

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

arch/um/os-Linux/user_syms.c +3 -0
index 05f5ea8..9e71e7e 100644
@@ -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);

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#4 lore raw
Quoted 20 lines · Richard Weinberger

Am Sonntag 12 Juni 2011, 23:52:35 schrieb Florian Fainelli:

Quoted 19 lines · Richard Weinberger
Quoted 17 lines

Am Sonntag 12 Juni 2011, 13:14:41 schrieb Florian Fainelli:

Quoted 5 lines

From: Nicolas Thill <[email protected]>

Ubuntu 8.10 and newer enable compile-time buffer checks by default,

which can sometime cause build failures like this:

Quoted 8 lines
  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?

Quoted 7 lines
Quoted 1 line

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 <[email protected] 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 [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel