Skip to content

Commit

Permalink
build: add '-z relro -z now' linker flags
Browse files Browse the repository at this point in the history
These flags could make some sections and the GOT entries of node
process read only to avoid being modified after dynamic linking is
done, thus the security could be enhanced.

Fixes: #20122
PR-URL: #20513
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
tingshao authored and addaleax committed May 14, 2018
1 parent fcc46ee commit 2d4dd10
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion node.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,10 @@
[ 'OS=="sunos"', {
'ldflags': [ '-Wl,-M,/usr/lib/ld/map.noexstk' ],
}],

[ 'OS in "freebsd linux"', {
'ldflags': [ '-Wl,-z,relro',
'-Wl,-z,now' ]
}],
[ 'node_use_openssl=="true"', {
'defines': [ 'HAVE_OPENSSL=1' ],
'conditions': [
Expand Down

0 comments on commit 2d4dd10

Please sign in to comment.