Files
vasilito b9874d0941 feat: USB storage read/write proof + full Red Bear OS tree sync
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.
2026-05-03 23:03:24 +01:00

39 lines
1.0 KiB
C

#include <assert.h>
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
void *handle = dlopen("libfoobar.so", RTLD_LAZY | RTLD_LOCAL);
if (!handle) {
printf("dlopen(libfoobar.so): %s\n", dlerror());
return EXIT_FAILURE;
}
assert(dlsym(handle, "BAR") != NULL);
assert(dlsym(handle, "FOO") != NULL);
// not in the global scope
assert(dlsym(RTLD_DEFAULT, "BAR") == NULL);
assert(dlsym(RTLD_DEFAULT, "FOO") == NULL);
void *self = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL);
if (!self) {
printf("dlopen(NULL): %s\n", dlerror());
return EXIT_FAILURE;
}
assert(dlsym(self, "FOO") == NULL);
assert(dlsym(self, "BAR") == NULL);
assert(dlclose(self) == 0);
// Promote the library to the global scope.
assert(dlopen("libfoobar.so", /* RTLD_NOLOAD |*/ RTLD_NOW | RTLD_GLOBAL));
assert(dlsym(RTLD_DEFAULT, "FOO") != NULL);
assert(dlsym(RTLD_DEFAULT, "BAR") != NULL);
return EXIT_SUCCESS;
}