As the alloca man page says:
There is no error indication if the stack frame cannot be extended.
(However, after a failed allocation, the program is likely to receive
a SIGSEGV signal if it attempts to access the unallocated space.)
So there is no indication at all and it also says:
If the allocation causes stack overflow, program behavior is undefined.
The stack overflow problem is a general issue with recursion and not really particular to alloca
or let's say variable length arrays. Typically you either need to find a way to limit the depth of the recursion, refactor to an iterative solution or use your own dynamic stack(probably does not apply to this case).
Update
As the OP discovered Linux does provide an after the fact indication using a guard page after the stack of stack overflow by generating a SIGBUS
signal, which addresses the first part of the question.