b9874d0941
Add redbear-usb-storage-check in-guest binary that validates USB mass storage read and write I/O: discovers /scheme/disk/ devices, writes a test pattern to sector 2048, reads it back, verifies match, restores original content. Updates test-usb-storage-qemu.sh with write-proof verification step. Includes all accumulated Red Bear OS work: kernel patches, relibc patches, driver infrastructure, DRM/GPU, KDE recipes, firmware, validation tooling, build system hardening, and documentation.
47 lines
945 B
C
47 lines
945 B
C
#include <signal.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int handler_called = 0;
|
|
|
|
void sig_handler(int signo)
|
|
{
|
|
(void) signo;
|
|
printf("SIGURG called. Inside handler\n");
|
|
handler_called = 1;
|
|
}
|
|
|
|
int sigset_test(int signum)
|
|
{
|
|
|
|
struct sigaction act;
|
|
act.sa_handler = sig_handler;
|
|
act.sa_flags = 0;
|
|
sigemptyset(&act.sa_mask);
|
|
|
|
if (sigaction(signum, &act, 0) != 0) {
|
|
perror("Unexpected error while using sigaction()");
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
|
|
if (sigset(signum,SIG_DFL) != sig_handler) {
|
|
perror("Unexpected error while using signal()");
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
|
|
raise(signum);
|
|
|
|
if (handler_called == 1) {
|
|
printf("Test FAILED: handler was called even though default was expected\n");
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
printf("test passed, the signal was ignored\n");
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|
|
int main(){
|
|
sigset_test(SIGURG);
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|