overlay sys-fs/overlaybd: Add a patch for issue inside tcmu

This commit is contained in:
Krzesimir Nowak 2025-08-08 17:10:30 +02:00
parent bac06fe408
commit 90a47bbff8
3 changed files with 72 additions and 1 deletions

View File

@ -127,3 +127,28 @@ Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
--
2.49.0
From 32a592ef523a14600ce658a695d827724aeb66c9 Mon Sep 17 00:00:00 2001
From: Krzesimir Nowak <knowak@microsoft.com>
Date: Fri, 8 Aug 2025 16:47:58 +0200
Subject: [PATCH] Patch libtcmu after fetching to fix memory issues
---
CMake/Findtcmu.cmake | 1 +
1 file changed, 1 insertion(+)
diff --git a/CMake/Findtcmu.cmake b/CMake/Findtcmu.cmake
index 6e8f0ef..5865a9b 100644
--- a/CMake/Findtcmu.cmake
+++ b/CMake/Findtcmu.cmake
@@ -5,6 +5,7 @@ FetchContent_Declare(
tcmu
GIT_REPOSITORY https://github.com/data-accelerator/photon-libtcmu.git
GIT_TAG main
+ PATCH_COMMAND patch -p1 -i @FILESDIR@/tcmu-fix.patch
)
if(BUILD_TESTING)
--
2.49.1

View File

@ -0,0 +1,46 @@
From 0ee2c928de51ef56376c4ab6528ca1e23c13c4a7 Mon Sep 17 00:00:00 2001
From: Krzesimir Nowak <knowak@microsoft.com>
Date: Fri, 8 Aug 2025 16:29:52 +0200
Subject: [PATCH] fix
---
scsi.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scsi.cpp b/scsi.cpp
index d8c27a9..4c7f480 100644
--- a/scsi.cpp
+++ b/scsi.cpp
@@ -183,7 +183,7 @@ int tcmu_emulate_evpd_inquiry(
{
char data[512];
char *ptr, *p, *wwn;
- size_t len, used = 0;
+ size_t len, used = 4;
uint16_t *tot_len = (uint16_t*) &data[2];
uint32_t padding;
bool next;
@@ -207,7 +207,7 @@ int tcmu_emulate_evpd_inquiry(
ptr[3] = 8 + len + 1;
used += (uint8_t)ptr[3] + 4;
- ptr += used;
+ ptr += (uint8_t)ptr[3] + 4;
/* 2/5: NAA binary */
ptr[0] = 1; /* code set: binary */
@@ -340,9 +340,9 @@ int tcmu_emulate_evpd_inquiry(
finish_page83:
/* Done with descriptor list */
- *tot_len = htobe16(used);
+ *tot_len = htobe16(used - 4);
- tcmu_memcpy_into_iovec(iovec, iov_cnt, data, used + 4);
+ tcmu_memcpy_into_iovec(iovec, iov_cnt, data, used);
free(wwn);
wwn = NULL;
--
2.49.1

View File

@ -49,7 +49,7 @@ PATCHES=(
src_prepare() {
cmake_src_prepare
sed -i "s:@FILESDIR@:${FILESDIR}:g" CMake/Findphoton.cmake || die
sed -i "s:@FILESDIR@:${FILESDIR}:g" CMake/Findphoton.cmake CMake/Findtcmu.cmake || die
}
src_configure() {