logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git
commit: 5dfe015e82b2e6190a706ca58ca055581b071c03
parent 4a7996e2c966d051a6b8bd06138d3f719a01240c
Author: Michael Forney <mforney@mforney.org>
Date:   Fri, 31 Jan 2020 19:38:39 -0800

strace: Some more portability fixes

Diffstat:

Mpkg/strace/patch/0007-Don-t-omit-second-operand-to-operator.patch25+++++++++++++++++++++----
Apkg/strace/patch/0010-Use-alloca-when-VLAs-aren-t-available.patch55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkg/strace/patch/0011-Avoid-index-ranges.patch62++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkg/strace/patch/1001-Prevent-zero-sized-arrays.patch74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mpkg/strace/ver2+-
5 files changed, 213 insertions(+), 5 deletions(-)

diff --git a/pkg/strace/patch/0007-Don-t-omit-second-operand-to-operator.patch b/pkg/strace/patch/0007-Don-t-omit-second-operand-to-operator.patch @@ -1,14 +1,31 @@ -From 0c4077c28a50eff8a39b2e6d99df5575f67619b4 Mon Sep 17 00:00:00 2001 +From 15b2616e6f1f03c10db8ac48371c63f1200e2390 Mon Sep 17 00:00:00 2001 From: Michael Forney <mforney@mforney.org> Date: Sun, 7 Jul 2019 21:53:16 -0700 Subject: [PATCH] Don't omit second operand to '?' operator --- + open.c | 5 +++-- prctl.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + 2 files changed, 4 insertions(+), 3 deletions(-) +diff --git a/open.c b/open.c +index 8ac6de83..6b94453f 100644 +--- a/open.c ++++ b/open.c +@@ -72,8 +72,9 @@ sprint_open_modes(unsigned int flags) + } + *p = '\0'; + +- return sprintflags_ex(outstr, open_mode_flags, flags, sep, +- XLAT_STYLE_ABBREV) ?: outstr; ++ str = sprintflags_ex(outstr, open_mode_flags, flags, sep, ++ XLAT_STYLE_ABBREV); ++ return str ? str : outstr; + } + + void diff --git a/prctl.c b/prctl.c -index 814abc2a..9db14d55 100644 +index 2e918be8..67769ca9 100644 --- a/prctl.c +++ b/prctl.c @@ -76,7 +76,7 @@ sprint_sve_val(kernel_ulong_t arg) @@ -21,5 +38,5 @@ index 814abc2a..9db14d55 100644 return out; } -- -2.22.0 +2.25.0 diff --git a/pkg/strace/patch/0010-Use-alloca-when-VLAs-aren-t-available.patch b/pkg/strace/patch/0010-Use-alloca-when-VLAs-aren-t-available.patch @@ -0,0 +1,55 @@ +From 6d1a94be837a58a3151e6063537ad75a77541738 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Thu, 30 Jan 2020 21:57:34 -0800 +Subject: [PATCH] Use alloca when VLAs aren't available + +--- + evdev.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/evdev.c b/evdev.c +index 72addff6..bc6257ad 100644 +--- a/evdev.c ++++ b/evdev.c +@@ -237,9 +237,13 @@ decode_bitset(struct tcb *const tcp, const kernel_ulong_t arg, + return RVAL_IOCTL_DECODED; + } + ++#ifndef __STDC_NO_VLA__ + char decoded_arg[size]; ++#else ++ char *decoded_arg = alloca(size); ++#endif + +- if (umove_or_printaddr(tcp, arg, &decoded_arg)) ++ if (umoven_or_printaddr(tcp, arg, size, decoded_arg)) + return RVAL_IOCTL_DECODED; + + if (xlat_verbose(xlat_verbosity) != XLAT_STYLE_RAW) { +@@ -296,9 +300,13 @@ mtslots_ioctl(struct tcb *const tcp, const unsigned int code, + return RVAL_IOCTL_DECODED; + } + ++#ifndef __STDC_NO_VLA__ + int buffer[size]; ++#else ++ int *buffer = alloca(size * sizeof(int)); ++#endif + +- if (umove_or_printaddr(tcp, arg, &buffer)) ++ if (umoven_or_printaddr(tcp, arg, size * sizeof(int), &buffer)) + return RVAL_IOCTL_DECODED; + + tprints("{code="); +@@ -307,7 +315,7 @@ mtslots_ioctl(struct tcb *const tcp, const unsigned int code, + tprints(", values=["); + + unsigned int i; +- for (i = 1; i < ARRAY_SIZE(buffer); i++) ++ for (i = 1; i < size; i++) + tprintf("%s%d", i > 1 ? ", " : "", buffer[i]); + + tprints("]}"); +-- +2.25.0 + diff --git a/pkg/strace/patch/0011-Avoid-index-ranges.patch b/pkg/strace/patch/0011-Avoid-index-ranges.patch @@ -0,0 +1,62 @@ +From bdcfe1c3c72cd0d31d6c6505287cb551738241e3 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Thu, 30 Jan 2020 22:32:50 -0800 +Subject: [PATCH] Avoid index ranges + +The change in print_mac.c is not functionally the same, but we +ignore this for now. +--- + print_mac.c | 4 +--- + util.c | 8 ++++---- + 2 files changed, 5 insertions(+), 7 deletions(-) + +diff --git a/print_mac.c b/print_mac.c +index e851f307..435b1510 100644 +--- a/print_mac.c ++++ b/print_mac.c +@@ -17,8 +17,6 @@ + DIAG_PUSH_IGNORE_OVERRIDE_INIT + + static uint8_t hwaddr_sizes[] = { +- [0 ... ARPHRD_IEEE802_TR] = 255, +- + [ARPHRD_NETROM] = 7 /* AX25_ADDR_LEN */, + [ARPHRD_ETHER] = 6 /* ETH_ALEN */, + /* ARPHRD_EETHER - no actual devices in Linux */ +@@ -126,7 +124,7 @@ print_mac_addr(const char *prefix, const uint8_t addr[], size_t size) + const char * + sprint_hwaddr(const uint8_t hwaddr[], size_t size, uint32_t devtype) + { +- uint8_t sz = (devtype < ARRAY_SIZE(hwaddr_sizes)) ++ uint8_t sz = (devtype < ARRAY_SIZE(hwaddr_sizes) && hwaddr_sizes[devtype]) + ? hwaddr_sizes[devtype] : 255; + + return sprint_mac_addr(hwaddr, MIN(size, sz)); +diff --git a/util.c b/util.c +index 55bce30a..23a1f5da 100644 +--- a/util.c ++++ b/util.c +@@ -1105,16 +1105,16 @@ dumpstr(struct tcb *const tcp, const kernel_ulong_t addr, + ? 1 + ilog2_klong(len - 1) / HEX_BIT : DUMPSTR_OFFS_MIN_CHARS; + kernel_ulong_t i = 0; + const unsigned char *src; ++ char outbuf[DUMPSTR_WIDTH_CHARS + 1]; ++ ++ memset(outbuf, ' ', DUMPSTR_WIDTH_CHARS); ++ outbuf[DUMPSTR_WIDTH_CHARS] = '\0'; + + while (i < len) { + /* + * It is important to overwrite all the byte values, as we + * re-use the buffer in order to avoid its re-initialisation. + */ +- static char outbuf[] = { +- [0 ... DUMPSTR_WIDTH_CHARS - 1] = ' ', +- '\0' +- }; + char *dst = outbuf; + + /* Fetching data from tracee. */ +-- +2.25.0 + diff --git a/pkg/strace/patch/1001-Prevent-zero-sized-arrays.patch b/pkg/strace/patch/1001-Prevent-zero-sized-arrays.patch @@ -0,0 +1,74 @@ +diff --git a/xlat/btrfs_features_compat.h b/xlat/btrfs_features_compat.h +--- a/xlat/btrfs_features_compat.h Thu Nov 28 14:53:27 2019 ++++ b/xlat/btrfs_features_compat.h Thu Jan 30 21:12:47 2020 +@@ -13,13 +13,14 @@ + # else + + static const struct xlat_data btrfs_features_compat_xdata[] = { ++ {0} + }; + # if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) + static + # endif + const struct xlat btrfs_features_compat[1] = { { + .data = btrfs_features_compat_xdata, +- .size = ARRAY_SIZE(btrfs_features_compat_xdata), ++ .size = ARRAY_SIZE(btrfs_features_compat_xdata) - 1, + .type = XT_NORMAL, + } }; + +diff --git a/xlat/mq_attr_flags.h b/xlat/mq_attr_flags.h +--- a/xlat/mq_attr_flags.h Thu Nov 28 14:53:27 2019 ++++ b/xlat/mq_attr_flags.h Thu Jan 30 21:03:53 2020 +@@ -16,13 +16,14 @@ + #if defined(O_NONBLOCK) || (defined(HAVE_DECL_O_NONBLOCK) && HAVE_DECL_O_NONBLOCK) + XLAT(O_NONBLOCK), + #endif ++ {0} + }; + # if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) + static + # endif + const struct xlat mq_attr_flags[1] = { { + .data = mq_attr_flags_xdata, +- .size = ARRAY_SIZE(mq_attr_flags_xdata), ++ .size = ARRAY_SIZE(mq_attr_flags_xdata) - 1, + .type = XT_NORMAL, + } }; + +diff --git a/xlat/sigprof_codes.h b/xlat/sigprof_codes.h +--- a/xlat/sigprof_codes.h Thu Nov 28 14:53:27 2019 ++++ b/xlat/sigprof_codes.h Thu Jan 30 21:04:28 2020 +@@ -16,13 +16,14 @@ + #if defined(PROF_SIG) || (defined(HAVE_DECL_PROF_SIG) && HAVE_DECL_PROF_SIG) + XLAT(PROF_SIG), + #endif ++ {0} + }; + # if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) + static + # endif + const struct xlat sigprof_codes[1] = { { + .data = sigprof_codes_xdata, +- .size = ARRAY_SIZE(sigprof_codes_xdata), ++ .size = ARRAY_SIZE(sigprof_codes_xdata) - 1, + .type = XT_NORMAL, + } }; + +diff --git a/xlat/sock_ipx_options.h b/xlat/sock_ipx_options.h +--- a/xlat/sock_ipx_options.h Thu Nov 28 14:53:27 2019 ++++ b/xlat/sock_ipx_options.h Thu Jan 30 20:29:04 2020 +@@ -16,11 +16,12 @@ + #if defined(IPX_TYPE) || (defined(HAVE_DECL_IPX_TYPE) && HAVE_DECL_IPX_TYPE) + XLAT(IPX_TYPE), + #endif ++ {0} + }; + static + const struct xlat sock_ipx_options[1] = { { + .data = sock_ipx_options_xdata, +- .size = ARRAY_SIZE(sock_ipx_options_xdata), ++ .size = ARRAY_SIZE(sock_ipx_options_xdata) - 1, + .type = XT_NORMAL, + } }; + diff --git a/pkg/strace/ver b/pkg/strace/ver @@ -1 +1 @@ -5.4 r0 +5.4 r1