-
Notifications
You must be signed in to change notification settings - Fork 435
Description
Description
Currently mozc_tip32.dll and mozc_tip64.dll are built with /BASE option.
Lines 155 to 157 in af20906
| 'VCLinkerTool': { | |
| 'BaseAddress': '0x06000000', | |
| }, |
Lines 174 to 176 in af20906
| 'VCLinkerTool': { | |
| 'BaseAddress': '0x06000000', | |
| }, |
This is however now discouraged as follows.
Note
For security reasons, Microsoft recommends you use the
/DYNAMICBASEoption instead of specifying base addresses for your executables./DYNAMICBASEgenerates an executable image that can be randomly rebased at load time by using the address space layout randomization (ASLR) feature of Windows. The/DYNAMICBASEoption is on by default.
You can also find the following warning while building Mozc for Windows (e.g. from build #186)
[456/457] LINK_EMBED(DLL) mozc_tip64.dll
LINK : warning LNK4281: undesirable base address 0x6000000 for x64 image; set base address above 4GB for best ASLR optimization
Also from Does ASLR relocate all DLLs by the same offset? - The Old New Thing
ASLR chooses the base address pseudo-randomly, though it does take some of the original base addresses into account. For example, if the original base address was below the 4GB boundary, then the new pseudo-random base address will also be below the 4GB boundary.
Steps to reproduce
- Build and install Mozc for Windows
dumpbin /HEADERS .\out_win\Release\mozc_tip32.dlldumpbin /HEADERS .\out_win\Release_x64\mozc_tip64.dll- Launch Notepad (64-bit)
- Select Mozc as the current IME
Expected behavior
- At the step 5,
mozc_tip64.dllis loaded into somewhere above0x100000000
Expected result in the step 2
OPTIONAL HEADER VALUES
10B magic # (PE32)
(snip)
6000000 image base (06000000 to 064D0FFF)
(snip)
2 subsystem (Windows GUI)
140 DLL characteristics
Dynamic base
NX compatible
Expected result in the step 3
OPTIONAL HEADER VALUES
20B magic # (PE32+)
(snip)
6000000 image base (0000000006000000 to 000000000650CFFF)
(snip)
2 subsystem (Windows GUI)
160 DLL characteristics
High Entropy Virtual Addresses
Dynamic base
NX compatible
Actual behavior
- At the step 5,
mozc_tip64.dllis loaded into somewhere below0x100000000(not as expected).
Actual result in the step 2
OPTIONAL HEADER VALUES
10B magic # (PE32)
(snip)
10000000 image base (10000000 to 104D0FFF)
1000 section alignment
(snip)
2 subsystem (Windows GUI)
140 DLL characteristics
Dynamic base
NX compatible
Actual result in the step 3
OPTIONAL HEADER VALUES
20B magic # (PE32+)
(snip)
180000000 image base (0000000180000000 to 000000018050CFFF)
(snip)
2 subsystem (Windows GUI)
160 DLL characteristics
High Entropy Virtual Addresses
Dynamic base
NX compatible
Screenshots
Version or commit-id
Environment
- OS: Windows 11 22H2