diff -Nru klibc-2.0.7/debian/changelog klibc-2.0.7/debian/changelog --- klibc-2.0.7/debian/changelog 2019-11-07 01:08:13.000000000 +0000 +++ klibc-2.0.7/debian/changelog 2019-11-07 06:34:08.000000000 +0000 @@ -1,3 +1,10 @@ +klibc (2.0.7-1ubuntu5) focal; urgency=medium + + * Apply one patch from upstream and one local to resolve type mistmatch + compiler warnings from the switch to the kernel's UAPI loop.h header. + + -- Adam Conrad Wed, 06 Nov 2019 23:34:08 -0700 + klibc (2.0.7-1ubuntu4) focal; urgency=medium * Fix losetup, by switching to kernel uapi header, instead of buggy diff -Nru klibc-2.0.7/debian/patches/0001-klibc-loop-switch-to-linux-loop.h.patch klibc-2.0.7/debian/patches/0001-klibc-loop-switch-to-linux-loop.h.patch --- klibc-2.0.7/debian/patches/0001-klibc-loop-switch-to-linux-loop.h.patch 2019-11-07 01:08:06.000000000 +0000 +++ klibc-2.0.7/debian/patches/0001-klibc-loop-switch-to-linux-loop.h.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,95 +0,0 @@ -From 547b7cf241d4bcf518759d06cff694b9738c57b0 Mon Sep 17 00:00:00 2001 -From: Dimitri John Ledkov -Date: Thu, 31 Oct 2019 15:59:02 -0700 -Subject: [PATCH] [klibc] loop: switch to linux/loop.h - -linux/loop.h header is exported by linux, for userspace to -consume. This would prevent issues with struct sizes -incompatibilities. - -References: https://bugs.launchpad.net/ubuntu/+source/klibc/+bug/1850184 -Signed-off-by: Michael Hudson-Doyle -Signed-off-by: Adam Conrad -Signed-off-by: Dimitri John Ledkov -[bwh: We were using dev_t instead of __kernel_old_dev_t, which doesn't - match on some architectures. Instead of fixing our definition first, - switch directly to the kernel's UAPI header.] -Signed-off-by: Ben Hutchings ---- - usr/utils/loop.h | 49 --------------------------------------------- - usr/utils/losetup.c | 3 +-- - 2 files changed, 1 insertion(+), 51 deletions(-) - delete mode 100644 usr/utils/loop.h - -diff --git a/usr/utils/loop.h b/usr/utils/loop.h -deleted file mode 100644 -index 9abc2874..00000000 ---- a/usr/utils/loop.h -+++ /dev/null -@@ -1,49 +0,0 @@ --#define LO_CRYPT_NONE 0 --#define LO_CRYPT_XOR 1 --#define LO_CRYPT_DES 2 --#define LO_CRYPT_CRYPTOAPI 18 -- --#define LOOP_SET_FD 0x4C00 --#define LOOP_CLR_FD 0x4C01 --#define LOOP_SET_STATUS 0x4C02 --#define LOOP_GET_STATUS 0x4C03 --#define LOOP_SET_STATUS64 0x4C04 --#define LOOP_GET_STATUS64 0x4C05 -- --#define LO_NAME_SIZE 64 --#define LO_KEY_SIZE 32 -- --struct loop_info { -- int lo_number; -- dev_t lo_device; -- unsigned long lo_inode; -- dev_t lo_rdevice; -- int lo_offset; -- int lo_encrypt_type; -- int lo_encrypt_key_size; -- int lo_flags; -- char lo_name[LO_NAME_SIZE]; -- unsigned char lo_encrypt_key[LO_KEY_SIZE]; -- unsigned long lo_init[2]; -- char reserved[4]; --}; -- --/* -- * Where to get __u8, __u32, __u64? Let us use unsigned char/int/long long -- * and get punished when someone comes with 128-bit long longs. -- */ --struct loop_info64 { -- unsigned long long lo_device; -- unsigned long long lo_inode; -- unsigned long long lo_rdevice; -- unsigned long long lo_offset; -- unsigned long long lo_sizelimit; /* bytes, 0 == max available */ -- unsigned int lo_number; -- unsigned int lo_encrypt_type; -- unsigned int lo_encrypt_key_size; -- unsigned int lo_flags; -- char lo_file_name[LO_NAME_SIZE]; -- char lo_crypt_name[LO_NAME_SIZE]; -- char lo_encrypt_key[LO_KEY_SIZE]; -- unsigned long long lo_init[2]; --}; -diff --git a/usr/utils/losetup.c b/usr/utils/losetup.c -index 17887412..ebc6f360 100644 ---- a/usr/utils/losetup.c -+++ b/usr/utils/losetup.c -@@ -18,8 +18,7 @@ - #include - #include - #include -- --#include "loop.h" -+#include - - extern int verbose; - extern char *progname; --- -2.20.1 - diff -Nru klibc-2.0.7/debian/patches/loop-fixes-2.patch klibc-2.0.7/debian/patches/loop-fixes-2.patch --- klibc-2.0.7/debian/patches/loop-fixes-2.patch 1970-01-01 00:00:00.000000000 +0000 +++ klibc-2.0.7/debian/patches/loop-fixes-2.patch 2019-11-07 06:28:10.000000000 +0000 @@ -0,0 +1,17 @@ +Description: Fix code dropped upstream to conform to loop.h +Author: Adam Conrad +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1850184 +Forwarded: not-needed +Last-Update: 2019-11-07 + +--- klibc-2.0.6.orig/usr/utils/losetup.c ++++ klibc-2.0.6/usr/utils/losetup.c +@@ -107,7 +107,7 @@ static int show_loop(char *device) + } + + if (ioctl(fd, LOOP_GET_STATUS, &loopinfo) == 0) { +- printf ("%s: [%04x]:%ld (%s)", ++ printf ("%s: [%04lx]:%ld (%s)", + device, loopinfo.lo_device, loopinfo.lo_inode, + loopinfo.lo_name); + diff -Nru klibc-2.0.7/debian/patches/loop-fixes.patch klibc-2.0.7/debian/patches/loop-fixes.patch --- klibc-2.0.7/debian/patches/loop-fixes.patch 1970-01-01 00:00:00.000000000 +0000 +++ klibc-2.0.7/debian/patches/loop-fixes.patch 2019-11-07 06:15:25.000000000 +0000 @@ -0,0 +1,51 @@ +commit 8443e57e5ba71e462e31e3b5aad9f7dd1b4736f5 +Author: Ben Hutchings +Date: Tue Nov 5 00:39:53 2019 +0000 + + [klibc] losetup: Fix char signedness mismatches with + + For some reason the kernel's definition of struct loop_info64 defines + string fields as arrays of __u8 (unsigned char) instead of char. Add + the necessary casts to avoid compiler warnings. + + Signed-off-by: Ben Hutchings + +diff --git a/usr/utils/losetup.c b/usr/utils/losetup.c +index ebc6f360..1f50a001 100644 +--- a/usr/utils/losetup.c ++++ b/usr/utils/losetup.c +@@ -94,7 +94,7 @@ static int show_loop(char *device) + + if (loopinfo64.lo_encrypt_type || + loopinfo64.lo_crypt_name[0]) { +- char *e = loopinfo64.lo_crypt_name; ++ const char *e = (const char *)loopinfo64.lo_crypt_name; + + if (*e == 0 && loopinfo64.lo_encrypt_type == 1) + e = "XOR"; +@@ -258,14 +258,14 @@ int set_loop(const char *device, const char *file, unsigned long long offset, + + memset(&loopinfo64, 0, sizeof(loopinfo64)); + +- xstrncpy(loopinfo64.lo_file_name, file, LO_NAME_SIZE); ++ xstrncpy((char *)loopinfo64.lo_file_name, file, LO_NAME_SIZE); + + if (encryption && *encryption) { + if (digits_only(encryption)) { + loopinfo64.lo_encrypt_type = atoi(encryption); + } else { + loopinfo64.lo_encrypt_type = LO_CRYPT_CRYPTOAPI; +- snprintf(loopinfo64.lo_crypt_name, LO_NAME_SIZE, ++ snprintf((char *)loopinfo64.lo_crypt_name, LO_NAME_SIZE, + "%s", encryption); + } + } +@@ -284,7 +284,7 @@ int set_loop(const char *device, const char *file, unsigned long long offset, + pass = xgetpass(pfd, "Password: "); + gotpass: + memset(loopinfo64.lo_encrypt_key, 0, LO_KEY_SIZE); +- xstrncpy(loopinfo64.lo_encrypt_key, pass, LO_KEY_SIZE); ++ xstrncpy((char *)loopinfo64.lo_encrypt_key, pass, LO_KEY_SIZE); + memset(pass, 0, strlen(pass)); + loopinfo64.lo_encrypt_key_size = LO_KEY_SIZE; + } diff -Nru klibc-2.0.7/debian/patches/loop-header.patch klibc-2.0.7/debian/patches/loop-header.patch --- klibc-2.0.7/debian/patches/loop-header.patch 1970-01-01 00:00:00.000000000 +0000 +++ klibc-2.0.7/debian/patches/loop-header.patch 2019-11-07 06:15:25.000000000 +0000 @@ -0,0 +1,88 @@ +commit 547b7cf241d4bcf518759d06cff694b9738c57b0 +Author: Dimitri John Ledkov +Date: Thu Oct 31 15:59:02 2019 -0700 + + [klibc] loop: switch to linux/loop.h + + linux/loop.h header is exported by linux, for userspace to + consume. This would prevent issues with struct sizes + incompatibilities. + + References: https://bugs.launchpad.net/ubuntu/+source/klibc/+bug/1850184 + Signed-off-by: Michael Hudson-Doyle + Signed-off-by: Adam Conrad + Signed-off-by: Dimitri John Ledkov + [bwh: We were using dev_t instead of __kernel_old_dev_t, which doesn't + match on some architectures. Instead of fixing our definition first, + switch directly to the kernel's UAPI header.] + Signed-off-by: Ben Hutchings + +diff --git a/usr/utils/loop.h b/usr/utils/loop.h +deleted file mode 100644 +index 9abc2874..00000000 +--- a/usr/utils/loop.h ++++ /dev/null +@@ -1,49 +0,0 @@ +-#define LO_CRYPT_NONE 0 +-#define LO_CRYPT_XOR 1 +-#define LO_CRYPT_DES 2 +-#define LO_CRYPT_CRYPTOAPI 18 +- +-#define LOOP_SET_FD 0x4C00 +-#define LOOP_CLR_FD 0x4C01 +-#define LOOP_SET_STATUS 0x4C02 +-#define LOOP_GET_STATUS 0x4C03 +-#define LOOP_SET_STATUS64 0x4C04 +-#define LOOP_GET_STATUS64 0x4C05 +- +-#define LO_NAME_SIZE 64 +-#define LO_KEY_SIZE 32 +- +-struct loop_info { +- int lo_number; +- dev_t lo_device; +- unsigned long lo_inode; +- dev_t lo_rdevice; +- int lo_offset; +- int lo_encrypt_type; +- int lo_encrypt_key_size; +- int lo_flags; +- char lo_name[LO_NAME_SIZE]; +- unsigned char lo_encrypt_key[LO_KEY_SIZE]; +- unsigned long lo_init[2]; +- char reserved[4]; +-}; +- +-/* +- * Where to get __u8, __u32, __u64? Let us use unsigned char/int/long long +- * and get punished when someone comes with 128-bit long longs. +- */ +-struct loop_info64 { +- unsigned long long lo_device; +- unsigned long long lo_inode; +- unsigned long long lo_rdevice; +- unsigned long long lo_offset; +- unsigned long long lo_sizelimit; /* bytes, 0 == max available */ +- unsigned int lo_number; +- unsigned int lo_encrypt_type; +- unsigned int lo_encrypt_key_size; +- unsigned int lo_flags; +- char lo_file_name[LO_NAME_SIZE]; +- char lo_crypt_name[LO_NAME_SIZE]; +- char lo_encrypt_key[LO_KEY_SIZE]; +- unsigned long long lo_init[2]; +-}; +diff --git a/usr/utils/losetup.c b/usr/utils/losetup.c +index 17887412..ebc6f360 100644 +--- a/usr/utils/losetup.c ++++ b/usr/utils/losetup.c +@@ -18,8 +18,7 @@ + #include + #include + #include +- +-#include "loop.h" ++#include + + extern int verbose; + extern char *progname; diff -Nru klibc-2.0.7/debian/patches/series klibc-2.0.7/debian/patches/series --- klibc-2.0.7/debian/patches/series 2019-11-07 01:08:06.000000000 +0000 +++ klibc-2.0.7/debian/patches/series 2019-11-07 06:34:08.000000000 +0000 @@ -1,3 +1,5 @@ klibc-fstype-drop-obsolete-support-for-ext4dev.patch cf-protection.patch -0001-klibc-loop-switch-to-linux-loop.h.patch +loop-header.patch +loop-fixes.patch +loop-fixes-2.patch