Page MenuHomeFreeBSD

[PowerPC] Allow traversal of oversize OF properties
ClosedPublic

Authored by bdragon on Oct 4 2020, 11:48 PM.
Referenced Files
Unknown Object (File)
Sun, Dec 15, 3:54 PM
Unknown Object (File)
Sat, Nov 30, 2:53 AM
Unknown Object (File)
Sat, Nov 23, 5:19 PM
Unknown Object (File)
Nov 21 2024, 5:17 AM
Unknown Object (File)
Nov 19 2024, 11:14 AM
Unknown Object (File)
Nov 12 2024, 5:58 AM
Unknown Object (File)
Oct 6 2024, 7:02 AM
Unknown Object (File)
Sep 23 2024, 3:02 AM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

As I was writing the patch description, I realized that we actually need to be even more defensive about property name lengths, as we aren't blocking userland from setting properties up to OFIOCMAXNAME, which means someone could force an overflow of newname[] by setting a long property to something and then traversing it, which would force OF to corrupt the kernel stack using nextprop.

Maybe we should stop playing whack-a-mole and just use an overkill bounce page that can hold the full name field (2048 bytes?)

This revision is now accepted and ready to land.Nov 3 2020, 10:32 PM