From b0a7f6a358725f18a39c6456431f90f401f4863a Mon Sep 17 00:00:00 2001 From: Steve Dickson Date: Fri, 1 Mar 2024 07:31:26 -0500 Subject: [PATCH] =?UTF-8?q?-=20Initial=20package=20-=20Upstream=20contribu?= =?UTF-8?q?tions=20by:=20=20=20=20=20-=20Chuck=20Lever=20=20=20=20=20=20-=20Hannes=20Reinecke=20=20?= =?UTF-8?q?=20=20=20=20-=20Jeff=20Layton=20=20=20=20?= =?UTF-8?q?=20=20-=20Benjamin=20Coddington=20=20=20?= =?UTF-8?q?=20=20=20-=20David=20H=C3=A4rdeman=20=20=20?= =?UTF-8?q?=20=20=20-=20Tigran=20Mkrtchyan=20=20?= =?UTF-8?q?=20=20=20=20-=20Moritz=20"WanzenBug"=20Wanzenb=C3=B6ck=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Steve Dickson Resolves: RHEL-16641 --- .gitignore | 4 + ...-fix-max-config-file-size-comparison.patch | 42 ++++++++++ README.md | 3 + gating.yaml | 6 ++ ktls-utils.spec | 78 +++++++++++++++++++ sources | 1 + 6 files changed, 134 insertions(+) create mode 100644 0001-tlshd-fix-max-config-file-size-comparison.patch create mode 100644 README.md create mode 100644 gating.yaml create mode 100644 ktls-utils.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..88bde4d 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,4 @@ +/ktls-utils-0.10.tar.gz +ktls-utils-0.10/ +x86_64 +Makefile diff --git a/0001-tlshd-fix-max-config-file-size-comparison.patch b/0001-tlshd-fix-max-config-file-size-comparison.patch new file mode 100644 index 0000000..c6a4a1c --- /dev/null +++ b/0001-tlshd-fix-max-config-file-size-comparison.patch @@ -0,0 +1,42 @@ +From 52ac9ff05a5edb5ccda33ee186ba388553b258c4 Mon Sep 17 00:00:00 2001 +From: Jeff Layton +Date: Tue, 20 Jun 2023 13:20:14 -0400 +Subject: [PATCH] tlshd: fix max config file size comparison + +gcc throws a warning on 32-bit x86 because of signedness mismatch: + +config.c:155:52: error: comparison of integer expressions of different signedness: '__off_t' {aka 'long int'} and 'unsigned int' [-Werror=sign-compare] + 155 | if (statbuf.st_size < 0 || statbuf.st_size > UINT_MAX) { + | ^ + +st_size is a signed value (off_t), but UINT_MAX is unsigned. + +Change it to compare against INT_MAX instead. This technically cuts the +max size of the config file in half to only 2GB, but I don't think we'll +miss it. + +Cc: Steve Dickson +Reported-by: Petr Pisar +Link: https://bugzilla.redhat.com/show_bug.cgi?id=2182151 +Signed-off-by: Jeff Layton +Signed-off-by: Chuck Lever +--- + src/tlshd/config.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/tlshd/config.c b/src/tlshd/config.c +index 87cc4018733b..bdab98b9fba4 100644 +--- a/src/tlshd/config.c ++++ b/src/tlshd/config.c +@@ -152,7 +152,7 @@ static bool tlshd_config_read_datum(const char *pathname, gnutls_datum_t *data, + tlshd_log_perror("stat"); + goto out_close; + } +- if (statbuf.st_size < 0 || statbuf.st_size > UINT_MAX) { ++ if (statbuf.st_size < 0 || statbuf.st_size > INT_MAX) { + tlshd_log_error("Bad config file size: %lld", statbuf.st_size); + goto out_close; + } +-- +2.41.0 + diff --git a/README.md b/README.md new file mode 100644 index 0000000..6e805a2 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# ktls-utils + +The ktls-utils package diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..648918d --- /dev/null +++ b/gating.yaml @@ -0,0 +1,6 @@ +--- !Policy +product_versions: + - rhel-9 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/ktls-utils.spec b/ktls-utils.spec new file mode 100644 index 0000000..530404c --- /dev/null +++ b/ktls-utils.spec @@ -0,0 +1,78 @@ +%global forgeurl https://github.com/oracle/ktls-utils +%global baseversion 0.10 + +Name: ktls-utils +Version: %{baseversion} +Release: 0%{?dist} +Summary: TLS handshake agent for kernel sockets + +%forgemeta + +License: GPL-2.0-only AND (GPL-2.0-only OR BSD-3-Clause) +URL: %{forgeurl} + +# FIXME: is this a bug in the tagging scheme or forgesource macro? +Source0: %{forgeurl}/releases/download/%{name}-%{baseversion}/%{name}-%{baseversion}.tar.gz + +BuildRequires: bash systemd-rpm-macros +BuildRequires: gcc make coreutils +BuildRequires: pkgconfig(gnutls) >= 3.3.0 +BuildRequires: autoconf >= 2.69 +BuildRequires: automake +BuildRequires: pkgconfig(libkeyutils) +BuildRequires: pkgconfig(glib-2.0) >= 2.6 +BuildRequires: pkgconfig(libnl-3.0) >= 3.1 + +%description +In-kernel TLS consumers need a mechanism to perform TLS handshakes +on a connected socket to negotiate TLS session parameters that can +then be programmed into the kernel's TLS record protocol engine. + +This package of software provides a TLS handshake user agent that +listens for kernel requests and then materializes a user space +socket endpoint on which to perform these handshakes. The resulting +negotiated session parameters are passed back to the kernel via +standard kTLS socket options. + +%prep +%setup -q -n %{name}-%{baseversion} +%autopatch -p1 + +%build +./autogen.sh +%configure --with-systemd +%make_build + +%install +%make_install + +%files +%config(noreplace) %{_sysconfdir}/tlshd.conf +%{_sbindir}/tlshd +%{_mandir}/man5/tlshd.conf.5.gz +%{_mandir}/man8/tlshd.8.gz +%{_unitdir}/tlshd.service +%license COPYING +%doc README.md +%doc SECURITY.md + +%post +%systemd_post tlshd.service + +%preun +%systemd_preun tlshd.service + +%postun +%systemd_postun_with_restart tlshd.service + +%changelog +* Thu Feb 29 2024 Steve Dickson 0.10-0 +- Initial package +- Upstream contributions by: + - Chuck Lever + - Hannes Reinecke + - Jeff Layton + - Benjamin Coddington + - David Härdeman + - Tigran Mkrtchyan + - Moritz "WanzenBug" Wanzenböck diff --git a/sources b/sources new file mode 100644 index 0000000..ea57698 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (ktls-utils-0.10.tar.gz) = cb2ef7fe93b0a9d982c082ff308aad29a4900106911f7f8bce15a876efdaadd7f031b4563373c24927e11abc33e6bfcb56be8675b1c51a2e3763e2a5c6796367