archive-ca.com » CA » E » EVANJONES.CA

Total: 397

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • Rvalue References: Because C++ is not Complicated Enough (evanjones.ca)
    references A a ref A The article describes how this permits move semantics For example today if you say std vector T v1 v2 you get a copy operation What if you want a move instead The article presents many examples of how to use rvalue references to do that However the result is insane It introduces more syntax that C programmers will need to learn The differences between rvalue references and lvalue references are subtle and will likely be confusing It certainly confuses me a little I propose the following alternative use a pointer In this case a move is simple A a A Or add a swap member function This is not elegant nor is it as general However this is what we ve been using for decades It also requires zero changes to C compilers and requires users to learn nothing It has been immortalized in books like Effective C Item 25 Consider support for a non throwing swap Does the standards committee not realize that C is already the most complicated programming language that is widely used Part of the benefit of Java is that it is or was simpler than C Work like this is

    Original URL path: http://www.evanjones.ca/rvalue-references.html (2016-04-30)
    Open archived version from archive


  • Yahoo Chubby Zookeeper (evanjones.ca)
    source versions of Google s infrastructure I just discovered Yahoo Zookeeper which looks very similar to Google s Chubby Personally I think this is great more publicly available distributed systems infrastructure can only be a good thing In particular implementing

    Original URL path: http://www.evanjones.ca/yahoo-zookeeper.html (2016-04-30)
    Open archived version from archive

  • Portable Linux Binaries (evanjones.ca)
    Point Exception SIGFPE Binaries compiled on a newer system can crash with a floating point exception SIGFPE on an older system It turns out that the linker in newer versions of Fedora emit a new gnu hash section instead of the old hash section Older Linux systems won t understand how to link the binary which causes this exception Pass GCC the flag Wl hash style both to solve the problem Statically Link libstdc If you have a C binary it depends on a version of the C standard library that may not exist on other systems It takes some work but it is possible to statically link libstdc to avoid this issue Wrong glibc versions The C library on Linux uses symbol versioning to preserve backwards compatibility However if you build a binary on a newer system you might end up with dependencies on the new version of glibc To determine which versions your binary requires run readelf V binary You ll get output that looks like this Version needs section gnu version r contains 5 entries Addr 0x000000000804901c Offset 0x00101c Link to section 7 dynstr 000000 Version 1 File libpthread so 0 Cnt 1 0x0010 Name GLIBC 2 0 Flags none Version 11 0x0020 Version 1 File librt so 1 Cnt 1 0x0030 Name GLIBC 2 2 Flags none Version 8 0x0040 Version 1 File ld linux so 2 Cnt 1 0x0050 Name GLIBC 2 3 Flags none Version 6 0x0060 Version 1 File libgcc s so 1 Cnt 3 0x0070 Name GCC 4 2 0 Flags none Version 9 0x0080 Name GCC 3 3 Flags none Version 5 0x0090 Name GCC 3 0 Flags none Version 3 0x00a0 Version 1 File libc so 6 Cnt 4 0x00b0 Name GLIBC 2 4 Flags none Version 10 0x00c0 Name

    Original URL path: http://www.evanjones.ca/portable-linux-binaries.html (2016-04-30)
    Open archived version from archive



  • Randomized Testing (evanjones.ca)
    I ve found randomized testing to be extremely useful when validating software that has obvious correctness conditions For example I used it in my unit tests for my vam Emde Boas queue implementation The test runs random operations on the queue and ensures that it matches a very simple queue implementation I ve also used it to test B Trees and Paxos Google also uses randomized testing to validate their

    Original URL path: http://www.evanjones.ca/random-testing.html (2016-04-30)
    Open archived version from archive

  • Python Code Coverage Tools (evanjones.ca)
    requires Python 2 4 Here is my extremely brief quick start guide Get the code http darcs idyll org t projects figleaf latest tar gz tar xvzf figleaf latest tar gz Run your program with it python figleaf latest bin

    Original URL path: http://www.evanjones.ca/python-coverage.html (2016-04-30)
    Open archived version from archive

  • Paper Password Tokens (evanjones.ca)
    If someone steals your password they can t use it since they don t have the device This provides better security but now you need to purchase and distribute the physical devices Here is a brilliant solution paper password tokens Instead of an electronic device you have a credit card sized piece of paper with the tokens Each time you log in you type your password and the next token

    Original URL path: http://www.evanjones.ca/paper-passwords.html (2016-04-30)
    Open archived version from archive

  • Hacking echod (evanjones.ca)
    the function and poked around to determine the stack layout To exploit the bug simply write 112 bytes of NOPs and the shell code then overwrite the return address to point into the buffer It will then execute the code I was planning on using dup2 fd 0 dup2 fd 1 to get the socket to replace standard input and output Then calling execve bin sh would give me a shell connected to the socket While using GDB to figure out the value for fd I noticed that it was always 1 standard output That means that instead of getting a shell I could execute cat cookie and it would send the file over the socket A bit more hacking later I ended up with the exploit code I then hacked a Python script to print a chunk of NOP instructions the assembly code and the buffer address from GDB Running hack py nc localhost 20037 gave me the flie on my machine The remaining challenge was to attack the remote machine when we don t know the stack address I was short on time so I used the quick and dirty brute force approach try every possible address until it works However a bit of intelligence makes the problem tractable First a 32 bit process running on a 32 bit Linux kernel has stacks in the address range 0xbf800000 0xbfffffff This is because the kernel lives in the top 1GB of ram 0xc0000000 and up On a 64 bit kernel the kernel can give the process the entire 32 bit virtual memory space so the stacks live in the range 0xff800000 and up The target was running on a 32 bit kernel so now we are down to 8 4 million addresses Next we don t need to get

    Original URL path: http://www.evanjones.ca/hacking-echod.html (2016-04-30)
    Open archived version from archive

  • van Emde Boas Priority Queue (evanjones.ca)
    all operations in at most O log log n time as opposed to O log n time for the traditional binary heap priority queue The catch is that the keys must be limited to a certain range typically between 0 and some power of 2 As usual the Wikipedia article is very informative I decided to implement the van Emde Boas queue in Python to actually understand how it works

    Original URL path: http://www.evanjones.ca/software/van-emde-boas-queue.html (2016-04-30)
    Open archived version from archive