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.
46 lines
863 B
C
46 lines
863 B
C
#include <signal.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
|
|
#define NUMSIGNALS 25
|
|
|
|
int is_changed(sigset_t set, int sig) {
|
|
|
|
int i;
|
|
int siglist[] = {SIGABRT, SIGALRM, SIGBUS, SIGCHLD,
|
|
SIGCONT, SIGFPE, SIGHUP, SIGILL, SIGINT,
|
|
SIGPIPE, SIGQUIT, SIGSEGV,
|
|
SIGTERM, SIGTSTP, SIGTTIN, SIGTTOU,
|
|
SIGUSR1, SIGUSR2, SIGPROF, SIGSYS,
|
|
SIGTRAP, SIGURG, SIGVTALRM, SIGXCPU, SIGXFSZ };
|
|
|
|
if (sigismember(&set, sig) != 1) {
|
|
return 1;
|
|
}
|
|
for (i=0; i<NUMSIGNALS; i++) {
|
|
if ((siglist[i] != sig)) {
|
|
if (sigismember(&set, siglist[i]) != 0) {
|
|
return 1;
|
|
}
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
int main() {
|
|
sigset_t actl, oactl;
|
|
|
|
sigemptyset(&actl);
|
|
sigemptyset(&oactl);
|
|
|
|
sigaddset(&actl, SIGABRT);
|
|
|
|
sigprocmask(SIG_SETMASK, &actl, NULL);
|
|
sigprocmask(SIG_SETMASK, NULL, &oactl);
|
|
|
|
if (is_changed(oactl, SIGABRT)) {
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
return EXIT_SUCCESS;
|
|
} |