lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111130070417.GA17781@redhat.com>
Date:	Wed, 30 Nov 2011 09:04:17 +0200
From:	"Michael S. Tsirkin" <mst@...hat.com>
To:	Bjorn Helgaas <bhelgaas@...gle.com>
Cc:	Chris Metcalf <cmetcalf@...era.com>,
	Lucas De Marchi <lucas.demarchi@...fusion.mobi>,
	Paul Mundt <lethal@...ux-sh.org>,
	Jesse Barnes <jbarnes@...tuousgeek.org>,
	"David S. Miller" <davem@...emloft.net>,
	linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
	linux-arch@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH-RFC 1/2] tile: don't panic on iomap

On Tue, Nov 29, 2011 at 01:04:12PM -0800, Bjorn Helgaas wrote:
> On Tue, Nov 29, 2011 at 10:54 AM, Michael S. Tsirkin <mst@...hat.com> wrote:
> > I think panic on iomap is there just for debugging.
> > If we return NULL instead, the generic pci_iomap will
> > DTRT so we don't need to roll our own.
> 
> Just to be explicit about what "doing the right thing" means, here's
> what I think is changing (I think the new behavior is OK, but it *is*
> different):

I think the change is that anyone calling ioport_map *directly*
will fail. pci_iomap callers are mostly unaffected.

> 
> Old behavior: Caller calls pci_iomap(), which panics in ioport_map().

Not really, the old pci_iomap simply returned NULL in this case, it
did not call ioport_map.

> New behavior: Caller calls pci_iomap(), ioport_map() returns NULL,
> pci_iomap() returns NULL (failure), caller may check for failure.  If
> caller does not check for failure and passes the NULL to
> ioread()/iowrite(), we WARN in bad_io_access().
> 
> >  static inline void __iomem *ioport_map(unsigned long port, unsigned int len)
> >  {
> > -       return (void __iomem *) ioport_panic();
> > +       pr_info("Trying to map an IO resource - it does not exit on tile.\n");
> > +       return NULL;
> 
> s/exit/exist/
> 
> Since we only expect to see this message during debugging, maybe it
> could be more informative, e.g., use dump_stack() to identify the
> offending driver?  I don't think either the "Trying to map" message or
> the "Bad IO access" message is enough to actually make progress in
> debugging.
> 
> Bjorn

As explained above, only direct callers of ioport_map get a changed
behaviour. If we start dumping stack there we will hurt users of
pci_iomap which used to get a graceful failure and will start getting
scary messages. Is does not seem to be worth doing to simplify debugging, right?
How about sticking the function name in the pr_info message?
A simple grep for ioport_map will then get you the culprit ...
Like this:
+       pr_info("ioport_map: mapping IO resources is unsupported on tile.\n");
?

-- 
MST
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ