Issue #20029 has been reported by ggardet (Guillaume GARDET).
----------------------------------------
Bug #20029: coroutine/arm64/Context.S does not support PAC/BTI
https://bugs.ruby-lang.org/issues/20029
* Author: ggardet (Guillaume GARDET)
* Status: Open
* Priority: Normal
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
On aarch64/arm64, when we build with `-mbranch-protection=standard` to enable Pointer Authentication (PAC) and Branch Target Identification (BTI), the final link disable them, because `coroutine/arm64/Context.S` does not support PAC and BTI.
The following warning message shows the issue:
```
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: coroutine/arm64/Context.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
```
More information on :
* PAC: https://developer.arm.com/documentation/102433/0100/Return-oriented-program…
* BTI: https://developer.arm.com/documentation/102433/0100/Jump-oriented-programmi…
There are also more warning displayed (with LDFLAG `-z force-bti`) which may be related to assembler file above:
```
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans0.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans1.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans2.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans3.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans4.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans5.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans6.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans7.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans8.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans9.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans10.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans11.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans12.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans13.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans14.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans15.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans16.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans17.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans18.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans19.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans20.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans21.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans22.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans23.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans24.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans25.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans26.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans27.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans28.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans29.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans30.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans31.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans32.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans33.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans34.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans35.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans36.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans37.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans38.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans39.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans40.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans41.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans42.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans43.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans44.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans45.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans46.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans47.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans48.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans49.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans50.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans51.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans52.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans53.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans54.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans55.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans56.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans57.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans58.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans59.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans60.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans61.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdOARjY.ltrans62.ltrans.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cciywru6.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccYLAnEK.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccOMDWM2.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccKwSfx4.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cc0UcZ79.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccwFEvxB.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccA7PZWl.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cco1BWs5.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cc69GwWR.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccQJRoGg.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccQxdgKL.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccwlSFnu.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccIV93Ty.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cc80Z1I6.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccQvoKBh.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccF4fgVR.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccnZTEeL.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccB6xnUm.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cclysC9W.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdecmLz.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccjPDXPI.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccJZkU7F.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cc3YUbr0.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccbjv5UA.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cchyvXDw.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cc5fXOY1.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccSA56NP.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccBC6NTp.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccx0LSGH.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccpe97Jt.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cc1fcXeN.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccvPkzas.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccLVhLtG.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cc1P8AOZ.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccHFgC67.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccdobe5Z.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cczj5fpf.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccnx7HaS.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cclgpgcE.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccFCFv3m.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccL90EU9.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccJM9ZKx.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cc7E7N3b.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccrD7el8.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccDRbeGd.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccnz25d3.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccx2kRDb.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cc8qpL5K.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccTxXwIE.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccyhtIpt.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccw06qxn.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccujdk33.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccapzdM7.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccyrE5Dy.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccK1tthq.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccYStpJT.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccoyuoLI.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cca3ZE6u.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccmjRQkR.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccWhZhgr.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccg86XO6.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccEUTnCx.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cccqt0zE.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccYsIhcV.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cciZniaF.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cc8PHs6I.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccwsJEPt.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cc28q1jl.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccYS3JH0.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cc81r5f4.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccWnQamA.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccKBgOZ8.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccEeEDFw.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/cc0Radx5.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccUqQpiO.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccGZBM2N.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccKrvFKD.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccVqBIQB.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccaBdhfy.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccuz5CcU.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
[ 133s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: /tmp/ccGfkAbz.debug.temp.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
```
--
https://bugs.ruby-lang.org/
Issue #19977 has been reported by kyanagi (Kouhei Yanagita).
----------------------------------------
Bug #19977: (nil..nil) === x can raise an exception, differing from Range#cover?
https://bugs.ruby-lang.org/issues/19977
* Author: kyanagi (Kouhei Yanagita)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.3.0dev (2023-10-27T03:13:17Z master f9f0cfe785) [arm64-darwin22]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
I investigated Range#=== and Range#cover?, and found that the only difference in behavior between them would be that
`(nil..nil) === x` could throw an exception.
```
% ~/tmp/ruby-master/bin/ruby -v
ruby 3.3.0dev (2023-10-27T03:13:17Z master f9f0cfe785) [arm64-darwin22]
```
```
% ~/tmp/ruby-master/bin/ruby -e 'p (nil..nil) === "a"'
-e:1:in `===': cannot determine inclusion in beginless/endless ranges (TypeError)
p (nil..nil) === "a"
^^^
from -e:1:in `<main>'
```
```
% ~/tmp/ruby-master/bin/ruby -e 'p (nil..nil).cover?("a")'
true
```
Is this difference intended?
According to NEWS, `Range#===` uses `cover?` since Ruby 2.6 (For `String`, since Ruby 2.7).
Following this, `(nil..nil) === x` should not throw an exception in the same way as `(nil..nil).cover?(x)`.
history:
`(nil..nil) === "a"` throws an exception since https://github.com/ruby/ruby/commit/04a92a6.
For "linear objects" (`Integer`, `Float`, `Numeric`, `Time`), it has beed fixed not to throw an exception on https://github.com/ruby/ruby/commit/fb17c83.
related issues:
* [Bug #15449] Range#=== is not using cover in Ruby 2.6
* [Bug #18580] Range#include? inconsistency for beginless String ranges
* [Bug #19533] Behavior of ===/include? on a beginless/endless range (nil..nil) changed in ruby 3.2
--
https://bugs.ruby-lang.org/
Issue #20031 has been reported by FabienChaynes (Fabien Chaynes).
----------------------------------------
Bug #20031: Regexp using greedy quantifier and unions on a big string uses a lot of memory
https://bugs.ruby-lang.org/issues/20031
* Author: FabienChaynes (Fabien Chaynes)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
Trying to match on some regexp using a greedy quantifier on any character (`.*`) and unions (`foo|bar`) uses a lot of memory if the string we want to match on is big.
# Reproduction code
```ruby
puts RUBY_DESCRIPTION
unless File.exist?("/tmp/fake_email.eml")
content = "Accept-Language: fr-FR, en-US#{"0" * 50_000_000}"
File.write("/tmp/fake_email.eml", content)
end
content = File.read("/tmp/fake_email.eml")
def print_size(context, sike_kb)
puts "#{context}: #{(sike_kb / 1024.0).round(1)} MB"
end
print_size("baseline", `ps ax -o pid,rss | grep -E "^[[:space:]]*#{$$}"`.strip.split.map(&:to_i).last)
print_size("content", content.bytesize / 1024)
REGEXP_UNION = Regexp.union(
"Accept-Language:",
"Thread-Topic:",
).freeze
reg = /.*#{REGEXP_UNION}/
p reg
GC.start
print_size("before match?", `ps ax -o pid,rss | grep -E "^[[:space:]]*#{$$}"`.strip.split.map(&:to_i).last)
allocated = GC.stat(:total_allocated_objects)
p content.match(reg)
p GC.stat(:total_allocated_objects) - allocated
GC.start
print_size("after match?", `ps ax -o pid,rss | grep -E "^[[:space:]]*#{$$}"`.strip.split.map(&:to_i).last)
p "---"
```
Output:
```bash
$ /usr/bin/time -v ruby full_repro.rb
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
baseline: 71.3 MB
content: 47.7 MB
/.*(?-mix:Accept\-Language:|Thread\-Topic:)/
before match?: 71.3 MB
#<MatchData "Accept-Language:">
14
after match?: 71.6 MB
"---"
Command being timed: "ruby full_repro.rb"
User time (seconds): 1.15
System time (seconds): 0.74
Percent of CPU this job got: 100%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:01.89
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 2423108
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 609575
Voluntary context switches: 52
Involuntary context switches: 12
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
```
strace:
```bash
$ sudo strace -p 588834
strace: Process 588834 attached
[...]
mmap(NULL, 249856, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8e92dd3000
mremap(0x7f8e92dd3000, 249856, 495616, MREMAP_MAYMOVE) = 0x7f8e92d5a000
mremap(0x7f8e92d5a000, 495616, 987136, MREMAP_MAYMOVE) = 0x7f8e92c69000
mremap(0x7f8e92c69000, 987136, 1970176, MREMAP_MAYMOVE) = 0x7f8e92a88000
mremap(0x7f8e92a88000, 1970176, 3936256, MREMAP_MAYMOVE) = 0x7f8e926c7000
mremap(0x7f8e926c7000, 3936256, 7868416, MREMAP_MAYMOVE) = 0x7f8e91f46000
mremap(0x7f8e91f46000, 7868416, 15732736, MREMAP_MAYMOVE) = 0x7f8e91045000
mremap(0x7f8e91045000, 15732736, 31461376, MREMAP_MAYMOVE) = 0x7f8e8a8af000
mremap(0x7f8e8a8af000, 31461376, 62918656, MREMAP_MAYMOVE) = 0x7f8e86cae000
mremap(0x7f8e86cae000, 62918656, 125833216, MREMAP_MAYMOVE) = 0x7f8e7f4ad000
mremap(0x7f8e7f4ad000, 125833216, 251662336, MREMAP_MAYMOVE) = 0x7f8e704ac000
mremap(0x7f8e704ac000, 251662336, 503320576, MREMAP_MAYMOVE) = 0x7f8e524ab000
mremap(0x7f8e524ab000, 503320576, 1006637056, MREMAP_MAYMOVE) = 0x7f8e164aa000
mremap(0x7f8e164aa000, 1006637056, 2013270016, MREMAP_MAYMOVE) = 0x7f8d9e4a9000
mremap(0x7f8d9e4a9000, 2013270016, 4026535936, MREMAP_MAYMOVE) = 0x7f8cae4a8000
mmap(NULL, 12500992, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8e92224000
munmap(0x7f8cae4a8000, 4026535936) = 0
munmap(0x7f8e92224000, 12500992) = 0
writev(1, [{iov_base="#<MatchData \"Accept-Language:\">", iov_len=31}, {iov_base="\n", iov_len=1}], 2) = 32
[...]
```
We can see that the memory retained by Ruby is low (71.6 MB), but `content.match(reg)` used 2_423_108 kbytes (~2.4 GB) in the regex engine.
# Findings
To reproduce we need:
- a greedy quantifier on any character (`.*`)
- a union with at least two members (`foo|bar`). More members won't increase the memory consumption further
- to perform the match on a long string
The memory seems to increase linearly against the string size:
|String size |Memory consumed |
|--|--|
| 11.9 MB | 629_988 kbytes |
| 23.8 MB | 1_235_976 kbytes |
| 47.7 MB | 2_423_076 kbytes |
I was able to reproduce it on old Ruby versions as well.
@byroot helped me to put all this together and according to his investigation the memory allocation would be coming from `regexec.c:4100` (https://github.com/ruby/ruby/blob/85092ecd6f5c4d12d0cb1d6dfa7040337a4f558b/…):
```
size_t match_cache_buf_length = (num_match_cache_points >> 3) + (num_match_cache_points & 7 ? 1 : 0) + 1;
uint8_t* match_cache_buf = (uint8_t*)xmalloc(match_cache_buf_length * sizeof(uint8_t));
```
It seems surprising to use that much memory compared to the string size. Is it expected?
--
https://bugs.ruby-lang.org/
Issue #20017 has been reported by byroot (Jean Boussier).
----------------------------------------
Bug #20017: 3.3.0dev `rb_thread_profile_frames` crashes when `RUBY_MN_THREADS=1`
https://bugs.ruby-lang.org/issues/20017
* Author: byroot (Jean Boussier)
* Status: Open
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* ruby -v: ruby 3.3.0dev (2023-11-19T03:01:05Z shopify 9aee12cc28) +MN [x86_64-linux]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
I discovered this while running our internal CI with MaNy enabled, our application crash when trying to profile with StackProf (with postponed jobs disabled):
```
[BUG] Segmentation fault at 0x0000000000000010
ruby 3.3.0dev (2023-11-19T03:01:05Z shopify 9aee12cc28) +MN [x86_64-linux]
-- C level backtrace information -------------------------------------------
/usr/local/ruby/bin/ruby(rb_print_backtrace+0x14) [0x55c8f16333e1] /tmp/ruby-build/ruby-3.3.0-9aee12cc28cbca40306784e54e38558688caa9f7/vm_dump.c:812
/usr/local/ruby/bin/ruby(rb_vm_bugreport) /tmp/ruby-build/ruby-3.3.0-9aee12cc28cbca40306784e54e38558688caa9f7/vm_dump.c:1143
/usr/local/ruby/bin/ruby(rb_bug_for_fatal_signal+0xfc) [0x55c8f17e559c] /tmp/ruby-build/ruby-3.3.0-9aee12cc28cbca40306784e54e38558688caa9f7/error.c:1065
/usr/local/ruby/bin/ruby(sigsegv+0x4d) [0x55c8f158091d] /tmp/ruby-build/ruby-3.3.0-9aee12cc28cbca40306784e54e38558688caa9f7/signal.c:920
/lib/x86_64-linux-gnu/libc.so.6(0x7ff3db333520) [0x7ff3db333520]
/usr/local/ruby/bin/ruby(thread_profile_frames+0x10) [0x55c8f162efd0] /tmp/ruby-build/ruby-3.3.0-9aee12cc28cbca40306784e54e38558688caa9f7/vm_backtrace.c:1587
/tmp/bundle/ruby/3.3.0+0/gems/stackprof-0.2.25/lib/stackprof/stackprof.so(stackprof_buffer_sample+0x28) [0x7ff3b7d2435c] /tmp/bundle/ruby/3.3.0+0/gems/stackprof-0.2.25/ext/stackprof/stackprof.c:622
/tmp/bundle/ruby/3.3.0+0/gems/stackprof-0.2.25/lib/stackprof/stackprof.so(stackprof_buffer_sample) /tmp/bundle/ruby/3.3.0+0/gems/stackprof-0.2.25/ext/stackprof/stackprof.c:604
/tmp/bundle/ruby/3.3.0+0/gems/stackprof-0.2.25/lib/stackprof/stackprof.so(stackprof_buffer_sample) (null):0
/tmp/bundle/ruby/3.3.0+0/gems/stackprof-0.2.25/lib/stackprof/stackprof.so(stackprof_signal_handler+0x5) [0x7ff3b7d24545] /tmp/bundle/ruby/3.3.0+0/gems/stackprof-0.2.25/ext/stackprof/stackprof.c:767
/tmp/bundle/ruby/3.3.0+0/gems/stackprof-0.2.25/lib/stackprof/stackprof.so(stackprof_signal_handler) /tmp/bundle/ruby/3.3.0+0/gems/stackprof-0.2.25/ext/stackprof/stackprof.c:722
/lib/x86_64-linux-gnu/libc.so.6(0x7ff3db333520) [0x7ff3db333520]
/lib/x86_64-linux-gnu/libc.so.6(pthread_cond_wait+0x24a) [0x7ff3db384a7a]
/usr/local/ruby/bin/ruby(rb_native_cond_wait+0xb) [0x55c8f15c8cbb] /tmp/ruby-build/ruby-3.3.0-9aee12cc28cbca40306784e54e38558688caa9f7/thread_pthread.c:214
/usr/local/ruby/bin/ruby(ractor_sched_deq) /tmp/ruby-build/ruby-3.3.0-9aee12cc28cbca40306784e54e38558688caa9f7/thread_pthread.c:1230
/usr/local/ruby/bin/ruby(nt_start) /tmp/ruby-build/ruby-3.3.0-9aee12cc28cbca40306784e54e38558688caa9f7/thread_pthread.c:2209
```
For additional context, as far as I know `rb_thread_profile_frames` isn't officially async signal safe, but it happens to be since 3.0 for the interpreter, and 3.3 for YJIT, so StackProf tries not to use postponed jobs for profiling when it can as it leads to much more accurate profiling results.
Ref: https://github.com/tmm1/stackprof/issues/221
--
https://bugs.ruby-lang.org/
Issue #19998 has been reported by byroot (Jean Boussier).
----------------------------------------
Feature #19998: Emit deprecation warnings when the old (non-Typed) Data_XXX API is used
https://bugs.ruby-lang.org/issues/19998
* Author: byroot (Jean Boussier)
* Status: Open
* Priority: Normal
----------------------------------------
The replacement API was introduced in Ruby 1.9.2 (2010) [Feature #3064], and the old untyped data API was marked a deprecated in the documentation as of Ruby 2.3.0 (2015): https://github.com/ruby/ruby/commit/98544c372d948717de22afc86d162e411f1fb5f1
However, as of today, no deprecation warning of any sort is emitted when the API is used.
Ultimately removing the old untyped API would allow to easily reclaim 8B on every `T_DATA` which could be used by the newly introduced embedded TypedData objects https://github.com/ruby/ruby/pull/7440
Was there any discussions about removing the old API at some point?
Could we emit a warning when the API is used? Either verbose or non-verbose, to at least surface the issue to gem owners? This would help drive the effort to fix outdated gems, allowing to eventually remove this old API in the future.
Looking at our big applications dependencies, there seem to be a small minority of gems still using the old API:
- https://rubygems.org/gems/unf_ext
- https://rubygems.org/gems/rotoscope
- https://rubygems.org/gems/re2
- https://rubygems.org/gems/mysql2
Migrating them over doesn't seem too hard.
--
https://bugs.ruby-lang.org/
Issue #19683 has been reported by jeremyevans0 (Jeremy Evans).
----------------------------------------
Bug #19683: ruby-3.3.0-preview1 does not build with BSD make without --with-baseruby
https://bugs.ruby-lang.org/issues/19683
* Author: jeremyevans0 (Jeremy Evans)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.3.0preview1 (2023-05-12 master a1b01e7701) [x86_64-openbsd7.3]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
ruby-3.3.0-preview1 does not build with BSD make without `--with-baseruby`. However, it builds fine with GNU make and when using BSD make with `--with-baseruby`. Previous Ruby tarball releases have built fine with BSD make without `--with-baseruby`, so this issue has been introduced recently.
When building with BSD make without `--with-baseruby`, building fails after generating RI format with:
```
/bin/sh: false: not found
*** Error 127 in . (exts.mk:94 'ruby': @make UPDATE_LIBRARIES=no EXTENCS=dmyenc.o BASERUBY=echo\ executable\ host\ ruby\ is\ required.\ \ ...)
*** Error 2 in /home/jeremy/local/ruby-3.3.0-preview1 (Makefile:948 'build-ext': @make -f exts.mk libdir="/usr/local/lib" LIBRUBY_EXTS=./...)
```
--
https://bugs.ruby-lang.org/
Issue #20008 has been reported by jeremyevans0 (Jeremy Evans).
----------------------------------------
Bug #20008: f(**kw, &block) calls block.to_proc before kw.to_hash
https://bugs.ruby-lang.org/issues/20008
* Author: jeremyevans0 (Jeremy Evans)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.3.0dev (2023-11-12 master 60e19a0b5f) [x86_64-openbsd]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
The evaluation order expectation is that `kw.to_hash` is called first in this case. Ruby previously called `kw.to_hash` before `block.to_proc` in Ruby 2, but stopped doing so in Ruby 3.0. In master, `f(*a, **kw, &block)` is also affected. However, that is not true in Ruby 3.2 and earlier (though Ruby 2.0 and 2.1 called `kw.to_hash` before `a.to_a`).
The reason for the current behavior is that `vm_caller_setup_arg_block` calls `block.to_proc` before `vm_sendish` is called. `kw.to_hash` is not called until `CALLER_SETUP_ARG` or `setup_parameters_complex`.
I have a pull request that fixes this (https://github.com/ruby/ruby/pull/8877), by adding a `splatkw` VM instruction and calling it directly before any send instructions that have both `VM_CALL_ARGS_BLOCKARG` and `VM_CALL_KW_SPLAT` and not `VM_CALL_KW_SPLAT_MUT`. The `splatkw` instruction calls `kw.to_hash` if `kw` is not already a Hash. The `splatkw` instruction is not needed for mutable keyword splats, as `kw.to_hash` would have already been called by earlier instructions in that case.
It is possible to fix this without a new VM instruction, by adding the logic to `vm_caller_setup_arg_block` or `rb_vm_send`. However, then an additional check is needed in every method call, instead of only before method calls that actually need it. I would guess that approach would be slower, though as I have not benchmarked that approach, it is not an educated guess.
Currently, the `splatkw` instruction is inserted using the peephole optimizer. I'm not sure if using the optimizer to fix bugs is acceptable. If not, it could probably be moved to the compiler proper.
I do not believe we should backport this fix, as I consider a new VM instruction invasive, and the benefit of backporting seems small.
Example code:
```ruby
o = Object.new
o.define_singleton_method(:to_hash) {p :called_to_hash; {}}
o.define_singleton_method(:to_proc) {p :called_to_proc; lambda{}}
puts "p(**o, &o)"
p(**o, &o)
```
Actual Output:
```
p(**o, &o)
:called_to_proc
:called_to_hash
```
Expected Output:
```
p(**o, &o)
:called_to_hash
:called_to_proc
```
--
https://bugs.ruby-lang.org/
Issue #19326 has been reported by sdwolfz (Codruț Gușoi).
----------------------------------------
Feature #19326: Please add a better API for passing a Proc to a Ractor
https://bugs.ruby-lang.org/issues/19326
* Author: sdwolfz (Codruț Gușoi)
* Status: Open
* Priority: Normal
----------------------------------------
Example 1:
```ruby
class Worker
def initialize(&block)
@block = block
end
def run
Ractor.new(@block, &:call)
end
end
worker = Worker.new { 1 }
puts worker.run.take
```
Errors with:
```
<internal:ractor>:271:in `new': allocator undefined for Proc (TypeError)
from scripts/run.rb:9:in `run'
from scripts/run.rb:14:in `<main>'
```
Example 2:
```ruby
class Worker
def initialize(&block)
@block = Ractor.make_shareable(block)
end
def run
Ractor.new(@block, &:call)
end
end
worker = Worker.new { 1 }
puts worker.run.take
```
Errors with:
```
<internal:ractor>:820:in `make_shareable': Proc's self is not shareable: #<Proc:0x00007f00394c38b8 scripts/run.rb:13> (Ractor::IsolationError)
from scripts/run.rb:5:in `initialize'
from scripts/run.rb:13:in `new'
from scripts/run.rb:13:in `<main>'
```
Example 3:
```ruby
class Worker
def initialize(&block)
@block = Ractor.make_shareable(block)
end
def run
Ractor.new(@block, &:call)
end
end
worker = Ractor.current.instance_eval { Worker.new { 1 } }
puts worker.run.take
```
Works, but having `Ractor.current.instance_eval` as a wrapper around the block is not ideal, as Ractor is supposed to be only an implementation detail in Worker.
I know about https://bugs.ruby-lang.org/issues/18243 and the discussion around `proc.bind(nil)`. That would actually be ideal, as for the purposes if why I want this functionality I don't care what `self` is in a block, and the less it has access to the better.
The general idea is to have a Ractor be able to lazily execute an arbitrary proc. And all the bindings it would need would be passed explicitly, either through `args` in the constructor or through `send`/`receive`, so `self` would really not matter.
The benefit: this would make it so concurrent code can be more easily be implemented with Ractors as currently you can execute an arbitrary proc by passing it to a Thread (but you don't get the nice data isolation).
--
https://bugs.ruby-lang.org/