Permalink
Browse files

aslr: add examples

  • Loading branch information...
bmwiedemann committed Nov 7, 2017
1 parent 32c0267 commit 0df6c17a738cae30c000c4d4ed3e2bc4636a5939
Showing with 50 additions and 13 deletions.
  1. +13 −0 aslr/1b.c
  2. +3 −3 aslr/Makefile
  3. +0 −10 aslr/README
  4. +34 −0 aslr/README.md
View
@@ -0,0 +1,13 @@
#include <stdio.h>
main()
{
int buffer[20];
int sum;
int i;
for(i=0; i<20; i++) {
sum+=buffer[i];
}
printf("%i\n", sum);
return 0;
}
View
@@ -1,8 +1,8 @@
all: run
run: 1 2
run: 1 1b 2
for s in 1 ; do ./$$s ; done | od -tx1 > ../out/aslr
for s in 2 ; do ./$$s ; done >> ../out/aslr
for s in 1b 2 ; do ./$$s ; done >> ../out/aslr
clean:
rm -f 1 2
rm -f 1 1b 2
View

This file was deleted.

Oops, something went wrong.
View
@@ -0,0 +1,34 @@
[ASLR](https://en.wikipedia.org/wiki/Address_space_layout_randomization)
is controlled under Linux via `/proc/sys/kernel/randomize_va_space`
It will randomize memory addresses and thus pointers
and also initialize certain memory with random values.
ASLR can also be disabled per process using `setarch $(arch) -R make`
But the proper fix for cases like `1.c` is to use `memset` or `bzero`.
##Seen in the wild:
* case 1 (uninitialized padding memory):
* [LiE](https://github.com/davidsd/lie/pull/1/files)
* [gcin](https://build.opensuse.org/request/show/520868)
* [ipadic](https://build.opensuse.org/request/show/540040) http://rb.zq1.de/compare.factory-20170910/ipadic-compare.out
* case 1b (uninitialized memory):
* [i4l-base](https://build.opensuse.org/request/show/539442)
* case 2 (pointers):
* http://rb.zq1.de/compare.factory-20170910/python-rtslib-compare.out
* http://rb.zq1.de/compare.factory-20170910/python-utidy-compare.out
* http://rb.zq1.de/compare.factory-20170910/ragel-compare.out
* unknown:
* http://rb.zq1.de/compare.factory-20171011/aegisub-compare.out
* http://rb.zq1.de/compare.factory-20170910/gnustep-libobjc2-compare.out
* http://rb.zq1.de/compare.factory-20170910/kdebindings-smokekde-compare.out
* http://rb.zq1.de/compare.factory-20170910/kdebindings-smokeqt-compare.out
* http://rb.zq1.de/compare.factory-20170910/ldc-compare.out
* http://rb.zq1.de/compare.factory-20170910/libkolabxml-compare.out
* http://rb.zq1.de/compare.factory-20170910/mkvtoolnix-compare.out
* http://rb.zq1.de/compare.factory-20171011/nodejs6-compare.out
* http://rb.zq1.de/compare.factory-20170910/perl-MooseX-Role-Cmd-compare.out
* http://rb.zq1.de/compare.factory-20170910/quantum-espresso-compare.out

0 comments on commit 0df6c17

Please sign in to comment.