Why do 64-bit versions of the programs have better performance, stability and security?

Recently, Google announced that the dev version of Chrome is also available in 64-bit. It will probably also be available for stable versions in the future.

What caught my attention is that Google said that the 64-bit version is 25% faster, that the crash rate has halved and that it is also safer than the 32-bit version.

Are very expressive numbers! But why the simple fact of does compiling in 64-bit bring all these benefits?


Sources:

Author: Giovani, 2014-06-05

3 answers

Before citing the topics you would like to understand, I would like to summarize by saying that x64 software takes advantage of what the x64 OS (operating system) provides, since x32 software on x64 OS is emulated, which ends up not taking advantage of the maximum performance that the machine and the OS are capable of.

Speed

About this is the same idea of the architecture of processors that address more memory. X32 Software can use up to 2^32 bits memory addressing, while an x64 stores up to 2^64 bits. In cases where the OS is x64 and the software is x32 an emulation process is done to avoid conflicts.

Quoted in one of your links:

64-bit allows us to take advantage of more processor and compiler optimizations, a more modern instruction set, and a calling convention that allows more function parameters to be passed quickly to the registers.

Being thus, as I mentioned, it takes advantage of benefits that are only available in the x64 architecture, which are lost when the processor is "forced" not to use all its memory addressing.

Another point that we can mention is that the browser because it is x64 thus becomes fully compatible with x64 applications/plugins, such as flash player for example. Thus it is possible to justify the part in which they say:

As a result, the speed is improved, especially in graphics and multimedia content , where we see an average improvement of 25% in performance.

Security

- > use of ASLR for greater security against malware

ASLR is a security feature that causes data locations of a program to be randomly arranged in memory. Prior to ASLR, locations where a program's data was stored in memory could be predictable, which made attacks on a program much easier. With ASLR, an attacker (hacker) has to guess the correct location in memory when trying to exploit a vulnerability in a program. An incorrect assumption can result in the "fall" of the program, so that the attacker will not be able to try again.

This security feature is also used in versions of Windows and other 32-bit operating systems, but is much more powerful in 64-bit versions of Windows. A 64-bit system has a much larger address space than a 32-bit system, making ASLR much more effective.

Including in one of the links you posted has a part that speaks like this:

In addition, 64-bit Chrome is able to take advantage of windows ' most current security features, such as Address Space Load Randomization (ASLR).

To better clarify about emulation of X32 software on OS x64:

Pulled from: http://tecnologiaurbana.com.br/2007/05/diferencas-entre-windows-x32-x64 /

AMD64 and IA64T processors have 3 different operating modes

32-bit mode: it is possible to install a 32-bit operating system on these systems and run 32-bit programs, however, they will not be able to make use of the new unique 64-bit features such as actual memory addressing above 4GB or GPRs registrars.

Mode compatibility: it is an intermediate mode of full mode. To run in compatibility mode, you need to install a 64-bit operating system with 64-bit drivers. Compatibility mode with a 64-bit operating system makes it possible to run 32-bit programs without modifications. Each 32-bit program must be limited to a maximum of 4 GB of physical memory. However, this 4GB limit is imposed on a pre-process level and not on a system level. This means that each 32-bit process on this system can have its own memory block of 4 GB of physical memory space (assuming you have enough physical memory installed).

64-bit full mode: this mode is activated when running 64-bit programs on 64-bit operating systems. In this mode, a program can have a virtual address space of up to 40 bits (about 1 TB of addressable memory). Programs running in full mode will have access to all physical memory installed and to the system expanded GPRs. But it is important to understand that this mode of operation will only be active on a 64-bit operating system with 64-bit drivers running 64-bit programs.

Stability

This question is a bit more complicated, but from what I could understand in the case of chrome, they had quite a lot of crashes during rendering processes. How should you know rendering process uses quite a lot of capacity computational, even if you search will see several complaints about people complaining that chrome used 100% CPU to render and then crashed, this ends up decreasing if chrome has in its hands the chance to use more memory I believe.

As I quoted, We can verify this issue by following what Intel said regarding the benefits of using x64:

More access to physical memory

The native x64 applications, combined with x64 editions of Windows Server and with the appropriate hardware can access up to 2 terabytes (TB) of physical RAM, allowing you to run memory-intensive server applications.

Eliminate virtual address limitations

On 32-bit systems, connection-oriented applications require the operating system kernel to utilize a portion of its 2 gigabyte memory space. When applications, such as terminal servers, scale to support more users, this memory allocation limit can become an obstacle regardless of the capacity of the system's physical RAM. Windows Server x64 editions provide an 8 TB virtual address space for the kernel and for each system process.

Improved Performance

While 32-bit applications perform similarly on 32-bit editions of Windows Server and x64 editions of Windows Server, native x64 applications they can show significant performance improvements, particularly for applications with high processing demand.

------- Edit ----------

WOW64

WoW64 (Windows 32-bit on Windows 64-bit) is a subsystem of the Windows operating system capable of running 32-bit applications and is included in all 64-bit versions of Windows.

This emulator has some dlls for this to occur:

  • Wow64.dll provides the core emulation infrastructure and the subsurface, for Ntoskrnl entry point functions.exe.
  • Wow64win.dll provides "thunks" for entry point functions Win32k.sys.
  • Wow64Cpu.dll is an interface library that abstracts features from the host processor.
  • (Intel Itanium only) IA32Exec.bin contains x86 emulator software.
  • (Intel Itanium only) Wowia32x.dll provides the interface between IA32Exec.bin is WOW64.

As an official Microsoft topic, we can see that the company itself claims that running x32 software on x64 OS is not a perfect process: Link: http://msdn.microsoft.com/en-gb/library/windows/desktop/aa384219 (v=vs. 85).aspx

Instruction emulation is performed on the chip. On the x64 processor, instructions are natively executed by the micro-architecture. Therefore, the speed of execution in the WOW64 in x64 is Similar to its 32-bit Windows speed. On the Intel Itanium processor, more software is involved in emulation and the performance suffers as a result.

In the US Wikipedia page about this, one more important detail is cited: http://en.wikipedia.org/wiki/WoW64

According to Microsoft, 32-bit software running under WOW64 has a similar performance when executing under 32-bit Windows, but with fewer threads possible and other overheads.

As you might imagine (even if it's not good), native x32 dlls are different from WOW64 dlls:

Http://www.nynaeve.net/?p=131

If we look at the native ntdll x86, we see the call expected by the systemcallstub pointers in SharedUserData:

0: 000 > U ntdll! NtClose

Ntdll ZwClose:

Mov eax, 30h

Mov edx, offset SharedUserData! Systemcallstub

Call dword ptr [edx]

Ret 4

However, an examination of Wow64 shows ntdll something different; a call is made through a field in the offset + C0 in the 32-bit TEB:

0: 000 > U ntdll! NtClose

Ntdll ZwClose:

Eax mov, 0ch

XOR ecx, ecx

Read edx, [esp + 4]

Call PTR dword fs: [0C0h]

Ret 4

I still think necessary comment on a bug in WOW64 ( so far not fixed in Windows 7 according to information from blogs that explain the subject):

Bug: http://zachsaw.blogspot.com.br/2010/11/wow64-bug-getthreadcontext-may-return.html

Refers to: Boehm Garbage Collector (Boehm GC)

 8
Author: Giovani, 2014-06-08 22:56:55

Security

With a 64-bit system it is possible to use ASLR which roughly protects against stack overflow (or buffer overflow) attacks. Thus preventing the cracker from jumping from an exploid to a direct function (IAT Hook or other types of hook like Detours can also be avoided with this). It facilitates the use of polymorphism that is widely used by malware but can also be used by common programs to not have a constant "signature" in their functions, and this is very useful, since most hooks use a memory scan to find patterns, thus finding the address of a function for example.

Speed

Programs running at 64-bit have faster access to the registry (as it is a different registry than 32-bit). more information

In addition to the advantages listed above, to date debugs (such as OllyODBG and IDA) have difficulty reading 64-bit systems, that's not what will leave the safest system, but this already prevents 80% of "ordinary" crackers from doing anything.

Simple class of Polymorph Polychaos

 12
Author: brhvitor6, 2014-06-05 11:54:16

The answer is in the very link of the Question: the Chromiun Blog - Try out the new 64-bit Windows Canary and Dev channels.

The increase in speed is not only because it is 64-bit, but because the architecture of the x86-64 processors has had several other changes that have improved performance (i.e. not only larger registers, but also more registers and new instructions).

64-bit allows us to take more advantage of the processor and compiler optimizations, a more modern instruction set, and a calling convention that allows more function parameters to be passed quickly in registers.

Call convention is how the program organizes the parameters for a function call. This is specific to the combination processor + operating system, and by having more registers an x86 - 64 has the possibility to pass more parameters in registers instead of putting in the stack, which tends to be slower.

Especially in graphics and multimedia content

Graphics and Multimedia very much apply a repeated operation to various numbers (to transform pixels, for example), and for a long time processors have been gaining more instructions that help do this, since the time of MMX, then SSE, SSE2, and 64-bit processors have even more SSE registers than 32-bit ones.

And about security, it was already well explained there in Giovani's post, with more bits for the pointers, it is possible to allocate memory in a less predictable way, preventing malicious code from predicting where some important data structure has been inserted in memory.

 4
Author: marcus, 2014-06-08 06:24:42