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
F171649638: D59381.id185814.diff
Sat, Sep 12, 10:51 AM
F171627827: D59381.id185814.diff
Sat, Sep 12, 7:05 AM
F171626902: D59381.diff
Sat, Sep 12, 6:55 AM
F171625945: D59381.id185789.diff
Sat, Sep 12, 6:47 AM
F171623850: D59381.id185814.diff
Sat, Sep 12, 6:28 AM
F171595349: D59381.id.diff
Sat, Sep 12, 12:19 AM
F171550639: D59381.id.diff
Fri, Sep 11, 5:21 PM
Unknown Object (File)
Fri, Sep 11, 12:22 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