Skip to content

Instantly share code, notes, and snippets.

@moyix
Created November 10, 2018 04:13
Show Gist options
  • Save moyix/ed0d6dde9bc8164ff5e58030282d72af to your computer and use it in GitHub Desktop.
Save moyix/ed0d6dde9bc8164ff5e58030282d72af to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
int main(int argc, char **argv) {
unsigned char data[258];
unsigned char data2[258];
strcpy(data, "averylongstringwithnotmuchmeaningaverylongstringwithnotmuchmeaning"
"averylongstringwithnotmuchmeaningaverylongstringwithnotmuchmeaning"
"averylongstringwithnotmuchmeaningaverylongstringwithnotmuchmeaning");
printf("data = %p\n", data);
// Uncommenting these two lines will cause PANDA to see the writes in __copy_from_user_ll_nozero
//printf("data2 = %p\n", data2);
//memcpy(data2,data,258);
int fd = open("foo", O_CREAT|O_RDWR, 0644);
int n = write(fd, data, 258);
fsync(fd);
close(fd);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment