Add a random offset to the Xenon initial timer

Summary: So that when all of the machines reboot at once, we have a random start
time which will translate into smoother logging.
Keep the Period the same, only touch the first timer.
Random number from 1..10000, which keeps it in the range of RAND_MAX as well as
well as gives us a large pool of starting times.

Reviewed By: @markw65

Differential Revision: D1295985
Drop supplementary groups when changing to non-root

Summary: When running HHVM as a non-root user, UID and GID are updated correctly but supplementary groups are not dropped properly. This runs initgroups inside main thread and lightprocess threads to reset groups to those of the specified non-root user.

Reviewed By: @markw65

Differential Revision: D1193229
Revert "Infer types of closure local variables, including captured variables"

Summary: It's assert-failing during a www build

Reviewed By: @jdelong
Binary safety for ext_openssl ASN1 timestamp parsing

Summary: Backport of CVE-2013-6420. Timestamp parsing was not binary safe, NUL bytes cause the strdup'd string to be shorter, but the code used the original length to access the strdup'd buffer.

Reviewed By: @markw65

Differential Revision: D1280477
hhi sync www => fbcode

Summary: hhi sync

Reviewed By: @gabelevi

Differential Revision: D1299037
Delete docs for deleted IR opcode, AllocObjFast

Summary: I broke this opcode up a while back, but apparently forgot to
remove the docs for it then.

Reviewed By: @alexmalyshev

Differential Revision: D1299107
Fix segfault and infinite recursion in fileinfo extension

Summary: This diff applies the patches for CVEs:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-2270
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-1943

Reviewed By: @alexmalyshev

Differential Revision: D1292168
Don't simplify away ConvObjToBool when it could be a collection interface

Summary: Types like ConstSet and Traversable don't have instanceCtor
on their Class*, but it could still be a collection dynamically.

Reviewed By: @swtaarrs

Differential Revision: D1299760
Thrift HHVM extension: support oneway flag in thrift_protocol_write_binary/thrift_protocol_write_compact

Summary: Make it call onewayFlush() so that the transport layer can act appropriately

Reviewed By: mshneer

Differential Revision: D1300330
Catch server errors sooner

Summary: ChannelledJson can fail due to invalid utf8, and probably other
reasons. Since its just a hint, we can simply catch the error, and
leave the response as it was.

The HeaderCallback can do literally anything. So again, catch/log any
exceptions, and carry on.

Reviewed By: afrind

Differential Revision: D1299099
Change Eval.HotFuncThreshold to 40

Summary: Some recent change resulted in a number of cold functions to be marked
as hot.  Most of them were coming from the interpreter-base mechanism
controled by this option.  So I reran a bunch experiments and picked a
value that makes perflab happier these days.

Reviewed By: @swtaarrs

Differential Revision: D1298775
Make handling of code.hot overflows more robust

Summary: Currently, functions marked as hot are emitted in the code.hot TC
section. If this section fills up, then code.main is used
instead. However, the current mechanism assumes that no single
translation will be bigger than a fixed threshold (8KB).  If HHVM is
unlucky and tries to JIT a function bigger than that when there's not
enough space left, then it crashes (see attached task).  Simply
bumping this threshold is undesirable, because it incurs wasted,
unused space in code.hot.

This diff makes the fall-back mechanism for code.hot overflows more
robust. Instead of failing when a code block fills up, the assembler
now throws an exception.  The JIT catches this exception and then
stops using code.hot.

This diff also improves the error messages when a code block fills up,
by including the code-block name in the message.

Reviewed By: @swtaarrs

Differential Revision: D1297793
Allocate Func* table at negative offset from Class*

Summary: Allows class method lookup to be done in one dereference instead of two.

Reviewed By: @swtaarrs

Differential Revision: D1237463
hack: correctly type __call: this in generic classes ...

Summary: ... the previous code was throwing out the types of the
 params to __call (reasonable), but also throwing out any instantiations
 of the return type, which meant that generic params to ## this ## were
 being thrown away.

Reviewed By: @gabelevi

Differential Revision: D1301331
Add support for JIT'ing pseudomains

Summary: This diff adds two new IR opcodes, LdGbl and StGbl to support accessing
global variables in the pseudomain. A LdGbl is a LdLoc with a mandatory
guard on it. A StGbl is just a StLoc, but we generate it only for
pseudomains.

Work Items:
  * Implement suppport for ARM. Just by glancing at the code, ARM
    doesn't have support for doing loads with type tests.

  * Turn on inlining of callsites in the pseudomain, fix bugs.

  * HhbcTranslator will punt on bytecodes that would execute the load of
    a global and its guard AFTER doing effectful operations. Might be
    able to do something smarter so that we don't have to punt.
    (BindL, PushL, SetOpL, StaticLocInit, StaticLoc, all minstrs)

This functionality is gated on Eval.JitPseudomain and
hhvm.eval.jit_pseudomain, and defaults to on.

Reviewed By: @swtaarrs

Differential Revision: D1236672
Corrected a bug with multiple const defs in one line

Summary: A bug in the parser caused only the last constant in a constant expression list to be evaluated corectly.
This diff corrects the issue, and adds a test to prevent it.

Reviewed By: @elgenie

Differential Revision: D1299659
Replace malloc with smart versions (zend-string)

Summary: There's too many uses of malloc in zend-string, so I
am going to go replace them few functions at a time.

Reviewed By: @edwinsmith

Differential Revision: D1301292
backport CVE-2013-4248

Summary: Backport fix of CVE-2013-4248 from
http://git.php.net/?p=php-src.git;a=commit;h=2874696a5a8d46639d261571f915c493cd875897

Reviewed By: afrind

Differential Revision: D1281517
Replace some malloc calls with smart versions

Summary: This is a partial conversion of some of the zend-* functions,
to make them use smart_malloc and StringData APIs, instead of
raw char*'s.

Reviewed By: @scannell

Differential Revision: D1300235
Fix Cns ir opcode output types

Summary: According to http://us3.php.net/define, constants can be null, bool,
int, float, string, and resource. The change itself was pretty simple but it
exposed a bug in the refcount opts where DefLabels weren't being properly
handled. After much thought and discussion, we decided the best way to handle
this is to require DefLabel to indicate which of its destinations should be
forwarding unconsumed references from their sources. See the comment on
IRBuilder::cond for more information.

Reviewed By: @jdelong

Differential Revision: D1294548