public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: "Carlos O'Donell" <carlos@redhat.com>
To: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Cc: libc-alpha <libc-alpha@sourceware.org>,
	       "libc-ports@sourceware.org" <libc-ports@sourceware.org>
Subject: Re: [PATCH 2/5] __FD_ELT: Implement correct buffer overflow check
Date: Fri, 03 May 2013 03:15:00 -0000	[thread overview]
Message-ID: <51832BE1.8020303@redhat.com> (raw)
In-Reply-To: <518176FC.5030906@gmail.com>

On 05/01/2013 04:11 PM, KOSAKI Motohiro wrote:
>>> Does compiling ruby (or similar code) with this header
>>> result in calls to __fdelt_buffer_warn or __fdelt_buffer_chk?
>>
>> Unfortunately, No. __builtin_object_size() require compiler know the
>> buffer size.
>> In the other words, it doesn't work if an allocate function and
>> FD_{SET,CLR} functions
>> doesn't exist in the same place. This is the same limitation with
>> other string buffer
>> overflow checks.
> 
> I inspected several other project codes.

Thank you very much for looking at these examples. They are quite
informative.

[snip]

> Summary: alomost software only need to add alloc_size() annotation to xmalloc() or 
> similar in almost case. but there are several exceptions. some software have a complicated
> fd size management and can't use __builtin_object_size(). but that's ok. In this case, the
> software correctly expand buffers by realloc() or similar, so there is no chance to happen
> buffer overflow.

So with your patch we enhance the number of cases that the check
is correct by using __bos0, and that's forward progress. I know
that it is less progress than you would like, but it is good
progress.

We keep _FORTIFY_SOURCE working usefully, even though it still
yields false positives.

The question as always with these checks is: Do you prefer false
positives or buffer overflows?

What's more harmful? The ecosystem thinking glibc and
the tools are "wrong" or buffer overflows leading to
security issues?

As a conservative project, and given the goal of _FORTIFY_SOURCE,
it seems like we have to leave the existing checks in place.

Cheers,
Carlos.

  reply	other threads:[~2013-05-03  3:15 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-14  0:47 [PATCH v4 0/5] fix wrong program abort on __FD_ELT KOSAKI Motohiro
2013-04-14  0:47 ` [PATCH 2/5] __FD_ELT: Implement correct buffer overflow check KOSAKI Motohiro
2013-05-01  2:42   ` Carlos O'Donell
2013-05-01  6:28     ` KOSAKI Motohiro
2013-05-01 14:42       ` Carlos O'Donell
2013-05-01 20:32         ` KOSAKI Motohiro
2013-05-03  3:15           ` Carlos O'Donell
2013-05-01 20:11       ` KOSAKI Motohiro
2013-05-03  3:15         ` Carlos O'Donell [this message]
2013-04-14  0:47 ` [PATCH 3/5] update libc.abilist KOSAKI Motohiro
2013-04-14  0:47 ` [PATCH 5/5] __FDS_BITS: Added cast to __fd_mask* to avoid warning KOSAKI Motohiro
2013-05-01  2:44   ` Carlos O'Donell
2013-04-14  0:47 ` [PATCH 4/5] tst-chk1: add fd_set dynamic allocation test KOSAKI Motohiro
2013-05-01  2:44   ` Carlos O'Donell
2013-05-01  6:29     ` KOSAKI Motohiro
2013-04-14  0:47 ` [PATCH 1/5] __fdelt_chk: Removed range check KOSAKI Motohiro
2013-05-01  2:25   ` Carlos O'Donell
2013-05-01  6:40     ` KOSAKI Motohiro
2013-05-01 14:45       ` Carlos O'Donell
2013-05-01 22:13         ` KOSAKI Motohiro
2013-05-03  2:52           ` Carlos O'Donell
2013-05-01  3:08 ` [PATCH v4 0/5] fix wrong program abort on __FD_ELT Carlos O'Donell
2013-05-01  5:31   ` KOSAKI Motohiro
2013-05-01 14:38     ` Carlos O'Donell
2013-05-01 22:21       ` KOSAKI Motohiro

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=51832BE1.8020303@redhat.com \
    --to=carlos@redhat.com \
    --cc=kosaki.motohiro@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=libc-ports@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).