mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dawson Engler <engler@csl.Stanford.EDU>
To: davem@redhat.com (David S. Miller)
Cc: linux-kernel@vger.kernel.org, mc@cs.Stanford.EDU, SteveW@ACM.org,
	philb@gnu.org
Subject: Re: [CHECKER] 84 bugs in 2.4.4/2.4.4-ac8 where NULL pointers are deref'd
Date: Tue, 29 May 2001 16:09:21 -0700 (PDT)	[thread overview]
Message-ID: <200105292309.QAA00259@csl.Stanford.EDU> (raw)
In-Reply-To: <15124.9340.77101.588276@pizda.ninka.net> from "David S. Miller" at May 29, 2001 03:36:44 PM

> And if you look a couple lines previous it is blindly dereferenced,
> this should have been a clue :-)

There's a lot of places where code checks and then blindly
dereferences, so I don't think that's much of a clue ;-)

>  > Start --->
>  > 	struct rtable *rt = skb ? (struct rtable*)skb->dst : NULL;
>  > 
>  > 	if (!opt) {
>  > 		opt = &(IPCB(skb)->opt);
>  > 		memset(opt, 0, sizeof(struct ip_options));
>  > Error --->
>  > 		iph = skb->nh.raw;
> How is this a contradiction?  The first thing sets 'rt' to NULL or

In the absence of knowlege about variable dependencies (in this case
that skb == NULL implies opt != NULL) the code appears contradictory,
since it checks skb against null and then dereferences it downstream.
We'd make the checker read comments to infer such knowlege if there
were more of them ;-)


>  > Start --->
>  > 	if (skb->dst == NULL) {
>  > 		if (ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev))
>  > 			goto drop; 
>  > 	}
>  > 
>  > #ifdef CONFIG_NET_CLS_ROUTE
>  > Error --->
>  > 	if (skb->dst->tclassid) {
> 
> This one is OK.
> 
> The side effect of a successful ip_route_input call is that skb->dst
> gets set to a non-NULL value.

Argh.  I was missing the fact that skb was getting passed to a function.
Sorry about the false pos.


>  > Start --->
>  > 	if (ifa == NULL && cmd != SIOCSIFADDR) {
>  > 		ret = -EADDRNOTAVAIL;
>  > 		goto done;
>  > 	}
>  > 
>  > 	switch(cmd) {
>  > 		case SIOCGIFADDR:
>  > Error --->
>  > 			*((dn_address *)sdn->sdn_nodeaddr) = ifa->ifa_local;
>  > 			goto rarok;
>  > 
>  > 		case SIOCSIFADDR:
> 
> Checker is wrong in these two cases.
> 
> The "error" code you point to cannot be reached if cmd == SIOCGIFADDR
> (for the dn_dev.c, likewise SIOCSIFADDR+SIOCSIFFLAGS in the devinet.c
> case). In the dn_dev.c case, SIOCSIFADDR in that switch statement may
> run if ifa == NULL.

Yeah, it's not doing sophisticated false path pruning (yet).  I thought
I would have caught this.

> isn't doing exhaustive enough reachability determination.

Too exhaustive, since it follows impossible paths.

Thanks for the quick feedback!  And apologies for the bogus "errors".

Dawson

  parent reply	other threads:[~2001-05-29 23:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-29 21:49 Dawson Engler
2001-05-29 22:36 ` Alexander Viro
2001-05-29 22:36 ` David S. Miller
2001-05-29 22:56   ` Steve Whitehouse
2001-05-29 23:09   ` Dawson Engler [this message]
2001-05-30  5:17 ` Andreas Dilger
2001-05-30  5:45   ` Alexander Viro
2001-05-30  6:49     ` Andreas Dilger
2001-05-30  6:58       ` Alexander Viro

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=200105292309.QAA00259@csl.Stanford.EDU \
    --to=engler@csl.stanford.edu \
    --cc=SteveW@ACM.org \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mc@cs.Stanford.EDU \
    --cc=philb@gnu.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

all inboxes | Powered by JetHome®