Skip to content

Commit 2d4dd10

Browse files
tingshaoaddaleax
authored andcommitted
build: add '-z relro -z now' linker flags
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>
1 parent fcc46ee commit 2d4dd10

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

node.gypi

+4-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,10 @@
291291
[ 'OS=="sunos"', {
292292
'ldflags': [ '-Wl,-M,/usr/lib/ld/map.noexstk' ],
293293
}],
294-
294+
[ 'OS in "freebsd linux"', {
295+
'ldflags': [ '-Wl,-z,relro',
296+
'-Wl,-z,now' ]
297+
}],
295298
[ 'node_use_openssl=="true"', {
296299
'defines': [ 'HAVE_OPENSSL=1' ],
297300
'conditions': [

0 commit comments

Comments
 (0)