linux-um archives
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Vitaliy Ivanov <vitalivanov@gmail.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/4] um: Fix _FORTIFY_SOURCE=2 support for kernel modules
Date: Wed, 29 Jun 2011 17:42:23 +0200	[thread overview]
Message-ID: <201106291742.24137.richard@nod.at> (raw)
In-Reply-To: <BANLkTikauFJtuCo5E3=tb_=cwVS3sF35zw@mail.gmail.com>

Am Mittwoch 29 Juni 2011, 17:37:54 schrieb Vitaliy Ivanov:
> On Tue, Jun 28, 2011 at 1:15 AM, Richard Weinberger <richard@nod.at> wrote:
> > When UML is compiled with _FORTIFY_SOURCE we have to
> > export all _chk() functions which are used in modules.
> > For now it's only the case for __sprintf_chk().
> > 
> > Tested-by: Florian Fainelli <florian@openwrt.org>
> > Reported-by: Florian Fainelli <florian@openwrt.org>
> > Signed-off-by: Richard Weinberger <richard@nod.at>
> > ---
> >  arch/um/os-Linux/user_syms.c |    5 +++++
> >  1 files changed, 5 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c
> > index 05f5ea8..45ffe46 100644
> > --- a/arch/um/os-Linux/user_syms.c
> > +++ b/arch/um/os-Linux/user_syms.c
> > @@ -113,3 +113,8 @@ EXPORT_SYMBOL(__stack_smash_handler);
> > 
> >  extern long __guard __attribute__((weak));
> >  EXPORT_SYMBOL(__guard);
> > +
> > +#ifdef _FORTIFY_SOURCE
> > +extern int __sprintf_chk(char *str, int flag, size_t strlen, const char
> > *format); +EXPORT_SYMBOL(__sprintf_chk);
> > +#endif
> > --
> 
> Can you please clarify why it's needed? I use FORTIFY_SOURCES on
> Linus' tree UML on Ubuntu w/ no problems and w/o this patch...

The problem appears only when a UML kernel module is using sprintf().
E.g: CONFIG_UML_WATCHDOG.
Then loading the module will fail because of the missing symbol __sprintf_chk().

Thanks,
//richard

  reply	other threads:[~2011-06-29 15:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-27 22:15 [uml-devel] [PATCH 1/4] um: Fix _FORTIFY_SOURCE=2 support for kernel modules Richard Weinberger
2011-06-27 22:15 ` [uml-devel] [PATCH 2/4] um: Add netpoll support Richard Weinberger
2011-06-27 22:15 ` [uml-devel] [PATCH 3/4] um, exec: remove redundant set_fs(USER_DS) Richard Weinberger
2011-06-27 22:15 ` [PATCH 4/4] um: Reinstate kernel version in generated .config Richard Weinberger
2011-06-29 15:37 ` [PATCH 1/4] um: Fix _FORTIFY_SOURCE=2 support for kernel modules Vitaliy Ivanov
2011-06-29 15:42   ` Richard Weinberger [this message]
2011-06-29 16:33     ` Vitaliy Ivanov
2011-06-29 16:42     ` Geert Uytterhoeven
2011-06-29 16:57       ` Richard Weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201106291742.24137.richard@nod.at \
    --to=richard@nod.at \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    --cc=vitalivanov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox