Per @Peter Bašista's answer in his own question:
At first, I thought this is an error and that's why I started this
question. But it turned out it's simply a perfectly correct behavior.
It turns out that RTFM saying applies here as well.
man bash reveals, the
ulimit built-in command has additional
-H for setting the so-called hard limits and
for setting the so-called soft limits. Moreover, if none of these
options are given, the default behavior is that
ulimit tries to set
both the soft and the hard limits to the same value at once. And that was the problem.
Now there is a quote from the
bash man page:
A hard limit cannot be increased by a non-root user once it is set;
So, there we go. The correct usage of
ulimit command should always
have this in mind. Most importantly, it should never be used without
-S options unless you are sure to know what you are doing
(which at the time I obviously wasn't).
What I should have done is something like this:
ulimit -H -c unlimited
Each time I want to change maximum core dump size limit
ulimit -S -c
So, that's about it. I hope it could help someone who might struggle
with a similar problem.