[misc] enable ASLR for MinGW builds

* ASLR is enabled by default for Visual Studio builds but that isn't the case
  for MinGW builds. Fix that and also add -Wformat-security while we're at it.
* Closes #1518
* Also ensure that we'll never write protective MBR message for non-bootable
  GPT drives, even as we are not calling WriteSBR() for those anyway.
This commit is contained in:
Pete Batard 2020-04-23 16:48:37 +01:00
parent 0085c4a464
commit 44a8e08bc6
No known key found for this signature in database
GPG Key ID: 38E0CF5E69EDD671
5 changed files with 13 additions and 11 deletions

View File

@ -1,7 +1,7 @@
o Version 3.10 (2020.04.22) o Version 3.10 (2020.04.22)
Improve support for Ubuntu 20.04 Improve support for Ubuntu 20.04
Improve detection of FIXED drives with no mounted partitions Improve detection of FIXED drives with no mounted partitions
Improve extfs formatting Improve extfs formatting (courtesy of Marcos Mello)
Update UEFI:NTFS file system drivers to v1.5 Update UEFI:NTFS file system drivers to v1.5
Fix progress not being updated when using the German localization Fix progress not being updated when using the German localization
Fix primary GPT being overwritten when adding the protective MBR message Fix primary GPT being overwritten when adding the protective MBR message

5
configure vendored
View File

@ -3815,7 +3815,8 @@ $as_echo "#define _GNU_SOURCE /**/" >>confdefs.h
AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x601 -D_WIN32_WINNT=0x601 -D_WIN32_IE=0x800" AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x601 -D_WIN32_WINNT=0x601 -D_WIN32_IE=0x800"
# "-Wl,--nxcompat" to enable DEP (Data Execution Prevention) # "-Wl,--nxcompat" to enable DEP (Data Execution Prevention)
AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined -Wl,--nxcompat -Wl,--no-insert-timestamp" # "-Wl,--dynamicbase" to enable ASLR (Address Space Layout Randomization)
AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined -Wl,--nxcompat -Wl,--no-insert-timestamp -Wl,--dynamicbase"
# Debug symbols # Debug symbols
# Check whether --enable-debug was given. # Check whether --enable-debug was given.
@ -3894,7 +3895,7 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="${saved_CFLAGS}" CFLAGS="${saved_CFLAGS}"
AM_CFLAGS="$AM_CFLAGS -DUNICODE -D_UNICODE -UNDEBUG -DCOBJMACROS -std=gnu99 -Wshadow -Wall -Wundef -Wunused -Wstrict-prototypes -Wno-restrict -Werror-implicit-function-declaration $nopointersign_cflags" AM_CFLAGS="$AM_CFLAGS -DUNICODE -D_UNICODE -UNDEBUG -DCOBJMACROS -std=gnu99 -Wshadow -Wall -Wformat-security -Wundef -Wunused -Wstrict-prototypes -Wno-restrict -Werror-implicit-function-declaration $nopointersign_cflags"

View File

@ -19,7 +19,8 @@ AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions])
AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x601 -D_WIN32_WINNT=0x601 -D_WIN32_IE=0x800" AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x601 -D_WIN32_WINNT=0x601 -D_WIN32_IE=0x800"
# "-Wl,--nxcompat" to enable DEP (Data Execution Prevention) # "-Wl,--nxcompat" to enable DEP (Data Execution Prevention)
AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined -Wl,--nxcompat -Wl,--no-insert-timestamp" # "-Wl,--dynamicbase" to enable ASLR (Address Space Layout Randomization)
AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined -Wl,--nxcompat -Wl,--no-insert-timestamp -Wl,--dynamicbase"
# Debug symbols # Debug symbols
AC_ARG_ENABLE([debug], AC_ARG_ENABLE([debug],
@ -62,7 +63,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[nopointersign_cflags="-Wno-pointer-sign"], [nopointersign_cflags=""]) [nopointersign_cflags="-Wno-pointer-sign"], [nopointersign_cflags=""])
CFLAGS="${saved_CFLAGS}" CFLAGS="${saved_CFLAGS}"
AM_CFLAGS="$AM_CFLAGS -DUNICODE -D_UNICODE -UNDEBUG -DCOBJMACROS -std=gnu99 -Wshadow -Wall -Wundef -Wunused -Wstrict-prototypes -Wno-restrict -Werror-implicit-function-declaration $nopointersign_cflags" AM_CFLAGS="$AM_CFLAGS -DUNICODE -D_UNICODE -UNDEBUG -DCOBJMACROS -std=gnu99 -Wshadow -Wall -Wformat-security -Wundef -Wunused -Wstrict-prototypes -Wno-restrict -Werror-implicit-function-declaration $nopointersign_cflags"
AC_SUBST([VISIBILITY_CFLAGS]) AC_SUBST([VISIBILITY_CFLAGS])
AC_SUBST([AM_CFLAGS]) AC_SUBST([AM_CFLAGS])

View File

@ -923,7 +923,7 @@ static BOOL WriteSBR(HANDLE hPhysicalDrive)
} }
// Use BT_MAX for the protective message // Use BT_MAX for the protective message
if (partition_type == PARTITION_STYLE_GPT) if ((boot_type != BT_NON_BOOTABLE) && (partition_type == PARTITION_STYLE_GPT))
sub_type = BT_MAX; sub_type = BT_MAX;
switch (sub_type) { switch (sub_type) {

View File

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326 IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.10.1647" CAPTION "Rufus 3.10.1648"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0 FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -395,8 +395,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,10,1647,0 FILEVERSION 3,10,1648,0
PRODUCTVERSION 3,10,1647,0 PRODUCTVERSION 3,10,1648,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -414,13 +414,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie" VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting" VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.10.1647" VALUE "FileVersion", "3.10.1648"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.10.exe" VALUE "OriginalFilename", "rufus-3.10.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.10.1647" VALUE "ProductVersion", "3.10.1648"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"