[PATCH] Improved handling of git syntax names with no git repository

Lubomir I. Ivanov neolit123 at gmail.com
Sat Mar 15 06:43:13 PDT 2014


On 15 March 2014 03:22, Thiago Macieira <thiago at macieira.org> wrote:
> Em sex 14 mar 2014, às 18:15:13, Linus Torvalds escreveu:
>> And no, no sane OS will have anything in the NULL pointer page. People
>> used to do it. They don't do it any more. People who used to do it are
>> morons, since they won't get SIGSEGV on NULL pointers.
>
> Indeed. But Solaris still offers the library if you happen to use such bad
> software...
>
> http://docs.oracle.com/cd/E26502_01/html/E29030/ld.so.1-1.html#scrolltoc
>

that's quite bad,

monseur le standard (c99, 7.1.4) says that arguments of the standard
library function must be valid, e.g. not NULL pointers.
which makes their "argument" about the "0" library not existing.

loading a library into the process heap that will map the 0x0 address
to a valid address that has the value of 0 for the prevention of a
SIGSEGV from passing a NULL pointer to something like strcpy() is a
hack that promotes bad programming practices.

>> But any value in the range -128 to 127 is fine by me (that's the magic
>> "easy to generate on all halfway sane architectures" numeric range)
>
> So why didn't you start with 1 or -1? Did you use 8 for alignment on purpose?
>

i'm pretty sure that alignment of the virtual addresses from an
alloc() call should be a power of two (unless we are targeting a
potato or alien tech?), which means no odd numbers.
so any 2n + 1 address should be invalid.

char *m = (char *)malloc(...);
if (*(uintptr_t *)m % 2)
   return error(...);

...and unless i'm horribly wrong and/or an OS has decided to be a bit slower.

lubomir
--


More information about the subsurface mailing list