where do default file permissions before umask come from?

AFAIK it's hard-coded (in some sense) into every program that can create files.  I basically agree with @Thor: it's typically 777 for directories and executable files (i.e., compilers use 777), and 666 for all others (data files, named pipes, "special" (device) files, etc.)  The default mode for file-system sockets would probably have to be hard-coded in the kernel, since AFAIK the bind system call doesn't allow the program to specify that.

I said "in some sense" because many programs use library functions (e.g., fopen in the stdio package) to do file I/O, so in their case the default mode is hard-coded in the library function.


That said, it's possible that some versions of *nix have a configuration file somewhere, and some or all programs and library functions read this configuration file to get the default mode.