Patch review
cover Patch review
Please review this set of changes for kirkstone and have comments back by end of day Thursday, April 10
Passed a-full on autobuilder:
https://autobuilder.yoctoproject.org/valkyrie/#/builders/29/builds/1367
The following changes since commit 1efbe1004bc82e7c14c1e8bd4ce644f5015c3346:
build-appliance-image: Update to kirkstone head revision (2025-04-04 08:43:24 -0700)
are available in the Git repository at:
https://git.openembedded.org/openembedded-core-contrib stable/kirkstone-nut
https://git.openembedded.org/openembedded-core-contrib/log/?h=stable/kirkstone-nut
Haixiao Yan (1):
glibc: Add single-threaded fast path to rand()
Peter Marko (2):
ofono: patch CVE-2024-7537
qemu: ignore CVE-2023-1386
Vijay Anusuri (6):
ghostscript: Fix CVE-2025-27830
ghostscript: Fix CVE-2025-27831
ghostscript: Fix CVE-2025-27832
ghostscript: Fix CVE-2025-27834
ghostscript: Fix CVE-2025-27835
ghostscript: Fix CVE-2025-27836
Yogita Urade (1):
curl: ignore CVE-2025-0725
.../ofono/ofono/CVE-2024-7537.patch | 59 +++++++++++++ meta/recipes-connectivity/ofono/ofono_1.34.bb | 1 + ...dd-single-threaded-fast-path-to-rand.patch | 47 +++++++++++ meta/recipes-core/glibc/glibc_2.35.bb | 1 + meta/recipes-devtools/qemu/qemu.inc | 3 + .../ghostscript/CVE-2025-27830.patch | 79 +++++++++++++++++ .../ghostscript/CVE-2025-27831-pre1.patch | 50 +++++++++++ .../ghostscript/CVE-2025-27831.patch | 84 +++++++++++++++++++ .../ghostscript/CVE-2025-27832.patch | 45 ++++++++++ .../ghostscript/CVE-2025-27834.patch | 57 +++++++++++++ .../ghostscript/CVE-2025-27835.patch | 34 ++++++++ .../ghostscript/CVE-2025-27836-1.patch | 64 ++++++++++++++ .../ghostscript/CVE-2025-27836-2.patch | 46 ++++++++++ .../ghostscript/ghostscript_9.55.0.bb | 8 ++ meta/recipes-support/curl/curl_7.82.0.bb | 2 + 15 files changed, 580 insertions(+) create mode 100644 meta/recipes-connectivity/ofono/ofono/CVE-2024-7537.patch create mode 100644 meta/recipes-core/glibc/glibc/0001-stdlib-Add-single-threaded-fast-path-to-rand.patch create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27830.patch create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27831-pre1.patch create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27831.patch create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27832.patch create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27834.patch create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27835.patch create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27836-1.patch create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27836-2.patch
Signature · 1 line
2.43.0
PATCH 1/10 curl: ignore CVE-2025-0725
From: Yogita Urade <[email protected]>
CVE-2025-0725 can only trigger for curl when using a runtime zlib version 1.2.0.3 or older and kirkstone supports zlib 1.2.11 version, hence ignore cve for kirkstone.
Reference:
https://curl.se/docs/CVE-2025-0725.html
https://git.openembedded.org/openembedded-core/commit/?h=scarthgap&id=8c3b4a604b40260e7ca9575715dd8017e17d35c0
--- meta/recipes-support/curl/curl_7.82.0.bb | 2 ++ 1 file changed, 2 insertions(+)
meta/recipes-support/curl/curl_7.82.0.bb +2 -0
@@ -73,6 +73,8 @@ CVE_PRODUCT = "haxx:curl haxx:libcurl curl:curl curl:libcurl libcurl:libcurl dan CVE_CHECK_IGNORE += "CVE-2023-42915" # ignored: CURLOPT_SSL_VERIFYPEER was disabled on google cloud services causing a potential man in the middle attack CVE_CHECK_IGNORE += "CVE-2024-32928" +# ignored: gzip decompression of content-encoded HTTP responses with the `CURLOPT_ACCEPT_ENCODING` option, using zlib 1.2.0.3 or older +CVE_CHECK_IGNORE += "CVE-2025-0725" inherit autotools pkgconfig binconfig multilib_header
Signature · 1 line
2.43.0
PATCH 2/10 ofono: patch CVE-2024-7537
In reply to Steve SakomanFrom: Peter Marko <[email protected]>
--- .../ofono/ofono/CVE-2024-7537.patch | 59 +++++++++++++++++++ meta/recipes-connectivity/ofono/ofono_1.34.bb | 1 + 2 files changed, 60 insertions(+) create mode 100644 meta/recipes-connectivity/ofono/ofono/CVE-2024-7537.patch
meta/recipes-connectivity/ofono/ofono/CVE-2024-7537.patch new file +59 -0
@@ -0,0 +1,59 @@ +From e6d8d526d5077c0b6ab459efeb6b882c28e0fdeb Mon Sep 17 00:00:00 2001 +From: Ivaylo Dimitrov <[email protected]> +Date: Sun, 16 Mar 2025 12:26:42 +0200 +Subject: [PATCH] qmi: sms: Fix possible out-of-bounds read + +Fixes: CVE-2024-7537 + +CVE: CVE-2024-7537 +Upstream-Status: Backport [https://web.git.kernel.org/pub/scm/network/ofono/ofono.git/commit/?id=e6d8d526d5077c0b6ab459efeb6b882c28e0fdeb] +Signed-off-by: Peter Marko <[email protected]> +--- + drivers/qmimodem/sms.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/drivers/qmimodem/sms.c b/drivers/qmimodem/sms.c +index 3e2bef6e..75863480 100644 +--- a/drivers/qmimodem/sms.c ++++ b/drivers/qmimodem/sms.c +@@ -485,6 +485,8 @@ static void get_msg_list_cb(struct qmi_result *result, void *user_data) + const struct qmi_wms_result_msg_list *list; + uint32_t cnt = 0; + uint16_t tmp; ++ uint16_t length; ++ size_t msg_size; + + DBG(""); + +@@ -494,7 +496,7 @@ static void get_msg_list_cb(struct qmi_result *result, void *user_data) + goto done; + } + +- list = qmi_result_get(result, QMI_WMS_RESULT_MSG_LIST, NULL); ++ list = qmi_result_get(result, QMI_WMS_RESULT_MSG_LIST, &length); + if (list == NULL) { + DBG("Err: get msg list empty"); + goto done; +@@ -503,6 +505,13 @@ static void get_msg_list_cb(struct qmi_result *result, void *user_data) + cnt = GUINT32_FROM_LE(list->cnt); + DBG("msgs found %d", cnt); + ++ msg_size = cnt * sizeof(list->msg[0]); ++ ++ if (length != sizeof(list->cnt) + msg_size) { ++ DBG("Err: invalid msg list count"); ++ goto done; ++ } ++ + for (tmp = 0; tmp < cnt; tmp++) { + DBG("unread type %d ndx %d", list->msg[tmp].type, + GUINT32_FROM_LE(list->msg[tmp].ndx)); +@@ -516,8 +525,6 @@ static void get_msg_list_cb(struct qmi_result *result, void *user_data) + + /* save list and get 1st msg */ + if (cnt) { +- int msg_size = cnt * sizeof(list->msg[0]); +- + data->msg_list = g_try_malloc0(sizeof(list->cnt) + msg_size); + if (data->msg_list == NULL) + goto done;
meta/recipes-connectivity/ofono/ofono_1.34.bb +1 -0
@@ -25,6 +25,7 @@ SRC_URI = "\ file://CVE-2024-7546.patch \ file://CVE-2024-7547.patch \ file://CVE-2024-7540_CVE-2024-7541_CVE-2024-7542.patch \ + file://CVE-2024-7537.patch \ " SRC_URI[sha256sum] = "c0b96d3013447ec2bcb74579bef90e4e59c68dbfa4b9c6fbce5d12401a43aac7"
Signature · 1 line
2.43.0
PATCH 3/10 ghostscript: Fix CVE-2025-27830
In reply to Steve SakomanFrom: Vijay Anusuri <[email protected]>
Upstream-Status: Backport
[https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=8474e1d6b896e35741d3c608ea5c21deeec1078f]
--- .../ghostscript/CVE-2025-27830.patch | 79 +++++++++++++++++++ .../ghostscript/ghostscript_9.55.0.bb | 1 + 2 files changed, 80 insertions(+) create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27830.patch
meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27830.patch new file +79 -0
@@ -0,0 +1,79 @@ +From 8474e1d6b896e35741d3c608ea5c21deeec1078f Mon Sep 17 00:00:00 2001 +From: Zdenek Hutyra <[email protected]> +Date: Mon, 13 Jan 2025 09:15:01 +0000 +Subject: [PATCH] Bug 708241: Fix potential Buffer overflow with DollarBlend + +During serializing a multiple master font for passing to Freetype. + +Use CVE-2025-27830 + +Upstream-Status: Backport [https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=8474e1d6b896e35741d3c608ea5c21deeec1078f] +CVE: CVE-2025-27830 +Signed-off-by: Vijay Anusuri <[email protected]> +--- + base/write_t1.c | 7 ++++--- + psi/zfapi.c | 9 +++++++-- + 2 files changed, 11 insertions(+), 5 deletions(-) + +diff --git a/base/write_t1.c b/base/write_t1.c +index 52902be..d6b2454 100644 +--- a/base/write_t1.c ++++ b/base/write_t1.c +@@ -628,6 +628,7 @@ write_main_dictionary(gs_fapi_font * a_fapi_font, WRF_output * a_output, int Wri + WRF_wbyte(a_fapi_font->memory, a_output, '\n'); + if (is_MM_font(a_fapi_font)) { + short x, x2; ++ unsigned short ux; + float x1; + uint i, j, entries; + char Buffer[255]; +@@ -759,16 +760,16 @@ write_main_dictionary(gs_fapi_font * a_fapi_font, WRF_output * a_output, int Wri + */ + code = a_fapi_font->get_word(a_fapi_font, + gs_fapi_font_feature_DollarBlend_length, +- 0, (unsigned short *)&x); ++ 0, &ux); + if (code < 0) + return code; + +- if (x > 0) { ++ if (ux > 0) { + int len; + WRF_wstring(a_fapi_font->memory, a_output, "/$Blend {"); + + if (a_output->m_count) +- a_output->m_count += x; ++ a_output->m_count += ux; + len = a_fapi_font->get_proc(a_fapi_font, + gs_fapi_font_feature_DollarBlend, 0, + (char *)a_output->m_pos); +diff --git a/psi/zfapi.c b/psi/zfapi.c +index 0b3ab1c..1ffef47 100644 +--- a/psi/zfapi.c ++++ b/psi/zfapi.c +@@ -682,7 +682,7 @@ FAPI_FF_get_word(gs_fapi_font *ff, gs_fapi_font_feature var_id, int index, unsig + } + for (i = 0; i < r_size(DBlend); i++) { + if (array_get(ff->memory, DBlend, i, &Element) < 0) { +- *ret = 0; ++ length = 0; + break; + } + switch (r_btype(&Element)) { +@@ -709,7 +709,12 @@ FAPI_FF_get_word(gs_fapi_font *ff, gs_fapi_font_feature var_id, int index, unsig + default: + break; + } +- } ++ ++ if (length > max_ushort) { ++ length = 0; ++ break; ++ } ++ } + *ret = length; + break; + } +-- +2.25.1 +
meta/recipes-extended/ghostscript/ghostscript_9.55.0.bb +1 -0
@@ -62,6 +62,7 @@ SRC_URI_BASE = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/d file://CVE-2024-46953.patch \ file://CVE-2024-46955.patch \ file://CVE-2024-46956.patch \ + file://CVE-2025-27830.patch \ " SRC_URI = "${SRC_URI_BASE} \
Signature · 1 line
2.43.0
PATCH 4/10 ghostscript: Fix CVE-2025-27831
In reply to Steve SakomanFrom: Vijay Anusuri <[email protected]>
Upstream-Status: Backport
[https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=bf79b61cb1677d6865c45d397435848a21e8a647
&
https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=bf79b61cb1677d6865c45d397435848a21e8a647]
--- .../ghostscript/CVE-2025-27831-pre1.patch | 50 +++++++++++ .../ghostscript/CVE-2025-27831.patch | 84 +++++++++++++++++++ .../ghostscript/ghostscript_9.55.0.bb | 2 + 3 files changed, 136 insertions(+) create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27831-pre1.patch create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27831.patch
meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27831-pre1.patch new file +50 -0
@@ -0,0 +1,50 @@ +Partial backport of: + +From bf79b61cb1677d6865c45d397435848a21e8a647 Mon Sep 17 00:00:00 2001 +From: Ken Sharp <[email protected]> +Date: Tue, 27 Sep 2022 13:03:57 +0100 +Subject: [PATCH] PCL interpreter - fix decode_glyph for Unicode + +The text extraction (and pdfwrite family) expect that decode_glyph +should always return pairs of bytes (an assumption that Unicode code +points are 2 bytes), and the return value from the routine should be +the number of bytes required to hold the value. + +The PCL decode_glyph routine however was simply returning 1, which +caused the text extraction code some difficulty since it wasn't +expecting that. + +This commit firstly alters the text extraction code to cope 'better' +with a decode_glyph routine which returns an odd value (basically +ignore it and fall back to using the character code). + +We also alter the pl_decode_glyph routine to return 2 instead of 1, +so that it correctly tells the caller that it is returning 2 bytes. +Finally we make sure that the returned value is big-endian, because the +text extraction code assumes it will be. + +Upstream-Status: Backport [https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=bf79b61cb1677d6865c45d397435848a21e8a647] +CVE: CVE-2025-27831 #Dependency Patch +Signed-off-by: Vijay Anusuri <[email protected]> +--- + devices/vector/doc_common.c | 8 ++++++++ + pcl/pl/plfont.c | 12 +++++++++--- + 2 files changed, 17 insertions(+), 3 deletions(-) + +--- a/devices/vector/doc_common.c ++++ b/devices/vector/doc_common.c +@@ -513,6 +513,14 @@ int txt_get_unicode(gx_device *dev, gs_f + char *b, *u; + int l = length - 1; + ++ /* Real Unicode values should be at least 2 bytes. In fact I think the code assumes exactly ++ * 2 bytes. If we got an odd number, give up and return the character code. ++ */ ++ if (length & 1) { ++ *Buffer = fallback; ++ return 1; ++ } ++ + unicode = (ushort *)gs_alloc_bytes(dev->memory, length, "temporary Unicode array"); + length = font->procs.decode_glyph((gs_font *)font, glyph, ch, unicode, length); + #if ARCH_IS_BIG_ENDIAN
meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27831.patch new file +84 -0
84 lines not on this page · raw message
meta/recipes-extended/ghostscript/ghostscript_9.55.0.bb +2 -0
@@ -63,6 +63,8 @@ SRC_URI_BASE = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/d file://CVE-2024-46955.patch \ file://CVE-2024-46956.patch \ file://CVE-2025-27830.patch \ + file://CVE-2025-27831-pre1.patch \ + file://CVE-2025-27831.patch \ " SRC_URI = "${SRC_URI_BASE} \
Signature · 1 line
2.43.0
PATCH 5/10 ghostscript: Fix CVE-2025-27832
In reply to Steve SakomanFrom: Vijay Anusuri <[email protected]>
Upstream-Status: Backport [https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=57291c846334f1585552010faa42d7cb2cbd5c41]
--- .../ghostscript/CVE-2025-27832.patch | 45 +++++++++++++++++++ .../ghostscript/ghostscript_9.55.0.bb | 1 + 2 files changed, 46 insertions(+) create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27832.patch
meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27832.patch new file +45 -0
@@ -0,0 +1,45 @@ +From 57291c846334f1585552010faa42d7cb2cbd5c41 Mon Sep 17 00:00:00 2001 +From: Zdenek Hutyra <[email protected]> +Date: Wed, 20 Nov 2024 11:42:31 +0000 +Subject: Bug 708133: Avoid integer overflow leading to buffer overflow + +The calculation of the buffer size was being done with int values, and +overflowing that data type. By leaving the total size calculation to the +memory manager, the calculation ends up being done in size_t values, and +avoiding the overflow in this case, but also meaning the memory manager +overflow protection will be effective. + +CVE-2025-27832 + +Upstream-Status: Backport [https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=57291c846334f1585552010faa42d7cb2cbd5c41] +CVE: CVE-2025-27832 +Signed-off-by: Vijay Anusuri <[email protected]> +--- + contrib/japanese/gdevnpdl.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/contrib/japanese/gdevnpdl.c b/contrib/japanese/gdevnpdl.c +index 60065bacf..4967282bd 100644 +--- a/contrib/japanese/gdevnpdl.c ++++ b/contrib/japanese/gdevnpdl.c +@@ -587,7 +587,7 @@ npdl_print_page_copies(gx_device_printer * pdev, gp_file * prn_stream, int num_c + int code; + int maxY = lprn->BlockLine / lprn->nBh * lprn->nBh; + +- if (!(lprn->CompBuf = gs_malloc(pdev->memory->non_gc_memory, line_size * maxY, sizeof(byte), "npdl_print_page_copies(CompBuf)"))) ++ if (!(lprn->CompBuf = gs_malloc(pdev->memory->non_gc_memory, line_size, maxY, "npdl_print_page_copies(CompBuf)"))) + return_error(gs_error_VMerror); + + /* Initialize printer */ +@@ -683,7 +683,7 @@ npdl_print_page_copies(gx_device_printer * pdev, gp_file * prn_stream, int num_c + /* Form Feed */ + gp_fputs("\014", prn_stream); + +- gs_free(pdev->memory->non_gc_memory, lprn->CompBuf, line_size * maxY, sizeof(byte), "npdl_print_page_copies(CompBuf)"); ++ gs_free(pdev->memory->non_gc_memory, lprn->CompBuf, line_size, maxY, "npdl_print_page_copies(CompBuf)"); + return 0; + } + +-- +cgit v1.2.3 +
meta/recipes-extended/ghostscript/ghostscript_9.55.0.bb +1 -0
@@ -65,6 +65,7 @@ SRC_URI_BASE = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/d file://CVE-2025-27830.patch \ file://CVE-2025-27831-pre1.patch \ file://CVE-2025-27831.patch \ + file://CVE-2025-27832.patch \ " SRC_URI = "${SRC_URI_BASE} \
Signature · 1 line
2.43.0
PATCH 6/10 ghostscript: Fix CVE-2025-27834
In reply to Steve SakomanFrom: Vijay Anusuri <[email protected]>
Upstream-Status: Backport
[https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=ef42ff180a04926e187d40faea40d4a43e304e3b]
--- .../ghostscript/CVE-2025-27834.patch | 57 +++++++++++++++++++ .../ghostscript/ghostscript_9.55.0.bb | 1 + 2 files changed, 58 insertions(+) create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27834.patch
meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27834.patch new file +57 -0
@@ -0,0 +1,57 @@ +From ef42ff180a04926e187d40faea40d4a43e304e3b Mon Sep 17 00:00:00 2001 +From: Zdenek Hutyra <[email protected]> +Date: Mon, 20 Jan 2025 16:13:46 +0000 +Subject: [PATCH] PDF interpreter - Guard against unsigned int overflow + +Bug #708253 - see bug report for details. + +CVE-2025-27834 + +Upstream-Status: Backport [https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=ef42ff180a04926e187d40faea40d4a43e304e3b] +CVE: CVE-2025-27834 +Signed-off-by: Vijay Anusuri <[email protected]> +--- + pdf/pdf_func.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/pdf/pdf_func.c b/pdf/pdf_func.c +index 9b7d5bb..423e544 100644 +--- a/pdf/pdf_func.c ++++ b/pdf/pdf_func.c +@@ -153,6 +153,9 @@ pdfi_parse_type4_func_stream(pdf_context *ctx, pdf_c_stream *function_stream, in + byte *p = (ops ? ops + *size : NULL); + + do { ++ if (*size > max_uint / 2) ++ return gs_note_error(gs_error_VMerror); ++ + code = pdfi_read_bytes(ctx, &c, 1, 1, function_stream); + if (code < 0) + break; +@@ -318,6 +321,11 @@ pdfi_build_function_4(pdf_context *ctx, gs_function_params_t * mnDR, + if (code < 0) + goto function_4_error; + ++ if (size > max_uint - 1) { ++ code = gs_note_error(gs_error_VMerror); ++ goto function_4_error; ++ } ++ + ops = gs_alloc_string(ctx->memory, size + 1, "pdfi_build_function_4(ops)"); + if (ops == NULL) { + code = gs_error_VMerror; +@@ -816,6 +824,11 @@ int pdfi_build_halftone_function(pdf_context *ctx, gs_function_t ** ppfn, byte * + if (code < 0) + goto halftone_function_error; + ++ if (size > max_uint - 1) { ++ code = gs_note_error(gs_error_VMerror); ++ goto halftone_function_error; ++ } ++ + ops = gs_alloc_string(ctx->memory, size + 1, "pdfi_build_halftone_function(ops)"); + if (ops == NULL) { + code = gs_error_VMerror; +-- +2.25.1 +
meta/recipes-extended/ghostscript/ghostscript_9.55.0.bb +1 -0
@@ -66,6 +66,7 @@ SRC_URI_BASE = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/d file://CVE-2025-27831-pre1.patch \ file://CVE-2025-27831.patch \ file://CVE-2025-27832.patch \ + file://CVE-2025-27834.patch \ " SRC_URI = "${SRC_URI_BASE} \
Signature · 1 line
2.43.0
PATCH 7/10 ghostscript: Fix CVE-2025-27835
In reply to Steve SakomanFrom: Vijay Anusuri <[email protected]>
Upstream-Status: Backport
[https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=de900010a6f2310d1fd54e99eeba466693da0e13]
--- .../ghostscript/CVE-2025-27835.patch | 34 +++++++++++++++++++ .../ghostscript/ghostscript_9.55.0.bb | 1 + 2 files changed, 35 insertions(+) create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27835.patch
meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27835.patch new file +34 -0
@@ -0,0 +1,34 @@ +From de900010a6f2310d1fd54e99eeba466693da0e13 Mon Sep 17 00:00:00 2001 +From: Zdenek Hutyra <[email protected]> +Date: Wed, 20 Nov 2024 11:27:52 +0000 +Subject: Bug 708131: Fix confusion between bytes and shorts + +We were copying data from a string in multiple of shorts, rather than multiple +of bytes, leading to both an read (probably benign, given the memory manager) +and write buffer overflow. + +CVE-2025-27835 + +Upstream-Status: Backport [https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=de900010a6f2310d1fd54e99eeba466693da0e13] +CVE: CVE-2025-27835 +Signed-off-by: Vijay Anusuri <[email protected]> +--- + psi/zbfont.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/psi/zbfont.c b/psi/zbfont.c +index acffb39ef..5850ab54d 100644 +--- a/psi/zbfont.c ++++ b/psi/zbfont.c +@@ -253,7 +253,7 @@ gs_font_map_glyph_to_unicode(gs_font *font, gs_glyph glyph, int ch, ushort *u, u + if (l > length) + return l; + +- memcpy(unicode_return, v->value.const_bytes, l * sizeof(short)); ++ memcpy(unicode_return, v->value.const_bytes, l); + return l; + } + if (r_type(v) == t_integer) { +-- +cgit v1.2.3 +
meta/recipes-extended/ghostscript/ghostscript_9.55.0.bb +1 -0
@@ -67,6 +67,7 @@ SRC_URI_BASE = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/d file://CVE-2025-27831.patch \ file://CVE-2025-27832.patch \ file://CVE-2025-27834.patch \ + file://CVE-2025-27835.patch \ " SRC_URI = "${SRC_URI_BASE} \
Signature · 1 line
2.43.0
PATCH 8/10 ghostscript: Fix CVE-2025-27836
In reply to Steve SakomanFrom: Vijay Anusuri <[email protected]>
Upstream-Status: Backport
[https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=8b6d19b2b4079da6863ef25f2370f25d4b054919
&
https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=d84efb73723384a8b7fb3989c824cfa218060085]
--- .../ghostscript/CVE-2025-27836-1.patch | 64 +++++++++++++++++++ .../ghostscript/CVE-2025-27836-2.patch | 46 +++++++++++++ .../ghostscript/ghostscript_9.55.0.bb | 2 + 3 files changed, 112 insertions(+) create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27836-1.patch create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27836-2.patch
meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27836-1.patch new file +64 -0
@@ -0,0 +1,64 @@ +From 8b6d19b2b4079da6863ef25f2370f25d4b054919 Mon Sep 17 00:00:00 2001 +From: Zdenek Hutyra <[email protected]> +Date: Mon, 13 Jan 2025 09:07:57 +0000 +Subject: Bug 708192: Fix potential print buffer overflow + +CVE-2025-27836 + +Upstream-Status: Backport [https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/?id=8b6d19b2b4079da6863ef25f2370f25d4b054919] +CVE: CVE-2025-27836 +Signed-off-by: Vijay Anusuri <[email protected]> +--- + contrib/japanese/gdev10v.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +diff --git a/contrib/japanese/gdev10v.c b/contrib/japanese/gdev10v.c +index 0bd3cec02..9d27573dc 100644 +--- a/contrib/japanese/gdev10v.c ++++ b/contrib/japanese/gdev10v.c +@@ -199,17 +199,25 @@ bj10v_print_page(gx_device_printer *pdev, gp_file *prn_stream) + int bytes_per_column = bits_per_column / 8; + int x_skip_unit = bytes_per_column * (xres / 180); + int y_skip_unit = (yres / 180); +- byte *in = (byte *)gs_malloc(pdev->memory->non_gc_memory, 8, line_size, "bj10v_print_page(in)"); +- /* We need one extra byte in <out> for our sentinel. */ +- byte *out = (byte *)gs_malloc(pdev->memory->non_gc_memory, bits_per_column * line_size + 1, 1, "bj10v_print_page(out)"); ++ byte *in, *out; + int lnum = 0; + int y_skip = 0; + int code = 0; + int blank_lines = 0; + int bytes_per_data = ((xres == 360) && (yres == 360)) ? 1 : 3; + +- if ( in == 0 || out == 0 ) +- return -1; ++ if (bits_per_column == 0 || line_size > (max_int - 1) / bits_per_column) { ++ code = gs_note_error(gs_error_rangecheck); ++ goto error; ++ } ++ ++ in = (byte *)gs_malloc(pdev->memory->non_gc_memory, 8, line_size, "bj10v_print_page(in)"); ++ /* We need one extra byte in <out> for our sentinel. */ ++ out = (byte *)gs_malloc(pdev->memory->non_gc_memory, bits_per_column * line_size + 1, 1, "bj10v_print_page(out)"); ++ if ( in == NULL || out == NULL ) { ++ code = gs_note_error(gs_error_VMerror); ++ goto error; ++ } + + /* Initialize the printer. */ + prn_puts(pdev, "\033@"); +@@ -320,8 +328,10 @@ notz: + } + + /* Eject the page */ +-xit: prn_putc(pdev, 014); /* form feed */ ++xit: ++ prn_putc(pdev, 014); /* form feed */ + prn_flush(pdev); ++error: + gs_free(pdev->memory->non_gc_memory, (char *)out, bits_per_column, line_size, "bj10v_print_page(out)"); + gs_free(pdev->memory->non_gc_memory, (char *)in, 8, line_size, "bj10v_print_page(in)"); + return code; +-- +cgit v1.2.3 +
meta/recipes-extended/ghostscript/ghostscript/CVE-2025-27836-2.patch new file +46 -0
46 lines not on this page · raw message
meta/recipes-extended/ghostscript/ghostscript_9.55.0.bb +2 -0
@@ -68,6 +68,8 @@ SRC_URI_BASE = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/d file://CVE-2025-27832.patch \ file://CVE-2025-27834.patch \ file://CVE-2025-27835.patch \ + file://CVE-2025-27836-1.patch \ + file://CVE-2025-27836-2.patch \ " SRC_URI = "${SRC_URI_BASE} \
Signature · 1 line
2.43.0
PATCH 9/10 qemu: ignore CVE-2023-1386
In reply to Steve SakomanFrom: Peter Marko <[email protected]>
Upstream Repository: https://gitlab.com/qemu-project/qemu.git
Bug Details: https://nvd.nist.gov/vuln/detail/CVE-2023-1386
Type: Security Advisory
CVE: CVE-2023-1386
Score: 3.3
Analysis:
- According to redhat[1] this CVE has closed as not a bug.
Reference:
[1] https://bugzilla.redhat.com/show_bug.cgi?id=2223985
(From OE-Core rev: 6a5d9e3821246c39ec57fa483802e1bb74fca724)
(Converted to old CVE_CHECK_IGNORE syntax)
--- meta/recipes-devtools/qemu/qemu.inc | 3 +++ 1 file changed, 3 insertions(+)
meta/recipes-devtools/qemu/qemu.inc +3 -0
@@ -161,6 +161,9 @@ CVE_CHECK_IGNORE += "CVE-2023-2680" # due to the rocker device not falling within the virtualization use case. CVE_CHECK_IGNORE += "CVE-2022-36648" +# disputed: not an issue as per https://bugzilla.redhat.com/show_bug.cgi?id=2223985 +CVE_CHECK_IGNORE += "CVE-2023-1386" + COMPATIBLE_HOST:mipsarchn32 = "null" COMPATIBLE_HOST:mipsarchn64 = "null" COMPATIBLE_HOST:riscv32 = "null"
Signature · 1 line
2.43.0
Re: [OE-core][kirkstone 09/10] qemu: ignore CVE-2023-1386
Quoted 42 lines · Steve Sakoman via lists.openembedded.org
From: Peter Marko <[email protected]>
Upstream Repository: https://gitlab.com/qemu-project/qemu.git
Bug Details: https://nvd.nist.gov/vuln/detail/CVE-2023-1386
Type: Security Advisory
CVE: CVE-2023-1386
Score: 3.3Analysis:
- According to redhat[1] this CVE has closed as not a bug.Reference:
[1] https://bugzilla.redhat.com/show_bug.cgi?id=2223985(From OE-Core rev:
6a5d9e3821246c39ec57fa483802e1bb74fca724)Signed-off-by Madhu Marri <[email protected]>Signed-off-by Steve Sakoman <[email protected]>(Converted to old
CVE_CHECK_IGNOREsyntax)Signed-off-by Peter Marko <[email protected]>Signed-off-by Steve Sakoman <[email protected]>---
meta/recipes-devtools/qemu/qemu.inc | 3 +++1 file changed, 3 insertions(+)meta/recipes- renamed from meta/recipes-devtools/qemu/qemu.inc +0
-0devtools/qemu/qemu.inc
indexbee30cd56f..cae33459e6100644meta/recipes-devtools/qemu/qemu.inc +0
-0@@ -161,6 +161,9 @@ CVE_CHECK_IGNORE += "CVE-2023-2680" # due to the rocker device not falling within thevirtualization use case.
CVE_CHECK_IGNORE += "CVE-2022-36648"
+# disputed: not an issue as per
https://bugzilla.redhat.com/show_bug.cgi?id=2223985meta/recipes-devtools/qemu/qemu.inc +2
-0+CVE_CHECK_IGNORE += "CVE-2023-1386" +
Quoted 3 lines
COMPATIBLE_HOST:mipsarchn32 = "null"
COMPATIBLE_HOST:mipsarchn64 = "null"
COMPATIBLE_HOST:riscv32 = "null"
This merged to master today. It isn't in walnascar though.
Cheers,
Richard
PATCH 10/10 glibc: Add single-threaded fast path to rand()
In reply to Steve SakomanFrom: Haixiao Yan <[email protected]>
Backport a patch [1] to improve performance of rand() and __random()[2] by adding a single-threaded fast path.
[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=be0cfd848d9ad7378800d6302bc11467cf2b514f
[2] https://sourceware.org/bugzilla/show_bug.cgi?id=32777
--- ...dd-single-threaded-fast-path-to-rand.patch | 47 +++++++++++++++++++ meta/recipes-core/glibc/glibc_2.35.bb | 1 + 2 files changed, 48 insertions(+) create mode 100644 meta/recipes-core/glibc/glibc/0001-stdlib-Add-single-threaded-fast-path-to-rand.patch
meta/recipes-core/glibc/glibc/0001-stdlib-Add-single-threaded-fast-path-to-rand.patch new file +47 -0
@@ -0,0 +1,47 @@ +From 4f54b0dfc16dbe0df86afccb90e447df5f7f571e Mon Sep 17 00:00:00 2001 +From: Wilco Dijkstra <[email protected]> +Date: Mon, 18 Mar 2024 15:18:20 +0000 +Subject: [PATCH] stdlib: Add single-threaded fast path to rand() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Improve performance of rand() and __random() by adding a single-threaded +fast path. Bench-random-lock shows about 5x speedup on Neoverse V1. + +Upstream-Status: Backport [be0cfd848d9ad7378800d6302bc11467cf2b514f] + +Reviewed-by: Adhemerval Zanella <[email protected]> +Signed-off-by: Haixiao Yan <[email protected]> +--- + stdlib/random.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/stdlib/random.c b/stdlib/random.c +index 17cc61ba8f55..5d482a857065 100644 +--- a/stdlib/random.c ++++ b/stdlib/random.c +@@ -51,6 +51,7 @@ + SUCH DAMAGE.*/ + + #include <libc-lock.h> ++#include <sys/single_threaded.h> + #include <limits.h> + #include <stddef.h> + #include <stdlib.h> +@@ -288,6 +289,12 @@ __random (void) + { + int32_t retval; + ++ if (SINGLE_THREAD_P) ++ { ++ (void) __random_r (&unsafe_state, &retval); ++ return retval; ++ } ++ + __libc_lock_lock (lock); + + (void) __random_r (&unsafe_state, &retval); +-- +2.34.1 +
meta/recipes-core/glibc/glibc_2.35.bb +1 -0
@@ -65,6 +65,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ file://0001-Revert-Linux-Implement-a-useful-version-of-_startup_.patch \ file://0002-get_nscd_addresses-Fix-subscript-typos-BZ-29605.patch \ file://0003-sunrpc-suppress-gcc-os-warning-on-user2netname.patch \ + file://0001-stdlib-Add-single-threaded-fast-path-to-rand.patch \ " S = "${WORKDIR}/git" B = "${WORKDIR}/build-${TARGET_SYS}"
Signature · 1 line
2.43.0
Re: [OE-core][kirkstone 10/10] glibc: Add single-threaded fast path to rand()
Quoted 11 lines · Steve Sakoman via lists.openembedded.org
From: Haixiao Yan <[email protected]>
Backport a patch [1] to improve performance of
rand()and __random()[2]
by adding a single-threaded fast path.[1]
https://sourceware.org/git/?p=glibc.git;a=commit;h=be0cfd848d9ad7378800d6302bc11467cf2b514f
[2] https://sourceware.org/bugzilla/show_bug.cgi?id=32777Signed-off-by Haixiao Yan <[email protected]>Signed-off-by Steve Sakoman <[email protected]>
Quoted 7 lines
---
...dd-single-threaded-fast-path-to-rand.patch | 47
+++++++++++++++++++
meta/recipes-core/glibc/glibc_2.35.bb | 1 +2 files changed, 48 insertions(+)create mode 100644 meta/recipes-core/glibc/glibc/0001-stdlib-Add- single-threaded-fast-path-to-rand.patch
This isn't in walnascar yet.
Cheers,
Richard
Re: [OE-core][kirkstone 10/10] glibc: Add single-threaded fast path to rand()
Quoted 22 lines · Richard Purdie
Quoted 11 lines · Steve Sakoman via lists.openembedded.org
From: Haixiao Yan <[email protected]>
Backport a patch [1] to improve performance of
rand()and __random()[2]
by adding a single-threaded fast path.[1]
https://sourceware.org/git/?p=glibc.git;a=commit;h=be0cfd848d9ad7378800d6302bc11467cf2b514f
[2] https://sourceware.org/bugzilla/show_bug.cgi?id=32777Signed-off-by Haixiao Yan <[email protected]>Signed-off-by Steve Sakoman <[email protected]>Quoted 7 lines
--- ...dd-single-threaded-fast-path-to-rand.patch | 47 +++++++++++++++++++ meta/recipes-core/glibc/glibc_2.35.bb | 1 + 2 files changed, 48 insertions(+) create mode 100644 meta/recipes-core/glibc/glibc/0001-stdlib-Add-single-threaded-fast-path-to-rand.patch
Quoted 1 line
This isn't in walnascar yet.
I've got it and "qemu 8.2.7: ignore CVE-2023-1386" in my local walnascar branch. I will hold off merging to all stable branches till after walnascar release.
Thanks for catching this!
Steve
Randy MacLeod
Reviewed-by Adhemerval ZanellaRe: [OE-core][kirkstone 10/10] glibc: Add single-threaded fast path to rand()
Quoted 22 lines · Steve Sakoman via lists.openembedded.org
Quoted 20 lines · Richard Purdie
Quoted 18 lines · Steve Sakoman via lists.openembedded.org
From: Haixiao Yan<[email protected]>
Backport a patch [1] to improve performance of
rand()and __random()[2]
by adding a single-threaded fast path.[1]
https://sourceware.org/git/?p=glibc.git;a=commit;h=be0cfd848d9ad7378800d6302bc11467cf2b514f
[2]https://sourceware.org/bugzilla/show_bug.cgi?id=32777Signed-off-by Haixiao Yan<[email protected]>Signed-off-by Steve Sakoman<[email protected]>--- ...dd-single-threaded-fast-path-to-rand.patch | 47 +++++++++++++++++++ meta/recipes-core/glibc/glibc_2.35.bb | 1 + 2 files changed, 48 insertions(+)create mode 100644 meta/recipes-core/glibc/glibc/0001-stdlib-Add-
single-threaded-fast-path-to-rand.patch
Quoted 6 lines
Quoted 1 line
This isn't in walnascar yet.
I've got it and "qemu 8.2.7: ignore CVE-2023-1386" in my local walnascar branch. I will hold off merging to all stable branches till after walnascar release.
Thanks for catching this!
People were discussing this bug wrt adding it to walnascar's RC2 bulid. The conclusion is to merge it to walnascar *after* GA so it can soak for a bit and to minimize risk to the GA release.
This is a customer issue and they have been happy with the fix since March 28th but it was only merged to our product repo on April 2nd so it's probably a good idea to let it soak.
I'm not sure if it'll help but below is Haixiao's summary from our internal bug tracker. It's a verbose version of the master branch commit log.
One notable comment is:
the issue can not reproduce on modern CPU (such as Zen3/Ryzen9),
they are smart to handle the lock for single-thread case.
I wonder how many other 'modern' targets avoid the issue at build / run time.
If we want more info, please rely and Haixiao can spend some time on digging a bit more.
../Randy
Summary:
This is a generic issue, not only found on wrLinux, also met on ubuntu 22.04.
The degradation since from glibc-2.34, until the latest glibc-2.41 is affected.
The fix will be included in glibc-2.42.
I have filed https://sourceware.org/bugzilla/show_bug.cgi?id=32777 <https://sourceware.org/bugzilla/show_bug.cgi?id=32777> to the upstream.
The first bad commit is 60d5e40ab200033a982a9fd7594a1f83dcdb94a0.
commit 60d5e40ab200033a982a9fd7594a1f83dcdb94a0
Author: Florian Weimer<[email protected]> Date: Wed Apr 21 19:49:51 2021 +0200
x86: Remove low-level lock optimization
The current approach is to do this optimizations at a higher level, in generic code, so that single-threaded cases can be specifically targeted.
Furthermore, using IS_IN (libc) as a compile-time indicator that all locks are private is no longer correct once process-shared lock implementations are moved into libc.
The generic <lowlevellock.h> is not compatible with assembler code (obviously), so it's necessary to remove two long-unused #includes.
This commit remove the optimization for single-threaded case, such as mallocrandfree. From the perf result, random function has been called significantly increased from 15.5% to 42.28%. on glibc-2.33, disassemble the random function:
(gdb) disassemble random
Dump of assembler code for function __random:
0x00007ffff7e3dc20 <+0>: endbr64 0x00007ffff7e3dc24 <+4>: sub $0x18,%rsp 0x00007ffff7e3dc28 <+8>: mov %fs:0x18,%eax 0x00007ffff7e3dc30 <+16>: test %eax,%eax 0x00007ffff7e3dc32 <+18>: jne 0x7ffff7e3dc70 <__random+80> 0x00007ffff7e3dc34 <+20>: mov $0x1,%edx 0x00007ffff7e3dc39 <+25>: cmpxchg %edx,0x17e708(%rip) # 0x7ffff7fbc348 <lock> 0x00007ffff7e3dc40 <+32>: lea 0xc(%rsp),%rsi 0x00007ffff7e3dc45 <+37>: lea 0x17bb14(%rip),%rdi # 0x7ffff7fb9760 <unsafe_state> 0x00007ffff7e3dc4c <+44>: call 0x7ffff7e3e070 <__random_r> 0x00007ffff7e3dc51 <+49>: mov %fs:0x18,%eax 0x00007ffff7e3dc59 <+57>: test %eax,%eax 0x00007ffff7e3dc5b <+59>: jne 0x7ffff7e3dc90 <__random+112> 0x00007ffff7e3dc5d <+61>: subl $0x1,0x17e6e4(%rip) # 0x7ffff7fbc348 <lock> 0x00007ffff7e3dc64 <+68>: movslq 0xc(%rsp),%rax 0x00007ffff7e3dc69 <+73>: add $0x18,%rsp 0x00007ffff7e3dc6d <+77>: ret 0x00007ffff7e3dc6e <+78>: xchg %ax,%ax 0x00007ffff7e3dc70 <+80>: xor %eax,%eax 0x00007ffff7e3dc72 <+82>: mov $0x1,%edx 0x00007ffff7e3dc77 <+87>: lock cmpxchg %edx,0x17e6c9(%rip) # 0x7ffff7fbc348 <lock> 0x00007ffff7e3dc7f <+95>: je 0x7ffff7e3dc40 <__random+32> 0x00007ffff7e3dc81 <+97>: lea 0x17e6c0(%rip),%rdi # 0x7ffff7fbc348 <lock> 0x00007ffff7e3dc88 <+104>: call 0x7ffff7e81c00 <__lll_lock_wait_private> 0x00007ffff7e3dc8d <+109>: jmp 0x7ffff7e3dc40 <__random+32> 0x00007ffff7e3dc8f <+111>: nop 0x00007ffff7e3dc90 <+112>: xor %eax,%eax 0x00007ffff7e3dc92 <+114>: xchg %eax,0x17e6b0(%rip) # 0x7ffff7fbc348 <lock> 0x00007ffff7e3dc98 <+120>: cmp $0x1,%eax 0x00007ffff7e3dc9b <+123>: jle 0x7ffff7e3dc64 <__random+68> 0x00007ffff7e3dc9d <+125>: xor %r10d,%r10d 0x00007ffff7e3dca0 <+128>: mov $0x1,%edx 0x00007ffff7e3dca5 <+133>: mov $0x81,%esi 0x00007ffff7e3dcaa <+138>: mov $0xca,%eax 0x00007ffff7e3dcaf <+143>: lea 0x17e692(%rip),%rdi # 0x7ffff7fbc348 <lock> 0x00007ffff7e3dcb6 <+150>: syscall 0x00007ffff7e3dcb8 <+152>: jmp 0x7ffff7e3dc64 <__random+68>
End of assembler dump.
test %eax,%eax will check the single-threaded condition, if in single-threaded environments, skips locking, calls __random_r directly, and returns the random number. if in multi-threaded environments, acquires a lock, calls __random_r, releases the lock, handles contention, and returns the random number.
on glibc-2.34, disassemble the random function:
(gdb) disassemble random
Dump of assembler code for function __random:
0x00007ffff7c44db0 <+0>: endbr64 0x00007ffff7c44db4 <+4>: sub $0x18,%rsp 0x00007ffff7c44db8 <+8>: xor %eax,%eax 0x00007ffff7c44dba <+10>: mov $0x1,%edx 0x00007ffff7c44dbf <+15>: lock cmpxchg %edx,0x1b0641(%rip) # 0x7ffff7df5408 <lock> 0x00007ffff7c44dc7 <+23>: jne 0x7ffff7c44df8 <__random+72> 0x00007ffff7c44dc9 <+25>: lea 0xc(%rsp),%rsi 0x00007ffff7c44dce <+30>: lea 0x1ada6b(%rip),%rdi # 0x7ffff7df2840 <unsafe_state> 0x00007ffff7c44dd5 <+37>: call 0x7ffff7c451e0 <__random_r> 0x00007ffff7c44dda <+42>: xor %eax,%eax 0x00007ffff7c44ddc <+44>: xchg %eax,0x1b0626(%rip) # 0x7ffff7df5408 <lock> 0x00007ffff7c44de2 <+50>: cmp $0x1,%eax 0x00007ffff7c44de5 <+53>: jg 0x7ffff7c44e10 <__random+96> 0x00007ffff7c44de7 <+55>: movslq 0xc(%rsp),%rax 0x00007ffff7c44dec <+60>: add $0x18,%rsp 0x00007ffff7c44df0 <+64>: ret 0x00007ffff7c44df1 <+65>: nopl 0x0(%rax) 0x00007ffff7c44df8 <+72>: lea 0x1b0609(%rip),%rdi # 0x7ffff7df5408 <lock> 0x00007ffff7c44dff <+79>: call 0x7ffff7c88680 <__GI___lll_lock_wait_private> 0x00007ffff7c44e04 <+84>: jmp 0x7ffff7c44dc9 <__random+25> 0x00007ffff7c44e06 <+86>: cs nopw 0x0(%rax,%rax,1) 0x00007ffff7c44e10 <+96>: lea 0x1b05f1(%rip),%rdi # 0x7ffff7df5408 <lock> 0x00007ffff7c44e17 <+103>: call 0x7ffff7c88750 <__GI___lll_lock_wake_private> 0x00007ffff7c44e1c <+108>: movslq 0xc(%rsp),%rax 0x00007ffff7c44e21 <+113>: add $0x18,%rsp 0x00007ffff7c44e25 <+117>: ret
End of assembler dump.
Both single-threaded and multi-threaded are using atomic operations and lock management. So cause the performance of single-threaded cases degradation.
The fix has been included on master branch on Feb 24, 2025.
https://sourceware.org/git/?p=glibc.git;a=commit;h=be0cfd848d9ad7378800d6302bc11467cf2b514f <https://sourceware.org/git/?p=glibc.git;a=commit;h=be0cfd848d9ad7378800d6302bc11467cf2b514f>
after the fix, disassemble the random function:
(gdb) disassemble random
Dump of assembler code for function __random:
0x00007ffff7e1d0b0 <+0>: endbr64 0x00007ffff7e1d0b4 <+4>: sub $0x18,%rsp 0x00007ffff7e1d0b8 <+8>: cmpb $0x0,0x199221(%rip) # 0x7ffff7fb62e0 <__libc_single_threaded_internal> 0x00007ffff7e1d0bf <+15>: jne 0x7ffff7e1d100 <__random+80> 0x00007ffff7e1d0c1 <+17>: xor %eax,%eax 0x00007ffff7e1d0c3 <+19>: mov $0x1,%edx 0x00007ffff7e1d0c8 <+24>: lock cmpxchg %edx,0x1935c0(%rip) # 0x7ffff7fb0690 <lock> 0x00007ffff7e1d0d0 <+32>: jne 0x7ffff7e1d130 <__random+128> 0x00007ffff7e1d0d2 <+34>: lea 0xc(%rsp),%rsi 0x00007ffff7e1d0d7 <+39>: lea 0x1917a2(%rip),%rdi # 0x7ffff7fae880 <unsafe_state> 0x00007ffff7e1d0de <+46>: call 0x7ffff7e1d500 <__random_r> 0x00007ffff7e1d0e3 <+51>: xor %eax,%eax 0x00007ffff7e1d0e5 <+53>: xchg %eax,0x1935a5(%rip) # 0x7ffff7fb0690 <lock> 0x00007ffff7e1d0eb <+59>: cmp $0x1,%eax 0x00007ffff7e1d0ee <+62>: jg 0x7ffff7e1d120 <__random+112> 0x00007ffff7e1d0f0 <+64>: movslq 0xc(%rsp),%rax 0x00007ffff7e1d0f5 <+69>: add $0x18,%rsp 0x00007ffff7e1d0f9 <+73>: ret 0x00007ffff7e1d0fa <+74>: nopw 0x0(%rax,%rax,1) 0x00007ffff7e1d100 <+80>: lea 0xc(%rsp),%rsi 0x00007ffff7e1d105 <+85>: lea 0x191774(%rip),%rdi # 0x7ffff7fae880 <unsafe_state> 0x00007ffff7e1d10c <+92>: call 0x7ffff7e1d500 <__random_r> 0x00007ffff7e1d111 <+97>: movslq 0xc(%rsp),%rax 0x00007ffff7e1d116 <+102>: add $0x18,%rsp 0x00007ffff7e1d11a <+106>: ret 0x00007ffff7e1d11b <+107>: nopl 0x0(%rax,%rax,1) 0x00007ffff7e1d120 <+112>: lea 0x193569(%rip),%rdi # 0x7ffff7fb0690 <lock> 0x00007ffff7e1d127 <+119>: call 0x7ffff7e60360 <__GI___lll_lock_wake_private> 0x00007ffff7e1d12c <+124>: jmp 0x7ffff7e1d0f0 <__random+64> 0x00007ffff7e1d12e <+126>: xchg %ax,%ax 0x00007ffff7e1d130 <+128>: lea 0x193559(%rip),%rdi # 0x7ffff7fb0690 <lock> 0x00007ffff7e1d137 <+135>: call 0x7ffff7e60290 <__GI___lll_lock_wait_private> 0x00007ffff7e1d13c <+140>: jmp 0x7ffff7e1d0d2 <__random+34>
End of assembler dump.
cmpb $0x0,0x199221(%rip) will check single-threaded mode, which avoids unnecessary locking.
BTW, the issue can not reproduce on modern CPU (such as Zen3/Ryzen9), they are smart to handle the lock for single-thread case.
Quoted 11 lines
Steve
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#214675):https://lists.openembedded.org/g/openembedded-core/message/214675 Mute This Topic:https://lists.openembedded.org/mt/112161542/3616765
Group Owner:[email protected] Unsubscribe:https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 2 lines
# Randy MacLeod # Wind River Linux