162306a36Sopenharmony_ciTesting for regressions in Media Controller API register, ioctl, syscall,
262306a36Sopenharmony_ciand unregister paths. There have a few problems that result in user-after
362306a36Sopenharmony_cifree on media_device, media_devnode, and cdev pointers when the driver is
462306a36Sopenharmony_ciunbound while ioctl is in progress.
562306a36Sopenharmony_ci
662306a36Sopenharmony_ciTest Procedure:
762306a36Sopenharmony_ci
862306a36Sopenharmony_ciRun bin/unbind loop while ioctls are in progress.
962306a36Sopenharmony_ciRun rmmod and modprobe.
1062306a36Sopenharmony_ciDisconnect the device.
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciSetup:
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ciBuild media_device_test
1562306a36Sopenharmony_cicd tools/testing/selftests/media_tests
1662306a36Sopenharmony_cimake
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ciRegressions test for cdev user-after free error on /dev/mediaX when driver
1962306a36Sopenharmony_ciis unbound:
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ciStart media_device_test to regression test media devnode dynamic alloc
2262306a36Sopenharmony_ciand cdev user-after-free fixes. This opens media dev files and sits in
2362306a36Sopenharmony_cia loop running media ioctl MEDIA_IOC_DEVICE_INFO command once every 10
2462306a36Sopenharmony_ciseconds. The idea is when device file goes away, media devnode and cdev
2562306a36Sopenharmony_cishould stick around until this test exits.
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ciThe test for a random number of iterations or until user kills it with a
2862306a36Sopenharmony_cisleep 10 in between the ioctl calls.
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_cisudo ./media_device_test -d /dev/mediaX
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ciRegression test for media_devnode unregister race with ioctl_syscall:
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ciStart 6 open_loop_test.sh tests with different /dev/mediaX files. When
3562306a36Sopenharmony_cidevice file goes away after unbind, device file name changes. Start the
3662306a36Sopenharmony_citest with possible device names. If we start with /dev/media0 for example,
3762306a36Sopenharmony_ciafter unbind, /dev/media1 or /dev/media2 could get created. The idea is
3862306a36Sopenharmony_cikeep ioctls going while bind/unbind runs.
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ciCopy bind_unbind_sample.txt and make changes to specify the driver name
4162306a36Sopenharmony_ciand number to run bind and unbind. Start the bind_unbind.sh
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ciRun dmesg looking for any user-after free errors or mutex lock errors.
44