From: Zdenek Kabelac <zkabelac@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 4/5] Fix theoretical usage of NULL pointer dereference
Date: Wed, 27 Oct 2010 12:36:58 +0200 [thread overview]
Message-ID: <4CC800CA.5000206@redhat.com> (raw)
In-Reply-To: <874oc8sztz.wl%ejt@redhat.com>
Dne 27.10.2010 12:19, ejt at redhat.com napsal(a):
> At Tue, 26 Oct 2010 14:37:43 +0100,
> Alasdair G Kergon wrote:
>>
>> On Tue, Oct 26, 2010 at 02:59:25PM +0200, Zdenek Kabelac wrote:
>>> @@ -97,6 +97,12 @@ int ttree_insert(struct ttree *tt, unsigned int *key, void *data)
>>
>>> + if (!*c) {
>>> + log_error(INTERNAL_ERROR "Insert failed.");
>>
>> What am I missing here?
>> Isn't that condition you are proposing to add logically impossible to
>> trigger?!
>
> Yes, it can't happen, as I said the first time this patch went round.
>
> One thing I'm not clear on is how much benefit we're seeing from the
> CLang build? Kabi, how many genuine bugs did you find when you went
> through this process? If the benefits are real, then we can live with
> check like these. It would be nice if it was clearer that they are
> only there to pacify clang, maybe put a conditional compile in so
> they're only included with the clang build?
>From the first original patchset real bugs are already commited.
I think patches 4, 5, 10, 14, 15. (Some of them are clearly problems of
missing deep unit tests probably - but running scan-build - or spending
months writing tests for every single error path in the code - I think we do
not have manpower for this at this moment...)
The problem here is not what would happen if everything goes 'right', but what
could happen if something goes 'wrong' - i.e. we may overwrite
some bytes in memory by some other errors, we may leave some structure in
wrong state, because of some unchecked error path - we could misuse or wrongly
reuse something- obviously we will need to find the real cause of such memory
overwrite - but the question is - is it the best thing to generate a coredump
- or should we nicely bailout from such case and give user some error report?
I didn't want to spend too much time with this thing in first place - so I've
chosen easiest path here - and as mention in the patchset header - under
normal circumstances lots of those (sometimes really crazy code paths) are not
reachable - but if these checks are so cheap - why not add them - we do not
mask the bug - we just avoid coredump for this case.
Zdenek
next prev parent reply other threads:[~2010-10-27 10:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-26 12:59 [PATCH 0/5] Fix NULL dereference Zdenek Kabelac
2010-10-26 12:59 ` [PATCH 1/5] Check type is not NULL before access Zdenek Kabelac
2010-10-26 14:02 ` Alasdair G Kergon
2010-10-26 12:59 ` [PATCH 2/5] Ensure seg is nonnull Zdenek Kabelac
2010-10-26 13:29 ` Alasdair G Kergon
2010-10-26 12:59 ` [PATCH 3/5] Ensure first is not NULL before dereference Zdenek Kabelac
2010-10-26 13:52 ` Alasdair G Kergon
2010-10-26 12:59 ` [PATCH 4/5] Fix theoretical usage of NULL pointer dereference Zdenek Kabelac
2010-10-26 13:37 ` Alasdair G Kergon
2010-10-27 10:19 ` ejt
2010-10-27 10:36 ` Zdenek Kabelac [this message]
2010-10-26 12:59 ` [PATCH 5/5] Check for NULL pointer Zdenek Kabelac
2010-10-26 13:42 ` Alasdair G Kergon
2010-10-26 13:57 ` [PATCH 0/5] Fix NULL dereference Alasdair G Kergon
2010-10-26 14:05 ` Petr Rockai
2010-10-26 14:17 ` Zdenek Kabelac
2010-10-26 14:14 ` Zdenek Kabelac
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=4CC800CA.5000206@redhat.com \
--to=zkabelac@redhat.com \
--cc=lvm-devel@redhat.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 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.