Exploit databaseDownload repository ZIP
GH-574daeb1ed649a0a82f1c4ecdfce04a0
robertdfrench/ifuncd-up
Sources for CVE-2024-3094
52 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files8
robertdfrench/ifuncd-upRevision b5cd93425eb4
- ↑..Parent directory
- speed_demo/
- cpu_demo.c
- environ.c
- hello_world.c
- plt_example.c
- static_pointer.c
- tty_demo.c
- vector_add.c
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
code/static_pointer.c
C · 798 bytes#include <stdio.h>
// Declare the function pointer and the "real" implementations. We are
// pretending here that multiplication isn't available without SSE4.2.
static int (*triple)(int) = 0;
int triple_sse42(int n) { return 3 * n; }
int triple_plain(int n) { return n + n + n; }
// Make use of the global function pointer since we know it was resolved
// in main.
void print_fifteen() {
int fifteen = triple(5);
printf("%d\n", fifteen);
}
int main() {
// GNU IFUNC resolves all functions up front anyways, so we will
// incur the same startup cost by doing it in main.
__builtin_cpu_init();
if (__builtin_cpu_supports("sse4.2")) {
triple = triple_sse42;
} else {
triple = triple_plain;
}
// Call a function that uses the resolved function pointer.
print_fifteen();
return 0;
}