Additional upstream fixes for 32bit types

Replace custom patch with upstream one.
Add patch to fix issues with s390x
This commit is contained in:
Simo Sorce 2021-07-12 09:00:24 -04:00
parent 3461a3d164
commit 75152a308a
4 changed files with 132 additions and 14 deletions

View File

@ -0,0 +1,83 @@
From 299e5e8c38de9be99b86885c1af60dd5e1cc9888 Mon Sep 17 00:00:00 2001
From: Ondrej Mosnacek <omosnace@redhat.com>
Date: Mon, 17 May 2021 22:19:32 +0200
Subject: [PATCH] docproc: fix -Wconversion warnings on 32-bit
On i686, GCC 11.1.1 complains:
```
lib/doc/bin/docproc.c: In function 'find_all_symbols':
lib/doc/bin/docproc.c:433:17: error: conversion to 'ssize_t' {aka 'int'} from 'unsigned int' may change the sign of the result [-Werror=sign-conversion]
433 | start = all_list_len;
| ^~~~~~~~~~~~
lib/doc/bin/docproc.c:441:48: error: comparison of integer expressions of different signedness: 'ssize_t' {aka 'int'} and 'unsigned int' [-Werror=sign-compare]
441 | for (i = 0; i < (int)data_len && start != all_list_len; i++) {
| ^~
cc1: all warnings being treated as errors
```
Fix this by declaring all of all_list_len, i, count, and start as
size_t and remove a few casts that are no longer necessary.
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
lib/doc/bin/docproc.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/doc/bin/docproc.c b/lib/doc/bin/docproc.c
index 556d5d4..74b3cdb 100644
--- a/lib/doc/bin/docproc.c
+++ b/lib/doc/bin/docproc.c
@@ -77,11 +77,11 @@ FILELINE * docsection;
static char *srctree, *kernsrctree;
static char **all_list = NULL;
-static unsigned int all_list_len = 0;
+static size_t all_list_len = 0;
static void consume_symbol(const char *sym)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < all_list_len; i++) {
if (!all_list[i])
@@ -361,11 +361,11 @@ static void find_all_symbols(char *filename)
{
char *vec[4]; /* kerneldoc -list file NULL */
pid_t pid;
- ssize_t ret, i, count, start;
+ ssize_t ret;
char real_filename[PATH_MAX + 1];
int pipefd[2];
char *data, *str;
- size_t data_len = 0;
+ size_t i, count, start, data_len = 0;
vec[0] = KERNELDOC;
vec[1] = LIST;
@@ -424,21 +424,21 @@ static void find_all_symbols(char *filename)
count = 0;
/* poor man's strtok, but with counting */
- for (i = 0; i < (int)data_len; i++) {
+ for (i = 0; i < data_len; i++) {
if (data[i] == '\n') {
count++;
data[i] = '\0';
}
}
start = all_list_len;
- all_list_len += (unsigned int)count;
+ all_list_len += count;
all_list = realloc(all_list, sizeof(char *) * all_list_len);
if (!all_list) {
perror("realloc");
exit(1);
}
str = data;
- for (i = 0; i < (int)data_len && start != all_list_len; i++) {
+ for (i = 0; i < data_len && start != all_list_len; i++) {
if (data[i] == '\0') {
all_list[start] = str;
str = data + i + 1;

View File

@ -1,13 +0,0 @@
diff -uPr libkcapi-1.3.0/lib/doc/bin/docproc.c libkcapi-1.3.0.werror/lib/doc/bin/docproc.c
--- libkcapi-1.3.0/lib/doc/bin/docproc.c 2021-04-18 11:55:57.000000000 -0400
+++ libkcapi-1.3.0.werror/lib/doc/bin/docproc.c 2021-07-12 08:13:21.812438118 -0400
@@ -361,7 +361,8 @@
{
char *vec[4]; /* kerneldoc -list file NULL */
pid_t pid;
- ssize_t ret, i, count, start;
+ ssize_t ret, i, count;
+ unsigned int start;
char real_filename[PATH_MAX + 1];
int pipefd[2];
char *data, *str;

View File

@ -0,0 +1,47 @@
From 00603fbe01de879eb1bd49a4475b0e619f4bb3b0 Mon Sep 17 00:00:00 2001
From: Ondrej Mosnacek <omosnace@redhat.com>
Date: Tue, 18 May 2021 15:03:17 +0200
Subject: [PATCH] Fix bad types in _kcapi_common_send_meta()
The types for 'type' and 'assoclen' variables need to match the kernel
ABI, so they can't be changed to size_t. On most arches it is by chance
still working, but on s390x usign size_t here makes almost all tests
fail. Change the variables back to uint32_t pointers to fix this.
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
lib/kcapi-kernel-if.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/kcapi-kernel-if.c b/lib/kcapi-kernel-if.c
index a92e2f7..4968a8a 100644
--- a/lib/kcapi-kernel-if.c
+++ b/lib/kcapi-kernel-if.c
@@ -125,7 +125,7 @@ ssize_t _kcapi_common_send_meta(struct kcapi_handle *handle,
/* plaintext / ciphertext data */
struct cmsghdr *header = NULL;
- size_t *type = NULL;
+ uint32_t *type = NULL;
struct msghdr msg;
/* IV data */
@@ -135,7 +135,7 @@ ssize_t _kcapi_common_send_meta(struct kcapi_handle *handle,
0;
/* AEAD data */
- size_t *assoclen = NULL;
+ uint32_t *assoclen = NULL;
size_t assoc_msg_size = handle->aead.assoclen ?
CMSG_SPACE(sizeof(*assoclen)) : 0;
@@ -205,7 +205,7 @@ ssize_t _kcapi_common_send_meta(struct kcapi_handle *handle,
header->cmsg_type = ALG_SET_AEAD_ASSOCLEN;
header->cmsg_len = CMSG_LEN(sizeof(*assoclen));
assoclen = (void*)CMSG_DATA(header);
- *assoclen = handle->aead.assoclen;
+ *assoclen = (uint32_t)handle->aead.assoclen;
}
ret = sendmsg(*_kcapi_get_opfd(handle), &msg, (int)flags);

View File

@ -135,7 +135,8 @@ Source1: https://www.chronox.de/%{name}/%{name}-%{version}.tar.xz.asc
Source2: sha512hmac-openssl.sh
Source3: fipshmac-openssl.sh
Patch1: 001-libkcapi-1.3.0-werror.patch
Patch1: 001-libkcapi-1.3.0-32bit-werror.patch
Patch2: 002-libkcapi-1.3.0-s390-types.patch
BuildRequires: bash
BuildRequires: coreutils