From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 2/4] usb/gadget: fastboot: add eMMC support for flash command
Date: Thu, 7 Aug 2014 19:12:59 +0200 [thread overview]
Message-ID: <201408071912.59133.marex@denx.de> (raw)
In-Reply-To: <53E3AEDC.5080305@broadcom.com>
On Thursday, August 07, 2014 at 06:52:44 PM, Steve Rae wrote:
[...]
> >> I was referring to what you mention below...
> >>
> >> 852 - Safe printf() functions
> >> 853 Define CONFIG_SYS_VSNPRINTF to compile in safe versions of
> >> 854 the printf() functions. These are defined in
> >> 855 include/vsprintf.h and include snprintf(), vsnprintf() and
> >> 856 so on. Code size increase is approximately 300-500 bytes.
> >> 857 If this option is not given then these functions will
> >> 858 silently discard their buffer size argument - this means
> >> 859 you are not getting any overflow checking in this case.
> >
> > I really don't see the "cautionary statements" here , no . I see that it
> > discards the size checking if this CONFIG_SYS_VSNPRINTF is not enabled,
> > but that does not obstruct the operation of those functions.
>
> I'm really confused: my code ensures that the buffer is not overflowed
> and that it is terminated properly. If snprintf() (without
> CONFIG_SYS_VSNPRINTF defined) doesn't provide "any overflow checking",
> then why would I use it?
That's why I suggested to enable CONFIG_SYS_VSNPRINTF unconditionally. Then your
code would not need to duplicate all the overflow checks, would it ?
> >>>> and the fact that CONFIG_SYS_VSNPRINTF is not defined for armv7
> >>>> builds, I am
> >>>
> >>> not going to use it....
> >>>
> >>> Is it a problem to define it? Also, even without CONFIG_SYS_VSNPRINTF ,
> >>> the
> >>>
> >>> functions are still available, see the README:
> >>> 857 If this option is not given then these functions
> >>> will 858 silently discard their buffer size argument
> >>> - this means 859 you are not getting any overflow
> >>> checking in this case.
> >>>
> >>> I have yet to see some hard-evidence against using safe printing
> >>> functions here.
> >>
> >> I don't want to be the first to defined it for all of armv7....
> >
> > Honestly, we should just enable this CONFIG_SYS_VSNPRINTF by default for
> > the good of humanity and all the things, since this unbounded string
> > handling is just evil (see how OpenSSL ended up, partly because of that
> > ... and I am just starting to see the pattern in all the security code).
> > I don't want to go down that road with U-Boot.
> >
> > So, would you please cook a separate patch to enable this by default, so
> > it would spur the right kind of discussion on this matter ?
>
> I will apologize in advance, but I just don't know anything about SPL or
> TPL or any other boards (outside of my very limited armv7 and armv8
> scope)....
That's OK.
> I would be happy to review and test this suggested patch (on our
> boards), but would be uncomfortable with proposing this patch.
> Please go ahead and submit a patch, and I'll check it!
The patch would go something like:
#if !defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD)
#define CONFIG_SYS_VSNPRINTF
#endif
and this would go into include/config_cmd_default.h . Unless I'm wrong.
next prev parent reply other threads:[~2014-08-07 17:12 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-26 20:13 [U-Boot] [PATCH v3 0/4] Implement "fastboot flash" for eMMC Steve Rae
2014-06-26 20:13 ` [U-Boot] [PATCH v3 1/4] usb/gadget: fastboot: add sparse image definitions Steve Rae
2014-07-31 1:25 ` Marek Vasut
2014-07-31 17:32 ` Steve Rae
2014-08-01 12:13 ` Marek Vasut
2014-08-05 14:00 ` Tom Rini
2014-08-05 22:17 ` Steve Rae
2014-06-26 20:13 ` [U-Boot] [PATCH v3 2/4] usb/gadget: fastboot: add eMMC support for flash command Steve Rae
2014-07-31 1:37 ` Marek Vasut
2014-08-06 23:48 ` Steve Rae
2014-08-07 0:13 ` Marek Vasut
2014-08-07 0:28 ` Steve Rae
2014-08-07 13:23 ` Marek Vasut
2014-08-07 13:28 ` Pantelis Antoniou
2014-08-07 13:43 ` Marek Vasut
2014-08-07 16:52 ` Steve Rae
2014-08-07 17:12 ` Marek Vasut [this message]
2014-06-26 20:13 ` [U-Boot] [PATCH v3 3/4] usb/gadget: fastboot: add " Steve Rae
2014-07-31 1:39 ` Marek Vasut
2014-08-06 23:35 ` Steve Rae
2014-06-26 20:13 ` [U-Boot] [PATCH v3 4/4] usb/gadget: fastboot: minor cleanup Steve Rae
2014-07-31 1:40 ` Marek Vasut
2014-08-06 23:34 ` Steve Rae
2014-07-31 1:02 ` [U-Boot] [PATCH v3 0/4] Implement "fastboot flash" for eMMC Steve Rae
2014-07-31 1:23 ` Marek Vasut
2014-07-31 17:30 ` Steve Rae
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=201408071912.59133.marex@denx.de \
--to=marex@denx.de \
--cc=u-boot@lists.denx.de \
/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