Page MenuHomeFreeBSD

buf: Avoid calling bufdomain() on newly initialized bufs
ClosedPublic

Authored by markj on Fri, Sep 4, 2:27 AM.
Tags
None
Referenced Files
F171844311: D59381.id.diff
Mon, Sep 14, 12:26 AM
F171817614: D59381.id185789.diff
Sun, Sep 13, 6:48 PM
Unknown Object (File)
Sun, Sep 13, 9:06 AM
Unknown Object (File)
Sat, Sep 12, 10:51 AM
Unknown Object (File)
Sat, Sep 12, 7:05 AM
Unknown Object (File)
Sat, Sep 12, 6:55 AM
Unknown Object (File)
Sat, Sep 12, 6:47 AM
Unknown Object (File)
Sat, Sep 12, 6:28 AM
Subscribers

Details

Summary

bufinit() inserts newly initialized bufs into the QUEUE_EMPTY queue, at
which point they haven't yet been assigned a domain. Thus, bufdomain()
returns &bdomain[-1], which trips the array-bounds sanitizer.

This is harmless since we don't use the result in that case, but let's
avoid the invalid access to begin with. This is sufficient to let an
amd64 kernel boot to a login prompt with -fsanitize=array-bounds
configured.

Reported by: Andrew Griffiths <andrew@calif.io>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable