mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-23 19:39:40 +00:00
sys/openbsd: prevent swap partition device nodes from being created
Writing to the swap partition during fuzzing can lead to all kinds of corruptions[1]. [1] https://syzkaller.appspot.com/bug?id=a2eca15e6e0be4be3ed1b0b2bab3332edc317b1c
This commit is contained in:
parent
1656845f45
commit
919efc620a
@ -112,9 +112,10 @@ func (arch *arch) SanitizeCall(c *prog.Call) {
|
|||||||
dev.Val = devNullDevT
|
dev.Val = devNullDevT
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent /dev/sd0c nodes from being created since the refer to
|
// Prevent /dev/sd0b (swap partition) and /dev/sd0c (raw disk)
|
||||||
// the raw root disk.
|
// nodes from being created. Writing to such devices can corrupt
|
||||||
if devmajor(dev.Val) == 4 && devminor(dev.Val) == 2 {
|
// the file system.
|
||||||
|
if devmajor(dev.Val) == 4 && (devminor(dev.Val) == 1 || devminor(dev.Val) == 2) {
|
||||||
dev.Val = devNullDevT
|
dev.Val = devNullDevT
|
||||||
}
|
}
|
||||||
case "mlockall":
|
case "mlockall":
|
||||||
|
@ -41,9 +41,19 @@ func TestSanitizeCall(t *testing.T) {
|
|||||||
`mknod(0x0, 0x0, 0x1600)`,
|
`mknod(0x0, 0x0, 0x1600)`,
|
||||||
`mknod(0x0, 0x0, 0x1600)`,
|
`mknod(0x0, 0x0, 0x1600)`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// major=4, minor=0
|
||||||
|
`mknod(0x0, 0x0, 0x400)`,
|
||||||
|
`mknod(0x0, 0x0, 0x400)`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// major=4, minor=1
|
||||||
|
`mknod(0x0, 0x0, 0x401)`,
|
||||||
|
`mknod(0x0, 0x0, 0x202)`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
// major=4, minor=2
|
// major=4, minor=2
|
||||||
`mknod(0x0, 0x0, 0x0402)`,
|
`mknod(0x0, 0x0, 0x402)`,
|
||||||
`mknod(0x0, 0x0, 0x202)`,
|
`mknod(0x0, 0x0, 0x202)`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user