You can disable the exec-shield functionality globally with
/proc/sys/kernel/exec-shield, but that doesn't do anything different for an
older binary that is not marked or for a binary that is marked as requiring
executable stack. exec-shield is always disabled for those execs.
The issue you are having is probably that malloc does not use PROT_EXEC in
its mmap-based allocations. Executability should be enabled in the brk
area when exec-shield is disabled. Verify the situation by looking at
/proc/PID/maps for the process in question.