⬢ DragonFlyBSD Kernel Audit
DF-4504 / t4dwave_probe.c
← back to finding ↓ download raw
/*
 * DF-4504 probe: is a t4dwave-family pcm device (and thus a /dev/mixerN
 * created by tr_pci_attach's mixer_init) present on this machine?
 *
 * The bug needs the Trident/SiS/ALI 4DWave PCI audio controller to attach
 * and then fail AFTER mixer_init() (IRQ allocation, dma-tag creation, or
 * pcm_register failure), leaving a dangling 0666 /dev/mixerN.
 */
#include <stdio.h>
#include <stdlib.h>

int
main(void)
{
	int rc = system("pciconf -lv 2>/dev/null | grep -iE '1023 2000|1023 2001|"
	    "1039 7018|1102 5451|Trident|4DWave|SiS 7018|M5451' ; "
	    "ls -l /dev/mixer* /dev/dsp* 2>&1 ; "
	    "kldstat -v 2>/dev/null | grep -i t4dwave ; "
	    "sysctl hw.snd 2>/dev/null | head -1");
	puts(rc == 0 ? "PROBE: see output above"
	    : "PROBE: no t4dwave-class device / mixer nodes on this guest");
	return 0;
}