]> granicus.if.org Git - strace/commit
Roll back "die on malloc failure" behaviour a bit
authorDenys Vlasenko <dvlasenk@redhat.com>
Thu, 1 Sep 2011 14:35:44 +0000 (16:35 +0200)
committerDenys Vlasenko <dvlasenk@redhat.com>
Thu, 1 Sep 2011 14:35:44 +0000 (16:35 +0200)
commit79a79ea851250a30005d6323b20a9e30d9f336c1
tree7f8c69bae9d6a209287e0d8d457dba8b3d1d30ad
parent0a295bc97fd2ba9e6dc02f382dc87bc8705dc4d0
Roll back "die on malloc failure" behaviour a bit

After recent change, select(2^31-1, NULL, NULL, NULL)
would make strace exit. This change caps fdsize so that
it is always in [0, 1025*1024], IOW: we will try to allocate at most
1 megabyte, which in practice will almost always work,
unlike malloc(2Gig).

* desc.c (decode_select): Cap fdsize to 1024*1024.
* pathtrace.c (pathtrace_match): Cap fdsize to 1024*1024.
* file.c (sys_getdents): Cap len to 1024*1024.
(sys_getdents64): Cap len to 1024*1024.
* util.c (dumpiov): Refuse to process iov with more than 1024*1024
elements. Don't die on malloc failure.
(dumpstr): Don't die on malloc failure.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
desc.c
file.c
pathtrace.c
util.c