Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 694100 - net-libs/nodejs-12.10.0 on a pax-enabled (grsecurity) kernel - #FailureMessage Object: 0x72d4f41ff200/bin/sh: line 1: 17291 Illegal instruction ".../work/node-v12.10.0/out/Release/mkcodecache" ".../work/node-v12.10.0/out/Release/obj/gen/node_code_cach
Summary: net-libs/nodejs-12.10.0 on a pax-enabled (grsecurity) kernel - #FailureMessag...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Hardened (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: William Hubbs
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2019-09-11 20:05 UTC by Attila Tóth
Modified: 2023-10-18 16:37 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
node-v12.8.1-mknodecache-node_mksnapshot.patch (node-v12.8.1-mkcodecache-node_mksnapshot.patch,2.45 KB, patch)
2019-09-11 20:30 UTC, Attila Tóth
Details | Diff
Add actions to pax mark needed files (nodejs-paxmarking.patch,2.65 KB, patch)
2019-11-12 20:49 UTC, Magnus Granberg
Details | Diff
mksnapshot_paxmark.patch (mksanpshot_paxmark.patch,1.68 KB, patch)
2019-12-11 23:16 UTC, Attila Tóth
Details | Diff
Updated patch to pax mark needed files (nodejs-paxmarking.patch,4.11 KB, patch)
2019-12-17 21:25 UTC, Magnus Granberg
Details | Diff
nodejs-16.4.2-paxmarking.patch (nodejs-16.4.2-paxmarking.patch,4.16 KB, patch)
2022-05-03 17:19 UTC, Attila Tóth
Details | Diff
nodejs-18.0.0-paxmarking.patch (nodejs-18.0.0-paxmarking.patch,4.24 KB, patch)
2022-05-03 17:20 UTC, Attila Tóth
Details | Diff
nodejs-18.3.0-paxmarking.patch (nodejs-18.3.0-paxmarking.patch,3.23 KB, patch)
2022-06-10 06:32 UTC, Attila Tóth
Details | Diff
nodejs-20.3.0-paxmarking.patch (nodejs-20.3.0-paxmarking.patch,3.28 KB, patch)
2023-10-06 18:03 UTC, Attila Tóth
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Attila Tóth 2019-09-11 20:05:56 UTC
x86_64-pc-linux-gnu-g++ -o /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/mkcodecache -pthread -rdynamic -m64 -Wl,-z,noexecstack -Wl,--whole-archive /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/tools/v8_gypfiles/libv8_snapshot.a -Wl,--no-whole-archive -Wl,-z,relro -Wl,-z,now -Wl,-O1 -Wl,--as-needed -Wl,--start-group /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/mkcodecache/src/node_snapshot_stub.o /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/mkcodecache/src/node_code_cache_stub.o /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/mkcodecache/tools/code_cache/mkcodecache.o /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/mkcodecache/tools/code_cache/cache_builder.o /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/libnode.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/deps/histogram/libhistogram.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/tools/v8_gypfiles/libv8_libplatform.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/deps/llhttp/libllhttp.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/deps/brotli/libbrotli.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/tools/v8_gypfiles/libv8_base_without_compiler.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/tools/v8_gypfiles/libv8_libbase.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/tools/v8_gypfiles/libv8_libsampler.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/tools/v8_gypfiles/libv8_compiler.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/tools/v8_gypfiles/libv8_snapshot.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/tools/v8_gypfiles/libv8_initializers.a -lz -lhttp_parser -luv -lcares -lnghttp2 -lcrypto -lssl -licui18n -licuuc -licudata -ldl -lrt -Wl,--end-group
  x86_64-pc-linux-gnu-g++ -o /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/node_mksnapshot -pthread -rdynamic -m64 -Wl,-z,noexecstack -Wl,--whole-archive /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/tools/v8_gypfiles/libv8_snapshot.a -Wl,--no-whole-archive -Wl,-z,relro -Wl,-z,now -Wl,-O1 -Wl,--as-needed -Wl,--start-group /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/node_mksnapshot/src/node_snapshot_stub.o /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/node_mksnapshot/src/node_code_cache_stub.o /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/node_mksnapshot/tools/snapshot/node_mksnapshot.o /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/node_mksnapshot/tools/snapshot/snapshot_builder.o /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/libnode.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/deps/histogram/libhistogram.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/tools/v8_gypfiles/libv8_libplatform.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/deps/llhttp/libllhttp.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/deps/brotli/libbrotli.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/tools/v8_gypfiles/libv8_base_without_compiler.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/tools/v8_gypfiles/libv8_libbase.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/tools/v8_gypfiles/libv8_libsampler.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/tools/v8_gypfiles/libv8_compiler.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/tools/v8_gypfiles/libv8_snapshot.a /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj.target/tools/v8_gypfiles/libv8_initializers.a -lz -lhttp_parser -luv -lcares -lnghttp2 -lcrypto -lssl -licui18n -licuuc -licudata -ldl -lrt -Wl,--end-group
  LD_LIBRARY_PATH=/var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/lib.host:/var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../.; mkdir -p /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj/gen; "/var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/mkcodecache" "/var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj/gen/node_code_cache.cc"
  LD_LIBRARY_PATH=/var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/lib.host:/var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../.; mkdir -p /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj/gen; "/var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/node_mksnapshot" "/var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj/gen/node_snapshot.cc"


#
# Fatal error in , line 0
# Check failed: reservation_.SetPermissions(protect_start, protect_size, permission).
#
#
#
#FailureMessage Object: 0x7530cb29d8e0
==== C stack trace ===============================

    /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/mkcodecache(v8::base::debug::StackTrace::StackTrace()+0x16) [0x1a3e14dd1366]
    /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/mkcodecache(+0x743d8b) [0x1a3e1478fd8b]
    /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/mkcodecache(V8_Fatal(char const*, ...)+0x179) [0x1a3e14dcc8f9]
    /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/mkcodecache(+0x8e6ef3) [0x1a3e14932ef3]
    /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/mkcodecache(v8::internal::PagedSpace::SetReadAndExecutable()+0x97) [0x1a3e149358c7]
    /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/mkcodecache(v8::internal::Isolate::Init(v8::internal::ReadOnlyDeserializer*, v8::internal::StartupDeserializer*)+0xa55) [0x1a3e148890f5]
    /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/mkcodecache(v8::internal::Snapshot::Initialize(v8::internal::Isolate*)+0x6b7) [0x1a3e14b36e07]
    /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/mkcodecache(v8::Isolate::Initialize(v8::Isolate*, v8::Isolate::CreateParams const&)+0xe2) [0x1a3e1480d0a2]
    /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/mkcodecache(v8::Isolate::New(v8::Isolate::CreateParams const&)+0x20) [0x1a3e1480d1a0]
    /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/mkcodecache(main+0x13a) [0x1a3e144c166a]
    /lib64/libc.so.6(__libc_start_main+0xeb) [0x6d24c955beab]
    /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/mkcodecache(_start+0x2a) [0x1a3e144c746a]


#
# Fatal error in , line 0
# Check failed: reservation_.SetPermissions(protect_start, protect_size, permission).
#
#
#
#FailureMessage Object: 0x72d4f41ff200/bin/sh: line 1: 17291 Illegal instruction     "/var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/mkcodecache" "/var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj/gen/node_code_cache.cc"
make: *** [node.target.mk:13: /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj/gen/node_code_cache.cc] Error 132
make: *** Waiting for unfinished jobs....
/bin/sh: line 1: 17292 Illegal instruction     "/var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/node_mksnapshot" "/var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj/gen/node_snapshot.cc"
make: *** [node.target.mk:26: /var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out/Release/obj/gen/node_snapshot.cc] Error 132
rm 3e91ef147741655706c7f24310f142339aff506c.intermediate ae22588cbd35cde23e56c78ddab1aa4ecf59880c.intermediate 02fc2535e7fcde8de8261c3edb8dca4cc07de133.intermediate
make: Leaving directory '/var/tmp/portage/net-libs/nodejs-12.10.0/work/node-v12.10.0/out'
Comment 1 Attila Tóth 2019-09-11 20:30:25 UTC
Created attachment 589696 [details, diff]
node-v12.8.1-mknodecache-node_mksnapshot.patch

Proposed patch to take care of pax-marking compile-time binaries. Works for me.
Comment 2 Magnus Granberg gentoo-dev 2019-09-12 15:46:20 UTC
We allready mark it in the ebuild but do we need new one?
We have turn of default pax marking in all profiles and we have
no ways to test it when we don't have access to pax/grsec.
If we need a new take a look on qtwebengine how it is done there.
Comment 3 Attila Tóth 2019-09-12 17:20:33 UTC
(In reply to Magnus Granberg from comment #2)
> We allready mark it in the ebuild but do we need new one?
> We have turn of default pax marking in all profiles and we have
> no ways to test it when we don't have access to pax/grsec.
> If we need a new take a look on qtwebengine how it is done there.

The ebuild marks the build-time executable "mksnapshot". One may simply issue make for that executable and take care of the marking in the ebuild.
While these two new build-time executables are different (node_mksnapshot, mkcodecache) and showed up only recently (in nodejs-12.x). I could find a way to mark them the same way as it works for mksnapshot.
The current qtwebengine build is a little different, this nodejs thing is close to a previous version (qtwebengine-5.6.1).
I'm really afraid, that I will be left alone eventually with these problems because of the lack of people still having access to grsecurity. I may not be able to take care of these forever.
However I felt, that I don't want to keep this patch for myself and others might still make use of it just in case...
Comment 4 Patrick McLean gentoo-dev 2019-09-18 00:22:22 UTC
I can reproduce this issue on a 4.14.142 grsecurity kernel, but the patch does not fix it for me.
Comment 5 Attila Tóth 2019-09-18 05:30:10 UTC
(In reply to Patrick McLean from comment #4)
> I can reproduce this issue on a 4.14.142 grsecurity kernel, but the patch
> does not fix it for me.

I have access to beta patches. I'll try to retest it with the latest beta.
Comment 6 Attila Tóth 2019-10-02 08:54:50 UTC
(In reply to Attila Tóth from comment #5)
> (In reply to Patrick McLean from comment #4)
> > I can reproduce this issue on a 4.14.142 grsecurity kernel, but the patch
> > does not fix it for me.
> 
> I have access to beta patches. I'll try to retest it with the latest beta.

The situation is the same for net-libs/openjs-12.11.0 from the anarchy overlay. It fails without the patch. The proposed patch solves the problem on my systems running grsec beta (5.2.17-201909242038). This is not the latest, because there is a fresh beta from yesterday I will only be able to use later today or tomorrow. But I would expect the same.
Comment 7 Magnus Granberg gentoo-dev 2019-11-08 21:59:10 UTC
The patch faile to applay to nodejs-6-16-2
Comment 8 Attila Tóth 2019-11-08 23:37:59 UTC
(In reply to Attila Tóth from comment #6)
> (In reply to Attila Tóth from comment #5)
> > (In reply to Patrick McLean from comment #4)
> > > I can reproduce this issue on a 4.14.142 grsecurity kernel, but the patch
> > > does not fix it for me.
> > 
> > I have access to beta patches. I'll try to retest it with the latest beta.
> 
> The situation is the same for net-libs/openjs-12.11.0 from the anarchy
> overlay. It fails without the patch. The proposed patch solves the problem
> on my systems running grsec beta (5.2.17-201909242038). This is not the
> latest, because there is a fresh beta from yesterday I will only be able to
> use later today or tomorrow. But I would expect the same.

My observations are still the same for nodejs-13.0.1 vs grsec-3.1-5.3.8-201911041113. The attached patch takes care of the issue.
Comment 9 Magnus Granberg gentoo-dev 2019-11-12 20:49:19 UTC
Created attachment 595918 [details, diff]
Add actions to pax mark needed files

Smaller patch, testing needed.
no need to pax mark in src_compile
Comment 10 Attila Tóth 2019-11-12 22:33:28 UTC
(In reply to Magnus Granberg from comment #9)
> Created attachment 595918 [details, diff] [details, diff]
> Add actions to pax mark needed files
> 
> Smaller patch, testing needed.
> no need to pax mark in src_compile

Patch tested right, but I haven't modified src_compile. Thx: Dw.
Comment 11 Magnus Granberg gentoo-dev 2019-11-19 20:40:09 UTC
Jer is it okay to applay the patch as what is don in qtwebengine?
Comment 12 Larry the Git Cow gentoo-dev 2019-11-27 21:37:51 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d3b53be221b0288c4eb5155ad52fa8f27bda083d

commit d3b53be221b0288c4eb5155ad52fa8f27bda083d
Author:     Magnus Granberg <zorry@gentoo.org>
AuthorDate: 2019-11-27 21:28:02 +0000
Commit:     Magnus Granberg <zorry@gentoo.org>
CommitDate: 2019-11-27 21:29:14 +0000

    net-libs/nodejs: Fix build on PAX enable kernel (bug 694100)
    
    We need to disable mprotect on two bins when we compile
    bug 694100.
    
    Closes: https://bugs.gentoo.org/694100
    Reported-by: Attila Tóth <atoth@atoth.sote.hu>
    Co-developed-by: Attila Tóth <atoth@atoth.sote.hu>
    Signed-off-by: Magnus Granberg <zorry@gentoo.org>
    Package-Manager: Portage-2.3.76, Repoman-2.3.16

 .../nodejs/files/nodejs-13.2.0-paxmarking.patch    | 71 ++++++++++++++++++++++
 net-libs/nodejs/metadata.xml                       |  1 +
 net-libs/nodejs/nodejs-13.2.0.ebuild               |  8 ++-
 net-libs/nodejs/nodejs-99999999.ebuild             |  8 ++-
 4 files changed, 82 insertions(+), 6 deletions(-)
Comment 13 Attila Tóth 2019-12-10 14:26:36 UTC
(In reply to Larry the Git Cow from comment #12)
> The bug has been closed via the following commit(s):
> 
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=d3b53be221b0288c4eb5155ad52fa8f27bda083d
> 
> commit d3b53be221b0288c4eb5155ad52fa8f27bda083d
> Author:     Magnus Granberg <zorry@gentoo.org>
> AuthorDate: 2019-11-27 21:28:02 +0000
> Commit:     Magnus Granberg <zorry@gentoo.org>
> CommitDate: 2019-11-27 21:29:14 +0000
> 
>     net-libs/nodejs: Fix build on PAX enable kernel (bug 694100)
>     
>     We need to disable mprotect on two bins when we compile
>     bug 694100.
>     
>     Closes: https://bugs.gentoo.org/694100
>     Reported-by: Attila Tóth <atoth@atoth.sote.hu>
>     Co-developed-by: Attila Tóth <atoth@atoth.sote.hu>
>     Signed-off-by: Magnus Granberg <zorry@gentoo.org>
>     Package-Manager: Portage-2.3.76, Repoman-2.3.16
> 
>  .../nodejs/files/nodejs-13.2.0-paxmarking.patch    | 71
> ++++++++++++++++++++++
>  net-libs/nodejs/metadata.xml                       |  1 +
>  net-libs/nodejs/nodejs-13.2.0.ebuild               |  8 ++-
>  net-libs/nodejs/nodejs-99999999.ebuild             |  8 ++-
>  4 files changed, 82 insertions(+), 6 deletions(-)

Hi Zorry,

Unfortunately I have to raise this bug again.
The patch takes care of marking node_mksnapshot and mkcodecache during compile. There is a third executable needs marking: mksnapshot, which had been handled by the ebuild previously. By the advent of the patch, those lines handling mksnapshot marking were removed:
@@ -124,8 +128,6 @@ src_configure() {
 }
 
 src_compile() {
-	emake -C out mksnapshot
-	pax-mark m "out/${BUILDTYPE}/mksnapshot"
 	emake -C out
 }

For this reason nodejs failed to compile again. Either these lines must be reintroduced into the ebuilds or a separate or extended patch should be provided taking care of mksnapshot on top of node_mksnapshot and mkcodecache.

What is your opinion about it?
Comment 14 Magnus Granberg gentoo-dev 2019-12-11 16:44:59 UTC
(In reply to Attila Tóth from comment #13)
> (In reply to Larry the Git Cow from comment #12)
> > The bug has been closed via the following commit(s):
> > 
> > https://gitweb.gentoo.org/repo/gentoo.git/commit/
> > ?id=d3b53be221b0288c4eb5155ad52fa8f27bda083d
> > 
> > commit d3b53be221b0288c4eb5155ad52fa8f27bda083d
> > Author:     Magnus Granberg <zorry@gentoo.org>
> > AuthorDate: 2019-11-27 21:28:02 +0000
> > Commit:     Magnus Granberg <zorry@gentoo.org>
> > CommitDate: 2019-11-27 21:29:14 +0000
> > 
> >     net-libs/nodejs: Fix build on PAX enable kernel (bug 694100)
> >     
> >     We need to disable mprotect on two bins when we compile
> >     bug 694100.
> >     
> >     Closes: https://bugs.gentoo.org/694100
> >     Reported-by: Attila Tóth <atoth@atoth.sote.hu>
> >     Co-developed-by: Attila Tóth <atoth@atoth.sote.hu>
> >     Signed-off-by: Magnus Granberg <zorry@gentoo.org>
> >     Package-Manager: Portage-2.3.76, Repoman-2.3.16
> > 
> >  .../nodejs/files/nodejs-13.2.0-paxmarking.patch    | 71
> > ++++++++++++++++++++++
> >  net-libs/nodejs/metadata.xml                       |  1 +
> >  net-libs/nodejs/nodejs-13.2.0.ebuild               |  8 ++-
> >  net-libs/nodejs/nodejs-99999999.ebuild             |  8 ++-
> >  4 files changed, 82 insertions(+), 6 deletions(-)
> 
> Hi Zorry,
> 
> Unfortunately I have to raise this bug again.
> The patch takes care of marking node_mksnapshot and mkcodecache during
> compile. There is a third executable needs marking: mksnapshot, which had
> been handled by the ebuild previously. By the advent of the patch, those
> lines handling mksnapshot marking were removed:
> @@ -124,8 +128,6 @@ src_configure() {
>  }
>  
>  src_compile() {
> -	emake -C out mksnapshot
> -	pax-mark m "out/${BUILDTYPE}/mksnapshot"
>  	emake -C out
>  }
> 
> For this reason nodejs failed to compile again. Either these lines must be
> reintroduced into the ebuilds or a separate or extended patch should be
> provided taking care of mksnapshot on top of node_mksnapshot and mkcodecache.
> 
> What is your opinion about it?

make a patch that take care of mksnapshot.
Comment 15 Attila Tóth 2019-12-11 23:16:45 UTC
Created attachment 599250 [details, diff]
mksnapshot_paxmark.patch

Separate patch to handle mksnapshot.
Comment 16 Attila Tóth 2019-12-11 23:17:26 UTC
(In reply to Magnus Granberg from comment #14)
> (In reply to Attila Tóth from comment #13)
> > (In reply to Larry the Git Cow from comment #12)
> > > The bug has been closed via the following commit(s):
> > > 
> > 
> > For this reason nodejs failed to compile again. Either these lines must be
> > reintroduced into the ebuilds or a separate or extended patch should be
> > provided taking care of mksnapshot on top of node_mksnapshot and mkcodecache.
> > 
> > What is your opinion about it?
> 
> make a patch that take care of mksnapshot.

There it is!
Comment 17 Magnus Granberg gentoo-dev 2019-12-17 21:25:12 UTC
Created attachment 599974 [details, diff]
Updated patch to pax mark needed files

Can some one test this
Comment 18 Fedja Beader 2019-12-26 17:28:15 UTC
The patch applies, but the build still fails. Now with mksnapshot_u instead of mksnapshot.
Comment 19 Fedja Beader 2019-12-26 17:53:59 UTC
paxctrl-ng -v out/Release/mksnapshot_u reports
  XATTR_PAX : not found

Manually running paxctl-ng -l -m on that file produces (with -v)
  XATTR_PAX : -em--

Manually running paxmark.sh m on that file does not create the XATTR_PAX entry.

Apparently paxmark.sh expects the variable PAX_MARKINGS to be set in make.conf, but no such variable is present and thus it silently fails while not knowing how to proceed.
Comment 20 Fedja Beader 2019-12-26 21:30:45 UTC
(the build works after adding PAX_MARKINGS definition to make.conf)
Comment 21 Larry the Git Cow gentoo-dev 2020-02-17 00:38:01 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7beac2cd42801fc3ef9a1c81b9922d850e17a1c1

commit 7beac2cd42801fc3ef9a1c81b9922d850e17a1c1
Author:     Magnus Granberg <zorry@gentoo.org>
AuthorDate: 2020-02-17 00:33:45 +0000
Commit:     Magnus Granberg <zorry@gentoo.org>
CommitDate: 2020-02-17 00:37:31 +0000

    net-libs/nodejs: Fix building on pax enable kernel
    
    Closes: https://bugs.gentoo.org/694100
    Signed-off-by: Magnus Granberg <zorry@gentoo.org>
    Package-Manager: Portage-2.3.84, Repoman-2.3.16

 .../nodejs/files/nodejs-13.8.0-paxmarking.patch    | 111 +++++++++++++++++++++
 net-libs/nodejs/nodejs-13.8.0.ebuild               |   2 +-
 2 files changed, 112 insertions(+), 1 deletion(-)
Comment 22 Attila Tóth 2022-05-03 17:19:49 UTC
Created attachment 776576 [details, diff]
nodejs-16.4.2-paxmarking.patch

Updated patch for nodejs-16.4.2
Comment 23 Attila Tóth 2022-05-03 17:20:31 UTC
Created attachment 776579 [details, diff]
nodejs-18.0.0-paxmarking.patch

Updated patch for nodejs-18.0.0
Comment 24 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-05-04 00:57:22 UTC
In future, please file a new bug w/ the needed patches and reference this one.

Let's use bug 735832 as it has all 3 patches, not just 2. Thank you for sharing them!
Comment 25 William Hubbs gentoo-dev 2022-05-04 01:15:23 UTC
Please file issues or pull requests upstream [1] and see if they will
accept your patches. If they do, that means we don't have to keep
carrying patches.

Thanks,

William

[1] https://github.com/nodejs/node
Comment 26 William Hubbs gentoo-dev 2022-05-04 03:47:12 UTC
I saw a short conversation on irc that points out why we may not be able
to do thi, so never mind for now.
Comment 27 Attila Tóth 2022-06-10 06:32:52 UTC
Created attachment 783803 [details, diff]
nodejs-18.3.0-paxmarking.patch

nodejs-18.3.0 removed some relevant pieces of the gyp, therefore the patch created for 18.0.0 fails to apply cleanly. This is an updated patch adapted to 18.3.0.
Comment 28 Attila Tóth 2023-10-06 18:03:11 UTC
Created attachment 872243 [details, diff]
nodejs-20.3.0-paxmarking.patch

nodejs-20.3.0-paxmarking.patch