|
| 1 | +From 4662d36343479db4f6a5de0b4bc0e1d72e6fc733 Mon Sep 17 00:00:00 2001 |
| 2 | +From: hev <r@hev.cc> |
| 3 | +Date: Sun, 17 Mar 2024 19:35:45 +0800 |
| 4 | +Subject: [PATCH] linux: Fix libc-compat |
| 5 | + |
| 6 | +--- |
| 7 | + ...t-add-fallback-for-unsupported-libcs.patch | 136 ++++++++++++++++++ |
| 8 | + 1 file changed, 136 insertions(+) |
| 9 | + create mode 100644 packages/linux/4.4.302/0001-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch |
| 10 | + |
| 11 | +diff --git a/packages/linux/4.4.302/0001-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch b/packages/linux/4.4.302/0001-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch |
| 12 | +new file mode 100644 |
| 13 | +index 00000000..ba7381ab |
| 14 | +--- /dev/null |
| 15 | ++++ b/packages/linux/4.4.302/0001-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch |
| 16 | +@@ -0,0 +1,136 @@ |
| 17 | ++From e3b2249821c579b72ddc0a6596cf597b9460ee04 Mon Sep 17 00:00:00 2001 |
| 18 | ++From: Felix Janda <felix.janda@posteo.de> |
| 19 | ++Date: Mon, 1 Jan 2018 19:33:20 +0100 |
| 20 | ++Subject: [PATCH] uapi libc compat: add fallback for unsupported libcs |
| 21 | ++ |
| 22 | ++libc-compat.h aims to prevent symbol collisions between uapi and libc |
| 23 | ++headers for each supported libc. This requires continuous coordination |
| 24 | ++between them. |
| 25 | ++ |
| 26 | ++The goal of this commit is to improve the situation for libcs (such as |
| 27 | ++musl) which are not yet supported and/or do not wish to be explicitly |
| 28 | ++supported, while not affecting supported libcs. More precisely, with |
| 29 | ++this commit, unsupported libcs can request the suppression of any |
| 30 | ++specific uapi definition by defining the correspondings _UAPI_DEF_* |
| 31 | ++macro as 0. This can fix symbol collisions for them, as long as the |
| 32 | ++libc headers are included before the uapi headers. Inclusion in the |
| 33 | ++other order is outside the scope of this commit. |
| 34 | ++ |
| 35 | ++All infrastructure in order to enable this fallback for unsupported |
| 36 | ++libcs is already in place, except that libc-compat.h unconditionally |
| 37 | ++defines all _UAPI_DEF_* macros to 1 for all unsupported libcs so that |
| 38 | ++any previous definitions are ignored. In order to fix this, this commit |
| 39 | ++merely makes these definitions conditional. |
| 40 | ++ |
| 41 | ++This commit together with the musl libc commit |
| 42 | ++ |
| 43 | ++http://git.musl-libc.org/cgit/musl/commit/?id=04983f2272382af92eb8f8838964ff944fbb8258 |
| 44 | ++ |
| 45 | ++fixes for example the following compiler errors when <linux/in6.h> is |
| 46 | ++included after musl's <netinet/in.h>: |
| 47 | ++ |
| 48 | ++./linux/in6.h:32:8: error: redefinition of 'struct in6_addr' |
| 49 | ++./linux/in6.h:49:8: error: redefinition of 'struct sockaddr_in6' |
| 50 | ++./linux/in6.h:59:8: error: redefinition of 'struct ipv6_mreq' |
| 51 | ++ |
| 52 | ++The comments referencing glibc are still correct, but this file is not |
| 53 | ++only used for glibc any more. |
| 54 | ++ |
| 55 | ++Signed-off-by: Felix Janda <felix.janda@posteo.de> |
| 56 | ++Reviewed-by: Hauke Mehrtens <hauke@hauke-m.de> |
| 57 | ++Signed-off-by: David S. Miller <davem@davemloft.net> |
| 58 | ++--- |
| 59 | ++ include/uapi/linux/libc-compat.h | 45 +++++++++++++++++++++++++++++++- |
| 60 | ++ 1 file changed, 44 insertions(+), 1 deletion(-) |
| 61 | ++ |
| 62 | ++diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h |
| 63 | ++index e4f048ee..93956d13 100644 |
| 64 | ++--- a/include/uapi/linux/libc-compat.h |
| 65 | +++++ b/include/uapi/linux/libc-compat.h |
| 66 | ++@@ -148,39 +148,82 @@ |
| 67 | ++ |
| 68 | ++ /* If we did not see any headers from any supported C libraries, |
| 69 | ++ * or we are being included in the kernel, then define everything |
| 70 | ++- * that we need. */ |
| 71 | +++ * that we need. Check for previous __UAPI_* definitions to give |
| 72 | +++ * unsupported C libraries a way to opt out of any kernel definition. */ |
| 73 | ++ #else /* !defined(__GLIBC__) */ |
| 74 | ++ |
| 75 | ++ /* Definitions for if.h */ |
| 76 | +++#ifndef __UAPI_DEF_IF_IFCONF |
| 77 | ++ #define __UAPI_DEF_IF_IFCONF 1 |
| 78 | +++#endif |
| 79 | +++#ifndef __UAPI_DEF_IF_IFMAP |
| 80 | ++ #define __UAPI_DEF_IF_IFMAP 1 |
| 81 | +++#endif |
| 82 | +++#ifndef __UAPI_DEF_IF_IFNAMSIZ |
| 83 | ++ #define __UAPI_DEF_IF_IFNAMSIZ 1 |
| 84 | +++#endif |
| 85 | +++#ifndef __UAPI_DEF_IF_IFREQ |
| 86 | ++ #define __UAPI_DEF_IF_IFREQ 1 |
| 87 | +++#endif |
| 88 | ++ /* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */ |
| 89 | +++#ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS |
| 90 | ++ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1 |
| 91 | +++#endif |
| 92 | ++ /* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */ |
| 93 | +++#ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO |
| 94 | ++ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 |
| 95 | +++#endif |
| 96 | ++ |
| 97 | ++ /* Definitions for in.h */ |
| 98 | +++#ifndef __UAPI_DEF_IN_ADDR |
| 99 | ++ #define __UAPI_DEF_IN_ADDR 1 |
| 100 | +++#endif |
| 101 | +++#ifndef __UAPI_DEF_IN_IPPROTO |
| 102 | ++ #define __UAPI_DEF_IN_IPPROTO 1 |
| 103 | +++#endif |
| 104 | +++#ifndef __UAPI_DEF_IN_PKTINFO |
| 105 | ++ #define __UAPI_DEF_IN_PKTINFO 1 |
| 106 | +++#endif |
| 107 | +++#ifndef __UAPI_DEF_IP_MREQ |
| 108 | ++ #define __UAPI_DEF_IP_MREQ 1 |
| 109 | +++#endif |
| 110 | +++#ifndef __UAPI_DEF_SOCKADDR_IN |
| 111 | ++ #define __UAPI_DEF_SOCKADDR_IN 1 |
| 112 | +++#endif |
| 113 | +++#ifndef __UAPI_DEF_IN_CLASS |
| 114 | ++ #define __UAPI_DEF_IN_CLASS 1 |
| 115 | +++#endif |
| 116 | ++ |
| 117 | ++ /* Definitions for in6.h */ |
| 118 | +++#ifndef __UAPI_DEF_IN6_ADDR |
| 119 | ++ #define __UAPI_DEF_IN6_ADDR 1 |
| 120 | +++#endif |
| 121 | +++#ifndef __UAPI_DEF_IN6_ADDR_ALT |
| 122 | ++ #define __UAPI_DEF_IN6_ADDR_ALT 1 |
| 123 | +++#endif |
| 124 | +++#ifndef __UAPI_DEF_SOCKADDR_IN6 |
| 125 | ++ #define __UAPI_DEF_SOCKADDR_IN6 1 |
| 126 | +++#endif |
| 127 | +++#ifndef __UAPI_DEF_IPV6_MREQ |
| 128 | ++ #define __UAPI_DEF_IPV6_MREQ 1 |
| 129 | +++#endif |
| 130 | +++#ifndef __UAPI_DEF_IPPROTO_V6 |
| 131 | ++ #define __UAPI_DEF_IPPROTO_V6 1 |
| 132 | +++#endif |
| 133 | +++#ifndef __UAPI_DEF_IPV6_OPTIONS |
| 134 | ++ #define __UAPI_DEF_IPV6_OPTIONS 1 |
| 135 | +++#endif |
| 136 | +++#ifndef __UAPI_DEF_IN6_PKTINFO |
| 137 | ++ #define __UAPI_DEF_IN6_PKTINFO 1 |
| 138 | +++#endif |
| 139 | +++#ifndef __UAPI_DEF_IP6_MTUINFO |
| 140 | ++ #define __UAPI_DEF_IP6_MTUINFO 1 |
| 141 | +++#endif |
| 142 | ++ |
| 143 | ++ /* Definitions for xattr.h */ |
| 144 | +++#ifndef __UAPI_DEF_XATTR |
| 145 | ++ #define __UAPI_DEF_XATTR 1 |
| 146 | +++#endif |
| 147 | ++ |
| 148 | ++ #endif /* __GLIBC__ */ |
| 149 | ++ |
| 150 | ++-- |
| 151 | ++2.25.1 |
| 152 | ++ |
| 153 | +-- |
| 154 | +2.44.0 |
| 155 | + |
0 commit comments