Accepting request 676927 from Base:System
OBS-URL: https://build.opensuse.org/request/show/676927 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/tgt?expand=0&rev=35
This commit is contained in:
commit
2bbe71a4a5
16
_service
Normal file
16
_service
Normal file
@ -0,0 +1,16 @@
|
||||
<services>
|
||||
<service name="tar_scm" mode="disabled">
|
||||
<param name="scm">git</param>
|
||||
<param name="url">https://github.com/fujita/tgt.git</param>
|
||||
<param name="subdir"></param>
|
||||
<param name="filename">tgt</param>
|
||||
<param name="versionformat">v1.0.74</param>
|
||||
<param name="revision">1.0.74</param>
|
||||
<param name="changesgenerate">enable</param>
|
||||
</service>
|
||||
<service name="recompress" mode="disabled">
|
||||
<param name="file">*tgt*.tar</param>
|
||||
<param name="compression">gz</param>
|
||||
</service>
|
||||
<service name="set_version" mode="disabled"/>
|
||||
</services>
|
4
_servicedata
Normal file
4
_servicedata
Normal file
@ -0,0 +1,4 @@
|
||||
<servicedata>
|
||||
<service name="tar_scm">
|
||||
<param name="url">https://github.com/fujita/tgt.git</param>
|
||||
<param name="changesrevision">f33f6b73d3bfac8b3e44f068d02f90627b407f4e</param></service></servicedata>
|
102
tgt-Fix-gcc7-string-truncation-warnings.patch
Normal file
102
tgt-Fix-gcc7-string-truncation-warnings.patch
Normal file
@ -0,0 +1,102 @@
|
||||
From 2de8bebe132e3b998bf4848d0bd22b50367ad4b8 Mon Sep 17 00:00:00 2001
|
||||
From: Lee Duncan <lduncan@suse.com>
|
||||
Date: Sat, 16 Feb 2019 10:29:19 -0800
|
||||
Subject: [PATCH] Fix gcc7 string truncation warnings.
|
||||
|
||||
Mostly, this is fixed by checking the legnth
|
||||
of strings to be copied, making sure they will
|
||||
fit where they are being copied to, and
|
||||
erroring out if the copy will not fit. Then
|
||||
we can just use strcpy(). We also use
|
||||
scsi_sprintf() for copying to SCSI structures,
|
||||
with their special requirements.
|
||||
---
|
||||
usr/mgmt.c | 9 +++++++--
|
||||
usr/smc.c | 9 +++++++--
|
||||
usr/spc.c | 9 ++++++---
|
||||
usr/tgtadm.c | 6 +++++-
|
||||
4 files changed, 25 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/usr/mgmt.c b/usr/mgmt.c
|
||||
index de23f1469494..00a4e08c01dc 100644
|
||||
--- a/usr/mgmt.c
|
||||
+++ b/usr/mgmt.c
|
||||
@@ -797,11 +797,16 @@ int ipc_init(void)
|
||||
goto close_lock_fd;
|
||||
}
|
||||
|
||||
- snprintf(mgmt_path, sizeof(mgmt_path), "%s.%d", path, control_port);
|
||||
+ snprintf(mgmt_path, sizeof(mgmt_path) - 1, "%s.%d", path, control_port);
|
||||
+ if (strlen(mgmt_path) > (sizeof(addr.sun_path) - 1)) {
|
||||
+ eprintf("managment path too long: %s\n", mgmt_path);
|
||||
+ goto close_ipc_fd;
|
||||
+ }
|
||||
unlink(mgmt_path);
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sun_family = AF_LOCAL;
|
||||
- strncpy(addr.sun_path, mgmt_path, sizeof(addr.sun_path));
|
||||
+ /* no need for strncpy because we already checked length */
|
||||
+ strcpy(addr.sun_path, mgmt_path);
|
||||
|
||||
err = bind(fd, (struct sockaddr *) &addr, sizeof(addr));
|
||||
if (err) {
|
||||
diff --git a/usr/smc.c b/usr/smc.c
|
||||
index b80aba272909..bbc7b7fc7b88 100644
|
||||
--- a/usr/smc.c
|
||||
+++ b/usr/smc.c
|
||||
@@ -732,8 +732,13 @@ static tgtadm_err config_slot(struct scsi_lu *lu, struct tmp_param *tmp)
|
||||
adm_err = TGTADM_SUCCESS;
|
||||
break;
|
||||
}
|
||||
- strncpy(s->barcode, tmp->barcode, sizeof(s->barcode));
|
||||
- strncpy(s->volume_tag, tmp->volume_tag, sizeof(s->volume_tag));
|
||||
+ if (strlen(tmp->barcode) > sizeof(s->barcode) ||
|
||||
+ strlen(tmp->volume_tag) > sizeof(s->volume_tag)) {
|
||||
+ eprintf("barcode or volume tag too large?");
|
||||
+ break;
|
||||
+ }
|
||||
+ strcpy(s->barcode, tmp->barcode);
|
||||
+ strcpy(s->volume_tag, tmp->volume_tag);
|
||||
set_slot_full(s, 0, NULL);
|
||||
adm_err = TGTADM_SUCCESS;
|
||||
break;
|
||||
diff --git a/usr/spc.c b/usr/spc.c
|
||||
index 82a6ec9ee863..902d5bf4a60b 100644
|
||||
--- a/usr/spc.c
|
||||
+++ b/usr/spc.c
|
||||
@@ -289,9 +289,12 @@ int spc_inquiry(int host_no, struct scsi_cmd *cmd)
|
||||
data[7] = 0x02;
|
||||
|
||||
memset(data + 8, 0x20, 28);
|
||||
- strncpy((char *)data + 8, attrs->vendor_id, VENDOR_ID_LEN);
|
||||
- strncpy((char *)data + 16, attrs->product_id, PRODUCT_ID_LEN);
|
||||
- strncpy((char *)data + 32, attrs->product_rev, PRODUCT_REV_LEN);
|
||||
+ scsi_sprintf((char *)data + 8, VENDOR_ID_LEN, "%-*s",
|
||||
+ VENDOR_ID_LEN, attrs->vendor_id);
|
||||
+ scsi_sprintf((char *)data + 16, PRODUCT_ID_LEN, "%-*s",
|
||||
+ PRODUCT_ID_LEN, attrs->product_id);
|
||||
+ scsi_sprintf((char *)data + 32, PRODUCT_REV_LEN, "%-*s",
|
||||
+ PRODUCT_REV_LEN, attrs->product_rev);
|
||||
|
||||
desc = (uint16_t *)(data + 58);
|
||||
for (i = 0; i < ARRAY_SIZE(attrs->version_desc); i++)
|
||||
diff --git a/usr/tgtadm.c b/usr/tgtadm.c
|
||||
index 5572c3888a80..cb3eb1cd126f 100644
|
||||
--- a/usr/tgtadm.c
|
||||
+++ b/usr/tgtadm.c
|
||||
@@ -224,7 +224,11 @@ static int ipc_mgmt_connect(int *fd)
|
||||
snprintf(mgmt_path, sizeof(mgmt_path), "%s.%d",
|
||||
path, control_port);
|
||||
|
||||
- strncpy(addr.sun_path, mgmt_path, sizeof(addr.sun_path));
|
||||
+ if (strlen(mgmt_path) > (sizeof(addr.sun_path) - 1)) {
|
||||
+ eprintf("management path too long: %s\n", mgmt_path);
|
||||
+ return EINVAL;
|
||||
+ }
|
||||
+ strcpy(addr.sun_path, mgmt_path);
|
||||
|
||||
err = connect(*fd, (struct sockaddr *) &addr, sizeof(addr));
|
||||
if (err < 0)
|
||||
--
|
||||
2.16.4
|
||||
|
@ -1,12 +0,0 @@
|
||||
diff -aurp tgt-1.0.60.orig/usr/tgtd.c tgt-1.0.60/usr/tgtd.c
|
||||
--- tgt-1.0.60.orig/usr/tgtd.c 2015-07-01 17:10:39.000000000 -0700
|
||||
+++ tgt-1.0.60/usr/tgtd.c 2018-08-11 18:08:50.707873331 -0700
|
||||
@@ -310,7 +310,7 @@ int call_program(const char *cmd, void (
|
||||
pos = arg;
|
||||
str_spacecpy(&pos, cmd);
|
||||
if (strchr(cmd, ' ')) {
|
||||
- while (pos != '\0')
|
||||
+ while (pos != NULL)
|
||||
argv[i++] = strsep(&pos, " ");
|
||||
} else
|
||||
argv[i++] = arg;
|
@ -16,22 +16,13 @@ diff --git a/usr/Makefile b/usr/Makefile
|
||||
index e29826c..31067e8 100644
|
||||
--- a/usr/Makefile
|
||||
+++ b/usr/Makefile
|
||||
@@ -32,12 +32,15 @@ INCLUDES += -I.
|
||||
@@ -40,6 +40,9 @@ INCLUDES += -I.
|
||||
|
||||
CFLAGS += -D_GNU_SOURCE
|
||||
CFLAGS += $(INCLUDES)
|
||||
+ifneq ($(OPTFLAGS),)
|
||||
+ifneq ($(OPTFAGS),)
|
||||
+CFLAGS += $(OPTFLAGS)
|
||||
+endif
|
||||
ifneq ($(DEBUG),)
|
||||
CFLAGS += -g -O0 -ggdb -rdynamic
|
||||
else
|
||||
CFLAGS += -g -O2 -fno-strict-aliasing
|
||||
endif
|
||||
CFLAGS += -Wall -Wstrict-prototypes -fPIC
|
||||
+endif
|
||||
CFLAGS += -DTGT_VERSION=\"$(VERSION)$(EXTRAVERSION)\"
|
||||
CFLAGS += -DBSDIR=\"$(DESTDIR)$(libdir)/backing-store\"
|
||||
|
||||
--
|
||||
1.8.1.4
|
||||
|
||||
|
@ -1,55 +0,0 @@
|
||||
From: Lee Duncan <lduncan@suse.com>
|
||||
Date: Wed, 28 Oct 2015 14:16:13 +0900
|
||||
Subject: Handle access of a target that has been removed
|
||||
Git-commit: 2791ed243ab2a2fcfe48aea4a0cc23f4ad8467dc
|
||||
Patch-mainline: v1.0.61
|
||||
|
||||
I recently got a report of a tgtd core dump from our opencloud
|
||||
group. The stack trace showed that a strcmp against a NULL was causing
|
||||
the failure:
|
||||
|
||||
----------------------------------------------------------------
|
||||
Program terminated with signal 11, Segmentation fault.
|
||||
(gdb) bt
|
||||
name=0x6ac16f "iqn.2010-10.org.openstack:volume-e812c705-80bc-4064-a84c-5559cda8b1ca") at iscsi/target.c:216
|
||||
at iscsi/iscsid.c:654
|
||||
events=1, data=0x63a480 <target_list>) at iscsi/iscsi_tcp.c:158
|
||||
----------------------------------------------------------------
|
||||
|
||||
It looks like target_find_by_name() uses tgt_targetname(), but doesn't
|
||||
account for the fact that it can return a NULL when the target being
|
||||
looked up does not (now) exist:
|
||||
|
||||
----------------------------------------------------------------
|
||||
char *tgt_targetname(int tid)
|
||||
{
|
||||
struct target *target;
|
||||
|
||||
target = target_lookup(tid);
|
||||
if (!target)
|
||||
return NULL;
|
||||
|
||||
return target->name;
|
||||
}
|
||||
|
||||
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
|
||||
Acked-by: Lee Duncan <lduncan@suse.com>
|
||||
---
|
||||
usr/iscsi/target.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/usr/iscsi/target.c
|
||||
+++ b/usr/iscsi/target.c
|
||||
@@ -369,9 +369,11 @@ void target_list_build(struct iscsi_conn
|
||||
struct iscsi_target *target_find_by_name(const char *name)
|
||||
{
|
||||
struct iscsi_target *target;
|
||||
+ char *tname;
|
||||
|
||||
list_for_each_entry(target, &iscsi_targets_list, tlist) {
|
||||
- if (!strcmp(tgt_targetname(target->tid), name))
|
||||
+ tname = tgt_targetname(target->tid);
|
||||
+ if (tname && !strcmp(tname, name))
|
||||
return target;
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
diff -aurp tgt-1.0.60.orig/usr/bs_sg.c tgt-1.0.60/usr/bs_sg.c
|
||||
--- tgt-1.0.60.orig/usr/bs_sg.c 2015-07-01 17:10:39.000000000 -0700
|
||||
+++ tgt-1.0.60/usr/bs_sg.c 2018-08-11 18:03:25.489712435 -0700
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <sys/stat.h>
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <sys/epoll.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <scsi/sg.h>
|
||||
+#include <sys/sysmacros.h>
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
From: Lee Duncan <lduncan@suse.com>
|
||||
Date: Mon Nov 16 08:49:57 PST 2015
|
||||
Subject: backing-store modules directory not present is not an error
|
||||
|
||||
The backing-store modules directory, normally
|
||||
/usr/lib/tgt/backing-store, is not created, needed, or used when there
|
||||
are no backing store modules. So change the error message printed when
|
||||
the directory is not present to a debug message.
|
||||
|
||||
Signed-off-by: Lee Duncan <lduncan@suse.com>
|
||||
---
|
||||
usr/bs.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/usr/bs.c
|
||||
+++ b/usr/bs.c
|
||||
@@ -263,7 +263,8 @@ static int bs_init_signalfd(void)
|
||||
|
||||
dir = opendir(BSDIR);
|
||||
if (dir == NULL) {
|
||||
- eprintf("could not open backing-store module directory %s\n",
|
||||
+ /* not considered an error if there are no modules */
|
||||
+ dprintf("could not open backing-store module directory %s\n",
|
||||
BSDIR);
|
||||
} else {
|
||||
struct dirent *dirent;
|
36
tgt.changes
36
tgt.changes
@ -1,3 +1,39 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 15 23:19:22 UTC 2019 - lduncan@suse.com
|
||||
|
||||
- Update to version v1.0.74 from version v1.0.60:
|
||||
* tgt 1.0.74
|
||||
* AIO backing store now reports a list of supported opcodes
|
||||
* tgt 1.0.73
|
||||
* Update tgt-admin
|
||||
* fix build w/newer glibc
|
||||
* Display nop_count and and nop_interval
|
||||
* Quote $backing_store variable in system(), execute() and
|
||||
backtick-calls
|
||||
* Buffer size is stored in struct concat_buf.size field, so
|
||||
use that instead of BUFSIZE since buffer size can be more
|
||||
than BUFSIZE. Also, remove BUFSIZE since its not used anymore.
|
||||
* tgt 1.0.72
|
||||
* smc: fix snprintf warnings with gcc7
|
||||
|
||||
This removed the tarball v1.0.60.tar.gz, and replaced it
|
||||
with v1.0.74.tar.gz, which can now be gotten using the new
|
||||
_service file. This also updated the SPEC file with the new
|
||||
version number and the different patch set. Remaining
|
||||
patches were renumbered.
|
||||
|
||||
This following patches were UPDATED (refreshed):
|
||||
* tgt-fix-build
|
||||
* tgt-include-sys-macros-for-major.patch
|
||||
|
||||
The following patches were REMOVED (no longer needed):
|
||||
* tgt-handle-access-of-a-target-that-has-been-removed
|
||||
* tgt-missing-module-directory-not-an-error
|
||||
* tgt-compare-pointer-to-null.patch
|
||||
|
||||
And the following patch was added (and submitted upstream):
|
||||
* tgt-Fix-gcc7-string-truncation-warnings.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Aug 12 01:11:13 UTC 2018 - lduncan@suse.com
|
||||
|
||||
|
21
tgt.spec
21
tgt.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package tgt
|
||||
#
|
||||
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -22,22 +22,20 @@
|
||||
%endif
|
||||
|
||||
Name: tgt
|
||||
Version: 1.0.60
|
||||
Version: 1.0.74
|
||||
Release: 0
|
||||
Summary: Generic Linux target framework (tgt)
|
||||
License: GPL-2.0-only
|
||||
Group: System/Daemons
|
||||
Url: http://stgt.sourceforge.net/
|
||||
Source: https://github.com/fujita/tgt/archive/v%{version}.tar.gz
|
||||
Source: https://github.com/fujita/%{name}/archive/v%{version}.tar.gz
|
||||
Source1: %{name}d.service
|
||||
Source3: %{name}.services
|
||||
Source4: sysconfig.%{name}
|
||||
Patch2: %{name}-fix-build
|
||||
Patch3: setup-tgt-conf-d.patch
|
||||
Patch4: %{name}-handle-access-of-a-target-that-has-been-removed
|
||||
Patch5: %{name}-missing-module-directory-not-an-error
|
||||
Patch6: %{name}-include-sys-macros-for-major.patch
|
||||
Patch7: %{name}-compare-pointer-to-null.patch
|
||||
Patch1: %{name}-fix-build
|
||||
Patch2: setup-tgt-conf-d.patch
|
||||
Patch3: %{name}-include-sys-macros-for-major.patch
|
||||
Patch4: %{name}-Fix-gcc7-string-truncation-warnings.patch
|
||||
BuildRequires: docbook-xsl-stylesheets
|
||||
BuildRequires: libaio-devel
|
||||
BuildRequires: libxslt
|
||||
@ -58,12 +56,10 @@ user-space daemon and tools (i.e. they completely runs in user space).
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
|
||||
%build
|
||||
%ifarch ppc ppc64 ppc64le
|
||||
@ -107,6 +103,7 @@ ln -sf service %{buildroot}/%{_sbindir}/rc%{name}d
|
||||
%doc doc/README.rbd doc/tmf.txt
|
||||
%doc %_defaultdocdir/%name/examples
|
||||
%doc %_defaultdocdir/%name/html
|
||||
%{_mandir}/man5/*
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%changelog
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c126c3dc8fe51d188b979f859e6fc5bc37d76b16f7a753f2966f90382ce15641
|
||||
size 295175
|
3
v1.0.74.tar.gz
Normal file
3
v1.0.74.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bfc202790d5326d7a18bd3928b4bb204ffb0acf443a5ec5c16a1a0fbc53be99f
|
||||
size 296992
|
Loading…
Reference in New Issue
Block a user