fetchmail-friends
[Top] [All Lists]

Re: [fetchmail] about that fetchmail imap message count vulnerability and alloca()

2002-07-05 13:50:06
Andreas Hasenack <andreas(_at_)conectiva(_dot_)com(_dot_)br> writes:

Em Thu, Jul 04, 2002 at 03:37:07PM +0200, Matthias Andree escreveu:
So, what's the point in using it anyway? I didn't get a segfault 
alloca()ting
1Gb of memory, but the next printf() in my sample program crashed. Isn't
that too much instability for fetchmail?

Well, you cannot expect to be able to recover from out-of-memory
conditions anyways. As competing processes fight for memory, you may
lose memory you intended to use for a graceful exit, like saving state
or something. Indeed, that's vexing, but such is life with multi-tasking
operating systems.

I can't believe I'm reading this, I truly hope I'm mistaken. I think you
are talking about the situation where one has the overcommit bit
enabled.

Linux always overcommits (unless I missed the change).

Or are you truly saying that it's OK for that function to return an
invalid pointer and that we should live with it, just waiting for the
next segfault to happen? What's the point?

alloca() stinks. Apart from that, for the user, it makes no difference
if the program exits uncleanly because it fails to do a graceful exit
(memory pressure may even have increased, the "graceful exit" may need
more memory) or because alloca() returned a pointer to an overcommitted
page.

I don't know on which system fetchmail is developed, probably a system
where alloca works as expected, returning NULL when the requested
ammount of memory is not available (as the manpage says it should).

BTW, there is a local implementation of alloca included in the fetchmail
source, I'll try that one.

Please share your findings.

-- 
Matthias Andree