]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
[PowerPC] Allow traversal of oversize OF properties.
authorBrandon Bergren <bdragon@FreeBSD.org>
Fri, 13 Nov 2020 16:49:41 +0000 (16:49 +0000)
committerBrandon Bergren <bdragon@FreeBSD.org>
Fri, 13 Nov 2020 16:49:41 +0000 (16:49 +0000)
commit26869ad14c70306313405029229a1e2fd94510cd
tree67f3f2b942154f31874057951d6f73df678481e3
parent1740c2dbb628ba657d5eb185cdd8fe20d959555f
[PowerPC] Allow traversal of oversize OF properties.

In standards such as LoPAPR, property names in excess of the usual 31
characters exist.

This breaks property traversal.

While in IEEE 1275-1994, nextprop is defined explicitly to work with a
32-byte region of memory, using a larger buffer should be fine. There is
actually no way to pass a buffer length to the nextprop call in the OF
client interface, so SLOF actually just blindly overflows the buffer.

So we have to defensively make the buffer larger, to avoid memory
corruption when reading out long properties on live OF systems.

Note also that on real-mode OF, things are pretty tight because we are
allocating against a static bounce buffer in low memory, so we can't just
use a huge buffer to work around this without it being wasteful of our
limited amount of 32-bit physical memory.

This allows a patched ofwdump to operate properly on SLOF (i.e. pseries)
systems, as well as any other PowerPC systems with overlength properties.

Reviewed by: jhibbits
MFC after: 2 weeks
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D26669
sys/dev/ofw/openfirmio.c
sys/dev/ofw/openfirmio.h
usr.sbin/ofwdump/ofwdump.c