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.
57 lines
1.1 KiB
C
57 lines
1.1 KiB
C
#include "../test_helpers.h"
|
|
#include <assert.h>
|
|
#include <pthread.h>
|
|
#include <stdio.h>
|
|
#include <signal.h>
|
|
#include <errno.h>
|
|
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
|
|
// This program verifies that sigpause() returns -1 and sets errno to EINVAL
|
|
// if passed an invalid signal number.
|
|
|
|
#define INMAIN 0
|
|
#define INTHREAD 1
|
|
|
|
volatile sig_atomic_t handler_called = 0;
|
|
int returned = 0;
|
|
int return_value = 2;
|
|
int result = 2;
|
|
int sem = INMAIN;
|
|
|
|
void handler() {
|
|
// printf("signal was called\n");
|
|
handler_called = 1;
|
|
return;
|
|
}
|
|
|
|
int sigpause_invalid(){
|
|
int return_value = 0;
|
|
|
|
return_value = sigpause(-1);
|
|
|
|
if (return_value == -1) {
|
|
if (errno == EINVAL) {
|
|
printf ("Test PASSED: sigpause returned -1 and set errno to EINVAL\n");
|
|
return EXIT_SUCCESS;
|
|
} else {
|
|
printf ("Test FAILED: sigpause did not set errno to EINVAL\n");
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
} else {
|
|
printf ("Test FAILED: sigpause did not return -1\n");
|
|
if (errno == EINVAL) {
|
|
printf ("Test FAILED: sigpause did not set errno to EINVAL\n");
|
|
}
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
int main(){
|
|
sigpause_invalid();
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|