Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
3b46ae8082
!140 [sync] PR-138: update open-iscsi.spec
From: @openeuler-sync-bot 
Reviewed-by: @swf504 
Signed-off-by: @swf504
2024-02-21 09:49:13 +00:00
JiangJianJun
278a7ef832 update open-iscsi.spec
correct the spell error.

Signed-off-by: zhuchunyi <zhuchunyi@huawei.com>
(cherry picked from commit cf096d02bd7cd9ab24b386cc5e470a669b296f53)
2024-02-21 16:10:40 +08:00
openeuler-ci-bot
0ff2600885
!115 [sync] PR-111: backport bugfix patches from mainline
From: @openeuler-sync-bot 
Reviewed-by: @liuzhiqiang26 
Signed-off-by: @liuzhiqiang26
2022-12-02 09:09:13 +00:00
Wenchao Hao
20f4e79640 Backport bugfix patches from mainline
Reference:https://github.com/open-iscsi/open-iscsi/commit/fd0b3973

Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
(cherry picked from commit a88aa3bea7cfbb8a19fd440e94673c736cdad4b9)
2022-12-02 16:48:56 +08:00
openeuler-ci-bot
df881c7e89
!109 [sync] PR-108: update changelog time
From: @openeuler-sync-bot 
Reviewed-by: @liuzhiqiang26 
Signed-off-by: @liuzhiqiang26
2022-10-10 06:53:57 +00:00
linfeilong835
19318edb36 update changlog time
Signed-off-by: linfeilong835 <linfeilong@huawei.com>
(cherry picked from commit 7ea7d41e296a9349cfc3ef1e11819a8ba872be4a)
2022-10-10 14:39:00 +08:00
openeuler-ci-bot
a321e0a62b
!106 [sync] PR-101: Substitute self-developed patch with mainline patch
From: @openeuler-sync-bot 
Reviewed-by: @liuzhiqiang26 
Signed-off-by: @liuzhiqiang26
2022-09-27 12:31:55 +00:00
Wenchao Hao
1f6b252bc4 Substitute self-developed patch with mainline patch
Substitute self-developed patch with mainline patch to fix
nr_sessions do not work during iscsid restart.

Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
(cherry picked from commit 0cf163c1d643279e33afe3e8bbecec8bc7250f0d)
2022-09-27 19:42:21 +08:00
openeuler-ci-bot
0292f0fa58
!83 [sync] PR-81: Remove password printing in session info display
Merge pull request !83 from openeuler-sync-bot/sync-pr81-openEuler-20.03-LTS-SP1-to-openEuler-20.03-LTS-SP3
2022-01-26 09:51:20 +00:00
Wenchao Hao
a8da8d9002 Remove password printing in session info display
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
(cherry picked from commit 927e2ffedd3ba1d187d75d5ed421eba9f8970720)
2022-01-26 17:22:31 +08:00
5 changed files with 249 additions and 52 deletions

View File

@ -1,46 +0,0 @@
From 93d217ce22e7668abfc5e6dbc015b37b20174b09 Mon Sep 17 00:00:00 2001
From: huangkaibin <huangkaibin@huawei.com>
Date: Fri, 19 Jan 2018 03:00:17 +0800
Subject: [PATCH] iscsid: Do not sync session when a session is already created
for a remote device
Do not sync session when a session is already created for a remote device
1. In the following scenarios, two or more sessions will be created and open for one remote device
a) two or more sync sessions are requested from the sync process for the same remote device.
this may occur when iscsid is restarted, one is requested by the previous started sync process but not handled, and another
is requested by the newly started sync process.
b) one is created in sync session, the other is created in __session_login_task.
2. If two or more sessions are created for one remote device, and there are connection problems on the remote device,
these sessions will be reopen again, and will cause one to close the connection while the other to set param for the remote device
in kernel, and will cause kernel to panic.
3. this patch fix this problem by not sync session when a session is already created for a remote device
---
usr/initiator.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/usr/initiator.c b/usr/initiator.c
index 60bd2b7..4a48bf5 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -2097,11 +2097,18 @@ iscsi_sync_session(node_rec_t *rec, queue_task_t *qtask, uint32_t sid)
iscsi_session_t *session;
struct iscsi_transport *t;
int err;
+ int nr_found;
t = iscsi_sysfs_get_transport_by_name(rec->iface.transport_name);
if (!t)
return ISCSI_ERR_TRANS_NOT_FOUND;
+ nr_found = session_find_by_rec(rec);
+ if(nr_found > 0) {
+ log_error("session is already created. sid: %d, name: %s.\n", sid, rec->name);
+ return ISCSI_ERR_SESS_EXISTS;
+ }
+
session = __session_create(rec, t, &err);
if (!session)
return ISCSI_ERR_LOGIN;
--
1.8.3.1

View File

@ -0,0 +1,59 @@
From 88fa76cec740cc44b7c4b9b384a87ef6c1288174 Mon Sep 17 00:00:00 2001
From: Wenchao Hao <haowenchao@huawei.com>
Date: Tue, 8 Feb 2022 10:40:33 +0800
Subject: [PATCH] iscsid: Check session id before start sync a thread
If session id has already been synced just return ISCSI_ERR_SESS_EXISTS.
A same session id would make two MGMT_IPC_SESSION_SYNC requests in
following scenario:
iscsid.socket is enabled, and iscsid did not handle previous
MGMT_IPC_SESSION_SYNC due to abnormal exit. This MGMT_IPC_SESSION_SYNC
request would left unhandled, when iscsid restart again, newly started
iscsid can get this MGMT_IPC_SESSION_SYNC request.
While the newly started iscsid would make a MGMT_IPC_SESSION_SYNC
request for same session id too.
So here should check if the session id has already been synced.
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
---
usr/initiator.c | 4 ++++
usr/iscsid.c | 3 +++
2 files changed, 7 insertions(+)
diff --git a/usr/initiator.c b/usr/initiator.c
index 684647c..4ec00b0 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -2012,6 +2012,10 @@ iscsi_sync_session(node_rec_t *rec, queue_task_t *qtask, uint32_t sid)
struct iscsi_transport *t;
int err;
+ session = session_find_by_sid(sid);
+ if (session != NULL)
+ return ISCSI_ERR_SESS_EXISTS;
+
t = iscsi_sysfs_get_transport_by_name(rec->iface.transport_name);
if (!t)
return ISCSI_ERR_TRANS_NOT_FOUND;
diff --git a/usr/iscsid.c b/usr/iscsid.c
index 478c83d..e5bd1f5 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -289,7 +289,10 @@ retry:
retries++;
sleep(1);
goto retry;
+ } else if (rc == ISCSI_ERR_SESS_EXISTS) {
+ log_debug(1, "sync session %d returned ISCSI_ERR_SESS_EXISTS", info->sid);
}
+
return 0;
}
--
2.27.0

View File

@ -0,0 +1,56 @@
From fe6458547a2e6dd6c7dd8246738e0c8a73478171 Mon Sep 17 00:00:00 2001
From: Wenchao Hao <haowenchao@huawei.com>
Date: Tue, 25 Jan 2022 19:36:35 +0800
Subject: [PATCH] Remove session info password print
In consideration of security, password should not be printed
in log, so this patch remove password printing in code.
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
---
usr/session_info.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/usr/session_info.c b/usr/session_info.c
index 0dae82f..b9c406f 100644
--- a/usr/session_info.c
+++ b/usr/session_info.c
@@ -268,7 +268,6 @@ void session_info_print_tree(struct iscsi_session **ses, uint32_t se_count,
int32_t tgt_reset_tmo = -1;
int32_t lu_reset_tmo = -1;
int32_t abort_tmo = -1;
- const char *pass = NULL;
for (i = 0; i < se_count; ++i) {
curr = ses[i];
@@ -403,24 +402,15 @@ void session_info_print_tree(struct iscsi_session **ses, uint32_t se_count,
if (!do_show)
printf("%s\t\tpassword: %s\n", prefix,
"********");
- else {
- pass = iscsi_session_password_get(curr);
+ else
printf("%s\t\tpassword: %s\n", prefix,
- strlen(pass) ? pass : UNKNOWN_VALUE);
- }
+ "********");
printf("%s\t\tusername_in: %s\n", prefix,
strlen(iscsi_session_username_in_get(curr)) ?
iscsi_session_username_in_get(curr) :
UNKNOWN_VALUE);
- if (!do_show)
- printf("%s\t\tpassword_in: %s\n", prefix,
- "********");
- else {
- pass = iscsi_session_password_in_get(curr);
- printf("%s\t\tpassword: %s\n", prefix,
- strlen(pass) ? pass : UNKNOWN_VALUE);
- }
+ printf("%s\t\tpassword_in: %s\n", prefix,"********");
}
if (flags & SESSION_INFO_ISCSI_PARAMS)
--
1.8.3.1

View File

@ -0,0 +1,114 @@
From a64d26f81ce084a59c36e15b1adb87434e3858ea Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Fri, 14 Oct 2022 10:56:59 -0700
Subject: [PATCH] iscsid/iscsiuio: fix OOM adjustment (#377)
* iscsid/iscsiuio: fix OOM adjustment
For both the iscsid and iscsiuio daemons, they try to modify
nice value and OOM adjustment value, so they have priority
and will not be killed by the OOM-killer.
But the code incorrectly set the value to "-17" for modern
linux systems, when the maximum is actually "-1000". While
making the changes, use "/proc/self/..." instead of
"/proc/<PID>/...", so we don't have to use getpid() nor
print out the pathname. Now we either write "-16" to
the old interface, "-1000" to the new interface, or we
print a warning.
Several "log_debug()" calls that should have been warnings
are changed to "log_warning()" calls in iscsid.
* iscsid/iscsiuio: fix OOM adjustment value for older systems
On older linux system, "-17" is the maximum, not "-16".
---
usr/iscsi_util.c | 47 +++++++++++++++++++++++++++--------------------
usr/iscsid.c | 2 +-
2 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/usr/iscsi_util.c b/usr/iscsi_util.c
index fd8fc0c..3e0528f 100644
--- a/usr/iscsi_util.c
+++ b/usr/iscsi_util.c
@@ -65,36 +65,43 @@ void daemon_init(void)
close(fd);
}
-#define ISCSI_OOM_PATH_LEN 48
-
+/*
+ * make a best effort at ajusting our nice
+ * score and our OOM score, but it's not considered
+ * fatal if either adjustment fails
+ *
+ * return 0 on success of OOM adjustment
+ */
int oom_adjust(void)
{
int fd;
- char path[ISCSI_OOM_PATH_LEN];
- struct stat statb;
+ int res = 0;
errno = 0;
if (nice(-10) == -1 && errno != 0)
- log_debug(1, "Could not increase process priority: %s",
+ log_warning("Could not increase process priority: %s",
strerror(errno));
- snprintf(path, ISCSI_OOM_PATH_LEN, "/proc/%d/oom_score_adj", getpid());
- if (stat(path, &statb)) {
- /* older kernel so use old oom_adj file */
- snprintf(path, ISCSI_OOM_PATH_LEN, "/proc/%d/oom_adj",
- getpid());
- }
- fd = open(path, O_WRONLY);
- if (fd < 0)
+ /*
+ * try the modern method of adjusting our OOM score,
+ * then try the old one, if that fails
+ */
+ if ((fd = open("/proc/self/oom_score_adj", O_WRONLY)) >= 0) {
+ if ((res = write(fd, "-1000", 5)) < 0)
+ log_warning("Could not set /proc/self/oom_score_adj to -1000: %s",
+ strerror(errno));
+ } else if ((fd = open("/proc/self/oom_adj", O_WRONLY)) >= 0) {
+ if ((res = write(fd, "-17", 3)) < 0)
+ log_warning("Could not set /proc/self/oom_adj to -16: %s",
+ strerror(errno));
+ } else
return -1;
- if (write(fd, "-16", 3) < 0) /* for 2.6.11 */
- log_debug(1, "Could not set oom score to -16: %s",
- strerror(errno));
- if (write(fd, "-17", 3) < 0) /* for Andrea's patch */
- log_debug(1, "Could not set oom score to -17: %s",
- strerror(errno));
+
close(fd);
- return 0;
+ if (res < 0)
+ return res;
+ else
+ return 0;
}
char*
diff --git a/usr/iscsid.c b/usr/iscsid.c
index 138e6b7..b2bfac7 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -592,7 +592,7 @@ int main(int argc, char *argv[])
/* oom-killer will not kill us at the night... */
if (oom_adjust())
- log_debug(1, "can not adjust oom-killer's pardon");
+ log_warning("Cannot adjust oom-killer's pardon");
/* we don't want our active sessions to be paged out... */
if (mlockall(MCL_CURRENT | MCL_FUTURE)) {
--
2.27.0

View File

@ -4,7 +4,7 @@
Name: open-iscsi
Version: 2.1.1
Release: 10
Release: 14
Summary: ISCSI software initiator daemon and utility programs
License: GPLv2+ and BSD
URL: http://www.open-iscsi.com
@ -16,7 +16,7 @@ Patch4: 0004-not-send-stop-message-if-iscsid-absent.patch
Patch5: 0005-iscsid-SIGTERM-syncprocess-hang.patch
Patch6: 0006-restart-log-daemon-when-exited-abnormally.patch
Patch7: 0007-check-initiator-name-out-of-range.patch
Patch8: 0008-do-not-sync-session-when-a-session-is-already-created.patch
Patch8: 0008-iscsid-Check-session-id-before-start-sync-a-thread.patch
Patch9: 0009-fix-default-file-corrupt.patch
Patch10: 0010-iscsiadm-fix-infinite-loop-while-recv-returns-0.patch
Patch11: 0011-fix-iscsiadm-logout-timeout.patch
@ -32,6 +32,8 @@ Patch20: 0020-check-for-header-length-underflow-during-checksum-ca.patch
Patch21: 0021-check-for-u8-overflow-when-processing-TCP-options.patch
Patch22: 0022-check-for-TCP-urgent-pointer-past-end-of-frame.patch
Patch23: 0023-fix-iscsiadm-op-new-report-to-cannot-rename-error.patch
patch24: 0024-Remove-session-info-password-print.patch
patch25: 0025-iscsid-iscsiuio-fix-OOM-adjustment-377.patch
BuildRequires: flex bison doxygen kmod-devel systemd-units gcc git isns-utils-devel systemd-devel
BuildRequires: autoconf automake libtool libmount-devel openssl-devel pkg-config gdb
@ -41,8 +43,8 @@ Provides: iscsi-initiator-utils
Obsoletes: iscsi-initiator-utils
Provides: iscsi-initiator-utils-iscsiuio
Obsoletes: iscsi-initiator-utils-iscsiuio
Provides: libbopeniscsiusr
Obsoletes: libbopeniscsiusr
Provides: libopeniscsiusr
Obsoletes: libopeniscsiusr
%{?systemd_requires}
%description
@ -165,6 +167,18 @@ fi
%{_mandir}/man8/*
%changelog
* Tue Feb 20 2024 jiangjianjun <jiangjianjun3@huawei.com> - 2.1.1-14
- update open-iscsi.spec provides information
* Fri Dec 2 2022 haowenchao <haowenchao@huawei.com> - 2.1.1-13
- Backport bugfix patches from mainline
* Tue Sep 27 2022 haowenchao <haowenchao@huawei.com> - 2.1.1-12
- Substitute self-developed patch with mainline patch
* Thu Oct 21 2021 haowenchao <haowenchao@huawei.com> - 2.1.1-11
- Remove password print in session info display
* Thu Oct 21 2021 haowenchao <haowenchao@huawei.com> - 2.1.1-10
- Update URL
@ -182,10 +196,10 @@ fi
* Thu Apr 8 2021 haowenchao <haowenchao@huawei.com> - 2.1.1-6
- Fix file residual files after open-iscsi removed
* Tue Mon 22 2021 haowenchao <haowenchao@huawei.com> - 2.1.1-5
* Mon Feb 22 2021 haowenchao <haowenchao@huawei.com> - 2.1.1-5
- Fix iscsiadm op new report to cannot rename error
* Tue Mon 22 2021 haowenchao <haowenchao@huawei.com> - 2.1.1-4
* Mon Feb 22 2021 haowenchao <haowenchao@huawei.com> - 2.1.1-4
- Fix CVE-2020-13987 CVE-2020-13988 CVE-2020-17437
* Tue Dec 15 2020 haowenchao <haowenchao@huawei.com> - 2.1.1-3