added my Recipes

This commit is contained in:
2024-07-11 14:16:35 +02:00
parent 38bc4f53ac
commit 09b621d929
7118 changed files with 525762 additions and 3 deletions

View File

@@ -0,0 +1,40 @@
From 95ff340a74af16cca89fd5c5ca99890821053209 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 22 Apr 2017 00:47:16 -0700
Subject: [PATCH] ARM code has unreachable code after switch statement move
initialization
Fixed
sysdeps/linux-gnu/arm/trace.c:173:33: error: statement will never be executed [-Werror=switch-unreachable]
uint32_t operand1, operand2, result = 0;
^~~~~~
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
sysdeps/linux-gnu/arm/trace.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sysdeps/linux-gnu/arm/trace.c b/sysdeps/linux-gnu/arm/trace.c
index 5e51e91..f974d1f 100644
--- a/sysdeps/linux-gnu/arm/trace.c
+++ b/sysdeps/linux-gnu/arm/trace.c
@@ -155,6 +155,8 @@ arm_get_next_pcs(struct process *proc,
const unsigned cond = BITS(this_instr, 28, 31);
const unsigned opcode = BITS(this_instr, 24, 27);
+ uint32_t operand1, operand2, result = 0;
+
if (cond == COND_NV)
switch (opcode) {
arch_addr_t addr;
@@ -170,7 +172,6 @@ arm_get_next_pcs(struct process *proc,
}
else
switch (opcode) {
- uint32_t operand1, operand2, result = 0;
case 0x0:
case 0x1: /* data processing */
case 0x2:
--
2.12.2

View File

@@ -0,0 +1,42 @@
From 5226333bddb755dbefd780d31450e0238dd5d3bd Mon Sep 17 00:00:00 2001
From: Zang Ruochen <zangrc.fnst@cn.fujitsu.com>
Date: Wed, 16 Oct 2019 08:24:23 +0900
Subject: [PATCH] Bug fix for data type length judgment.
...
if (byte_size == sizeof(long)) {
*type = is_signed ? ARGTYPE_LONG : ARGTYPE_ULONG;
return true;
}
...
If ltrace's target command has a dbg package, ltrace will look for the debug file and analyze its contents.
Ltrace determines the type of analysis result variable. The type of the variable is longlong.
On 32-bit systems, longlong is 8 and long is 4 (same as in).
An error occurred because the ltrace code did not process a variable of length 8.
Upstream-Status: Pending
Signed-off-by: Wang Mingyu <wangmy.fnst@cn.fujitsu.com>
---
dwarf_prototypes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dwarf_prototypes.c b/dwarf_prototypes.c
index bfac177..9887d4b 100644
--- a/dwarf_prototypes.c
+++ b/dwarf_prototypes.c
@@ -190,7 +190,7 @@ static bool get_integer_base_type(enum arg_type *type, int byte_size,
return true;
}
- if (byte_size == sizeof(long)) {
+ if (byte_size == sizeof(long long)) {
*type = is_signed ? ARGTYPE_LONG : ARGTYPE_ULONG;
return true;
}
--
2.7.4

View File

@@ -0,0 +1,261 @@
From 0af8ced6376f2256b9daac301c851e1c99c3b035 Mon Sep 17 00:00:00 2001
From: Adam Trhon <adam.trhon@tbs-biometrics.com>
Date: Fri, 12 May 2017 13:39:11 +0200
Subject: [PATCH] Fix tautological compare warning
By default, gcc ignores warning from code generated by macros
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80369). When
ltrace is compiled under icecream the warning *is generated*
(https://github.com/icecc/icecream/issues/202)
and the compilation fails (because of -Werror).
Upstream-Status: Submitted [ltrace-devel@lists.alioth.debian.org]
Signed-off-by: Adam Trhon <adam.trhon@tbs-biometrics.com>
---
filter.c | 4 ++--
sysdeps/linux-gnu/arm/fetch.c | 2 +-
sysdeps/linux-gnu/arm/trace.c | 2 +-
sysdeps/linux-gnu/ia64/fetch.c | 2 +-
sysdeps/linux-gnu/metag/trace.c | 2 +-
sysdeps/linux-gnu/mips/plt.c | 2 +-
sysdeps/linux-gnu/ppc/fetch.c | 2 +-
sysdeps/linux-gnu/ppc/plt.c | 2 +-
sysdeps/linux-gnu/ppc/trace.c | 4 ++--
sysdeps/linux-gnu/s390/fetch.c | 2 +-
sysdeps/linux-gnu/s390/trace.c | 4 ++--
sysdeps/linux-gnu/x86/fetch.c | 2 +-
sysdeps/linux-gnu/x86/trace.c | 4 ++--
value.c | 4 ++--
14 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/filter.c b/filter.c
index ba50c40..a65856d 100644
--- a/filter.c
+++ b/filter.c
@@ -79,7 +79,7 @@ filter_lib_matcher_name_init(struct filter_lib_matcher *matcher,
{
switch (type) {
case FLM_MAIN:
- assert(type != type);
+ assert(!"Unexpected value of type");
abort();
case FLM_SONAME:
@@ -137,7 +137,7 @@ matcher_matches_library(struct filter_lib_matcher *matcher, struct library *lib)
case FLM_MAIN:
return lib->type == LT_LIBTYPE_MAIN;
}
- assert(matcher->type != matcher->type);
+ assert(!"Unexpected value of matcher->type");
abort();
}
diff --git a/sysdeps/linux-gnu/arm/fetch.c b/sysdeps/linux-gnu/arm/fetch.c
index b500448..8f75fcf 100644
--- a/sysdeps/linux-gnu/arm/fetch.c
+++ b/sysdeps/linux-gnu/arm/fetch.c
@@ -317,7 +317,7 @@ arch_fetch_retval(struct fetch_context *ctx, enum tof type,
memmove(data, ctx->regs.uregs, sz);
return 0;
}
- assert(info->type != info->type);
+ assert(!"Unexpected value of info->type");
abort();
}
diff --git a/sysdeps/linux-gnu/arm/trace.c b/sysdeps/linux-gnu/arm/trace.c
index 5e51e91..e76bf63 100644
--- a/sysdeps/linux-gnu/arm/trace.c
+++ b/sysdeps/linux-gnu/arm/trace.c
@@ -701,7 +701,7 @@ arch_type_sizeof(struct process *proc, struct arg_type_info *info)
return (size_t)-2;
default:
- assert(info->type != info->type);
+ assert(!"Unexpected value of info->type");
abort();
}
}
diff --git a/sysdeps/linux-gnu/ia64/fetch.c b/sysdeps/linux-gnu/ia64/fetch.c
index 171c7a2..ee2fbc7 100644
--- a/sysdeps/linux-gnu/ia64/fetch.c
+++ b/sysdeps/linux-gnu/ia64/fetch.c
@@ -409,7 +409,7 @@ arch_fetch_arg_next(struct fetch_context *ctx, enum tof type,
case ARGTYPE_ARRAY:
/* Arrays decay into pointers. XXX Fortran? */
default:
- assert(info->type != info->type);
+ assert(!"Unexpected value of info->type");
abort();
}
}
diff --git a/sysdeps/linux-gnu/metag/trace.c b/sysdeps/linux-gnu/metag/trace.c
index ad5fffe..7a843d6 100644
--- a/sysdeps/linux-gnu/metag/trace.c
+++ b/sysdeps/linux-gnu/metag/trace.c
@@ -142,7 +142,7 @@ get_regval_from_unit(enum metag_unitnum unit, unsigned int reg,
return regs->ax[reg][0];
/* We really shouldn't be here. */
default:
- assert(unit != unit);
+ assert(!"Unexpected value of unit");
abort();
}
return 0;
diff --git a/sysdeps/linux-gnu/mips/plt.c b/sysdeps/linux-gnu/mips/plt.c
index c7c10ac..ca2307d 100644
--- a/sysdeps/linux-gnu/mips/plt.c
+++ b/sysdeps/linux-gnu/mips/plt.c
@@ -651,7 +651,7 @@ mips_stub_bp_continue(struct breakpoint *bp, struct process *proc)
break;
}
- assert(bp->libsym->arch.type != bp->libsym->arch.type);
+ assert(!"Unexpected value of bp->libsym->arch.type");
abort();
}
diff --git a/sysdeps/linux-gnu/ppc/fetch.c b/sysdeps/linux-gnu/ppc/fetch.c
index c6cbd71..5db5675 100644
--- a/sysdeps/linux-gnu/ppc/fetch.c
+++ b/sysdeps/linux-gnu/ppc/fetch.c
@@ -502,7 +502,7 @@ allocate_argument(struct fetch_context *ctx, struct process *proc,
case ARGTYPE_ARRAY:
/* Arrays decay into pointers. XXX Fortran? */
default:
- assert(info->type != info->type);
+ assert(!"Unexpected value of info->type");
abort();
}
diff --git a/sysdeps/linux-gnu/ppc/plt.c b/sysdeps/linux-gnu/ppc/plt.c
index 5f81889..781da03 100644
--- a/sysdeps/linux-gnu/ppc/plt.c
+++ b/sysdeps/linux-gnu/ppc/plt.c
@@ -1085,7 +1085,7 @@ ppc_plt_bp_continue(struct breakpoint *bp, struct process *proc)
break;
}
- assert(bp->libsym->arch.type != bp->libsym->arch.type);
+ assert(!"Unexpected value of bp->libsym->arch.type");
abort();
}
diff --git a/sysdeps/linux-gnu/ppc/trace.c b/sysdeps/linux-gnu/ppc/trace.c
index 5aab538..caa6035 100644
--- a/sysdeps/linux-gnu/ppc/trace.c
+++ b/sysdeps/linux-gnu/ppc/trace.c
@@ -217,7 +217,7 @@ arch_type_sizeof(struct process *proc, struct arg_type_info *info)
return (size_t)-2;
default:
- assert(info->type != info->type);
+ assert(!"Unexpected value of info->type");
abort();
break;
}
@@ -231,7 +231,7 @@ arch_type_alignof(struct process *proc, struct arg_type_info *info)
switch (info->type) {
default:
- assert(info->type != info->type);
+ assert(!"Unexpected value of info->type");
abort();
break;
diff --git a/sysdeps/linux-gnu/s390/fetch.c b/sysdeps/linux-gnu/s390/fetch.c
index 4ad5951..4721c30 100644
--- a/sysdeps/linux-gnu/s390/fetch.c
+++ b/sysdeps/linux-gnu/s390/fetch.c
@@ -266,7 +266,7 @@ arch_fetch_arg_next(struct fetch_context *ctx, enum tof type,
return allocate_gpr(ctx, proc, info, valuep, sz);
default:
- assert(info->type != info->type);
+ assert(!"Unexpected value of info->type");
abort();
}
return -1;
diff --git a/sysdeps/linux-gnu/s390/trace.c b/sysdeps/linux-gnu/s390/trace.c
index 78b04c3..24f7801 100644
--- a/sysdeps/linux-gnu/s390/trace.c
+++ b/sysdeps/linux-gnu/s390/trace.c
@@ -213,7 +213,7 @@ arch_type_sizeof(struct process *proc, struct arg_type_info *info)
return (size_t)-2;
default:
- assert(info->type != info->type);
+ assert(!"Unexpected value of info->type");
abort();
}
}
@@ -226,7 +226,7 @@ arch_type_alignof(struct process *proc, struct arg_type_info *info)
switch (info->type) {
default:
- assert(info->type != info->type);
+ assert(!"Unexpected value of info->type");
break;
case ARGTYPE_CHAR:
diff --git a/sysdeps/linux-gnu/x86/fetch.c b/sysdeps/linux-gnu/x86/fetch.c
index 6868101..ae2ed79 100644
--- a/sysdeps/linux-gnu/x86/fetch.c
+++ b/sysdeps/linux-gnu/x86/fetch.c
@@ -523,7 +523,7 @@ classify(struct process *proc, struct fetch_context *context,
default:
/* Unsupported type. */
- assert(info->type != info->type);
+ assert(!"Unexpected value of info->type");
abort();
}
abort();
diff --git a/sysdeps/linux-gnu/x86/trace.c b/sysdeps/linux-gnu/x86/trace.c
index 6a1a6a5..d8d2115 100644
--- a/sysdeps/linux-gnu/x86/trace.c
+++ b/sysdeps/linux-gnu/x86/trace.c
@@ -145,7 +145,7 @@ arch_type_sizeof(struct process *proc, struct arg_type_info *info)
return (size_t)-2;
default:
- assert(info->type != info->type);
+ assert(!"Unexpected value of info->type");
abort();
}
}
@@ -158,7 +158,7 @@ arch_type_alignof(struct process *proc, struct arg_type_info *info)
switch (info->type) {
default:
- assert(info->type != info->type);
+ assert(!"Unexpected value of info->type");
abort();
break;
diff --git a/value.c b/value.c
index 2125ba9..30edb4e 100644
--- a/value.c
+++ b/value.c
@@ -363,7 +363,7 @@ value_set_word(struct value *value, long word)
u.u64 = word;
break;
default:
- assert(sz != sz);
+ assert(!"Unexpected value of sz");
abort();
}
@@ -414,7 +414,7 @@ value_extract_word(struct value *value, long *retp,
*retp = (long)u.u64;
return 0;
default:
- assert(sz != sz);
+ assert(!"Unexpected value of sz");
abort();
}
}
--
2.12.0

View File

@@ -0,0 +1,86 @@
From 491b3b153f6b5cbf2d23a9778e5676eb29a6705f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 6 Feb 2023 16:37:19 -0800
Subject: [PATCH] Fix type of single bit bitfields
clang16 warns
trace.c:311:22: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
quash the warning by using an unsigned type to allow
an assignment of 0 or 1 without implicit conversion.
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
library.h | 6 +++---
prototype.h | 2 +-
sysdeps/linux-gnu/trace.h | 10 +++++-----
3 files changed, 9 insertions(+), 9 deletions(-)
--- a/library.h
+++ b/library.h
@@ -71,20 +71,20 @@ struct library_symbol {
* looking up one in LIB->protolib. */
struct prototype *proto;
- int own_name : 1;
+ unsigned int own_name : 1;
/* This is relevant for PLT symbols. Latent PLT symbols are
* those that don't match any of the -e rules, but that might
* potentially become active if a library implementing them
* appears that matches a -l rule. Ltrace core is responsible
* for clearing latent flag. */
- int latent : 1;
+ unsigned latent : 1;
/* Delayed symbols are those for which a breakpoint shouldn't
* be enabled yet. They are similar to latent symbols, but
* backend is responsible for clearing the delayed flag. See
* proc_activate_delayed_symbol. */
- int delayed : 1;
+ unsigned int delayed : 1;
struct arch_library_symbol_data arch;
struct os_library_symbol_data os;
--- a/prototype.h
+++ b/prototype.h
@@ -162,7 +162,7 @@ struct protolib_cache {
/* For tracking uses of cache during cache's own
* initialization. */
- int bootstrap : 1;
+ unsigned int bootstrap : 1;
};
/* Initialize CACHE. Returns 0 on success or a negative value on
--- a/sysdeps/linux-gnu/trace.h
+++ b/sysdeps/linux-gnu/trace.h
@@ -33,11 +33,11 @@
struct pid_task {
pid_t pid; /* This may be 0 for tasks that exited
* mid-handling. */
- int sigstopped : 1;
- int got_event : 1;
- int delivered : 1;
- int vforked : 1;
- int sysret : 1;
+ unsigned int sigstopped : 1;
+ unsigned int got_event : 1;
+ unsigned int delivered : 1;
+ unsigned int vforked : 1;
+ unsigned int sysret : 1;
};
struct pid_set {
--- a/sysdeps/linux-gnu/trace.c
+++ b/sysdeps/linux-gnu/trace.c
@@ -1043,7 +1043,7 @@ ltrace_exiting_install_handler(struct pr
struct process_vfork_handler
{
struct event_handler super;
- int vfork_bp_refd:1;
+ unsigned int vfork_bp_refd:1;
};
static Event *

View File

@@ -0,0 +1,28 @@
From df490528d1e81a98ba2991c700c92a8e6c969083 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 6 Mar 2017 21:32:22 -0800
Subject: [PATCH 1/2] Use correct enum type
Clang warns about wrong enum initializtion
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
sysdeps/linux-gnu/aarch64/fetch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysdeps/linux-gnu/aarch64/fetch.c b/sysdeps/linux-gnu/aarch64/fetch.c
index 2744df0..1dcf7cc 100644
--- a/sysdeps/linux-gnu/aarch64/fetch.c
+++ b/sysdeps/linux-gnu/aarch64/fetch.c
@@ -173,7 +173,7 @@ static struct fetch_script
pass_arg(struct fetch_context const *context,
struct process *proc, struct arg_type_info *info)
{
- enum fetch_method cvt = CVT_NOP;
+ enum convert_method cvt = CVT_NOP;
size_t sz = type_sizeof(proc, info);
if (sz == (size_t) -1)
--
2.12.0

View File

@@ -0,0 +1,25 @@
From c1d3aaf5ec810c2594938438c7b4ccd20943f255 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 7 Jul 2017 10:20:52 -0700
Subject: [PATCH] configure: Recognise linux-musl as a host OS
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
configure.ac | 1 +
1 file changed, 1 insertion(+)
diff --git a/configure.ac b/configure.ac
index 3e8667f..95d6642 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,6 +35,7 @@ AC_CANONICAL_HOST
case "${host_os}" in
linux-gnu*) HOST_OS="linux-gnu" ;;
linux-uclibc*) HOST_OS="linux-gnu" ;;
+ linux-musl*) HOST_OS="linux-gnu" ;;
*) AC_MSG_ERROR([unkown host-os ${host_os}]) ;;
esac
AC_SUBST(HOST_OS)
--
2.13.2

View File

@@ -0,0 +1,46 @@
From 67a8fa478a4484bc4dbfb3ac74e11be1dd5af594 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 23 Dec 2019 19:35:48 -0800
Subject: [PATCH] ensure the struct pointers are null initilized
Do not delete if pointer is already null
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
expr.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/expr.c b/expr.c
index 4059a32..5ffd0ad 100644
--- a/expr.c
+++ b/expr.c
@@ -189,10 +189,8 @@ int
expr_clone(struct expr_node *retp, const struct expr_node *node)
{
*retp = *node;
-
+ struct expr_node *nlhs = 0, *nrhs = 0;
switch (node->kind) {
- struct expr_node *nlhs;
- struct expr_node *nrhs;
case EXPR_OP_ARGNO:
case EXPR_OP_SELF:
@@ -236,8 +234,10 @@ expr_clone(struct expr_node *retp, const struct expr_node *node)
if (expr_alloc_and_clone(&nlhs, node->lhs, node->own_lhs) < 0) {
if (node->kind == EXPR_OP_CALL2
&& node->u.call.own_rhs) {
- expr_destroy(nrhs);
- free(nrhs);
+ if (nrhs) {
+ expr_destroy(nrhs);
+ free(nrhs);
+ }
return -1;
}
}
--
2.24.1

View File

@@ -0,0 +1,33 @@
From 8321f8b3befbaa355cfed988fdd8494133989676 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 4 Feb 2019 00:38:16 -0800
Subject: [PATCH] hook: Do not append int to std::string
Clang find this error
| ../../../git/sysdeps/linux-gnu/hooks.c:205:51: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus
-int]
| || sprintf(syspath, "%s/%s", sysconfdir, FN + 1) < 0)
| ~~~^~~
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
sysdeps/linux-gnu/hooks.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/sysdeps/linux-gnu/hooks.c
+++ b/sysdeps/linux-gnu/hooks.c
@@ -200,9 +200,10 @@ os_get_ltrace_conf_filenames(struct vect
const char *sysconfdir = SYSCONFDIR;
if (sysconfdir != NULL && *sysconfdir != '\0') {
/* No +1, we skip the initial period. */
- syspath = malloc(strlen(sysconfdir) + sizeof FN);
+ syspath = malloc(strlen(sysconfdir) + sizeof FN + 2);
+ syspath[strlen(sysconfdir) + sizeof FN + 1] = '\0';
if (syspath == NULL
- || sprintf(syspath, "%s/%s", sysconfdir, FN + 1) < 0)
+ || sprintf(syspath, "%s/%s", sysconfdir, FN) < 0)
goto fail;
}

View File

@@ -0,0 +1,50 @@
From ed8dbe1c793f2f770fef61adc4390277f903cceb Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 9 Jul 2021 01:32:42 -0700
Subject: [PATCH] mips: Use hardcodes values for ABI syscall bases
mips kernels 5.13+ have stopped exposing the UAPIs which provided these
defines, the values are more or less static so just use the hardcoded
values for now. Use __NR_syscalls to get number of syscalls supported
and include asm-generic/unistd.h to get this definition
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
sysdeps/linux-gnu/mips/trace.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/sysdeps/linux-gnu/mips/trace.c b/sysdeps/linux-gnu/mips/trace.c
index d54818e..e72184d 100644
--- a/sysdeps/linux-gnu/mips/trace.c
+++ b/sysdeps/linux-gnu/mips/trace.c
@@ -33,6 +33,7 @@
#include <asm/unistd.h>
#include <assert.h>
#include <asm/unistd.h>
+#include <asm-generic/unistd.h>
#include "backend.h"
#include "common.h"
@@ -135,12 +136,12 @@ syscall_p(struct process *proc, int status, int *sysnum)
int min_syscall, max_syscall, sigreturn, rt_sigreturn;
struct callstack_element *top = NULL;
int depth = proc->callstack_depth;
- const int syscallbase[] = {__NR_O32_Linux, __NR_N32_Linux,
- __NR_64_Linux, __NR_O32_Linux};
- const int syscallnum[] = {__NR_O32_Linux_syscalls,
- __NR_N32_Linux_syscalls,
- __NR_64_Linux_syscalls,
- __NR_O32_Linux_syscalls};
+ const int syscallbase[] = {4000, 6000,
+ 5000, 4000};
+ const int syscallnum[] = {__NR_syscalls,
+ __NR_syscalls,
+ __NR_syscalls,
+ __NR_syscalls};
const int rt_sigreturn_list[] = {193, 211, 211, 193};
const int sigreturn_list[] = {119, -1, -1, 119};
--
2.32.0

View File

@@ -0,0 +1,27 @@
From 19a3e590c97420bd3952301bf376067c75d0ee32 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 18 Sep 2017 23:45:54 -0700
Subject: [PATCH] mips/plt.c: Delete include error.h
Its not needed
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
sysdeps/linux-gnu/mips/plt.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/sysdeps/linux-gnu/mips/plt.c b/sysdeps/linux-gnu/mips/plt.c
index 2d85ad9..9c3ae2f 100644
--- a/sysdeps/linux-gnu/mips/plt.c
+++ b/sysdeps/linux-gnu/mips/plt.c
@@ -24,7 +24,6 @@
#include <sys/ptrace.h>
#include <errno.h>
-#include <error.h>
#include <gelf.h>
#include <inttypes.h>
#include <string.h>
--
2.14.1

View File

@@ -0,0 +1,37 @@
From 0cad025f80cf090dc16a5b70e21477f5b08a67fd Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 20 Dec 2018 11:27:45 -0800
Subject: [PATCH] move fprintf into same block where modname and symname are
computed
In its current state if mod turns out to be NULL then modname and
symname will also turn out to be NULL and fprinting them as strings will
be problematic
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
output.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/output.c b/output.c
index b63befe..5aada7b 100644
--- a/output.c
+++ b/output.c
@@ -654,12 +654,11 @@ frame_callback (Dwfl_Frame *state, void *arg)
NULL, NULL, NULL);
symname = dwfl_module_addrinfo(mod, pc, &off, &sym,
NULL, NULL, NULL);
+ /* This mimics the output produced by libunwind below. */
+ fprintf(options.output, " > %s(%s+0x%" PRIx64 ") [%" PRIx64 "]\n",
+ modname, symname, off, pc);
}
- /* This mimics the output produced by libunwind below. */
- fprintf(options.output, " > %s(%s+0x%" PRIx64 ") [%" PRIx64 "]\n",
- modname, symname, off, pc);
-
/* See if we can extract the source line too and print it on
the next line if we can find it. */
if (mod != NULL) {

View File

@@ -0,0 +1,37 @@
From 4517bf59838f40eb6e3f46e39adb5e5090c59df8 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 15 Jun 2021 18:14:36 -0700
Subject: [PATCH] ppc: Remove unused host_powerpc64 function
This function is dead code, remove it which avoids compiler warnings
with clang
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
sysdeps/linux-gnu/ppc/plt.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/sysdeps/linux-gnu/ppc/plt.c b/sysdeps/linux-gnu/ppc/plt.c
index 5f81889..9d1838b 100644
--- a/sysdeps/linux-gnu/ppc/plt.c
+++ b/sysdeps/linux-gnu/ppc/plt.c
@@ -142,16 +142,6 @@
#define PPC64_PLT_STUB_SIZE 4
#endif
-static inline int
-host_powerpc64()
-{
-#ifdef __powerpc64__
- return 1;
-#else
- return 0;
-#endif
-}
-
static void
mark_as_resolved(struct library_symbol *libsym, GElf_Addr value)
{
--
2.32.0

View File

@@ -0,0 +1,29 @@
From f47672bed5905ae382e80b09dafca9a8da45aa67 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 19 Apr 2022 18:44:36 -0700
Subject: [PATCH] ppc/plt: do not free symbol libsym
delete_symbol_chain() will call free as well if sybol is non-null
it also fixes use-after-free warnings that compiler emits
Upstream-Status: Submitted [https://gitlab.com/cespedes/ltrace/-/merge_requests/2]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
sysdeps/linux-gnu/ppc/plt.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/sysdeps/linux-gnu/ppc/plt.c b/sysdeps/linux-gnu/ppc/plt.c
index 5f81889..7c1c025 100644
--- a/sysdeps/linux-gnu/ppc/plt.c
+++ b/sysdeps/linux-gnu/ppc/plt.c
@@ -687,7 +687,6 @@ arch_elf_add_func_entry(struct process *proc, struct ltelf *lte,
if (libsym == NULL
|| library_symbol_init(libsym, addr, full_name, 1,
LS_TOPLT_NONE) < 0) {
- free(libsym);
delete_symbol_chain(libsym);
libsym = NULL;
fprintf(stderr, "Couldn't add symbol %s"
--
2.36.0

View File

@@ -0,0 +1,36 @@
From 64f98f84fd88797e219f9dde1ca387fee4b509f0 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 24 Apr 2016 16:58:17 -0700
Subject: [PATCH] replace readdir_r with readdir
glibc 2.24 has deprecated readdir_r
https://sourceware.org/ml/libc-alpha/2016-02/msg00093.html
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Submitted
sysdeps/linux-gnu/proc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sysdeps/linux-gnu/proc.c b/sysdeps/linux-gnu/proc.c
index 953fd86..edb716d 100644
--- a/sysdeps/linux-gnu/proc.c
+++ b/sysdeps/linux-gnu/proc.c
@@ -242,9 +242,10 @@ process_tasks(pid_t pid, pid_t **ret_tasks, size_t *ret_n)
size_t alloc = 0;
while (1) {
- struct dirent entry;
struct dirent *result;
- if (readdir_r(d, &entry, &result) != 0) {
+ errno = 0;
+ result = readdir(d);
+ if (errno != 0) {
fail:
free(tasks);
closedir(d);
--
2.8.0

View File

@@ -0,0 +1,76 @@
From 4d3ec1a514f9b1df8ce3a1b04c8a2823d977377f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 6 Mar 2017 21:34:01 -0800
Subject: [PATCH 2/2] Fix const qualifier error
Fixes clang warning
error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
dict.h | 2 +-
library.c | 2 +-
vect.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
Index: git/dict.h
===================================================================
--- git.orig/dict.h
+++ git/dict.h
@@ -90,7 +90,7 @@ int dict_clone(struct dict *target, cons
assert(_source_d->values.elt_size == sizeof(VALUE_TYPE)); \
/* Check that callbacks are typed properly. */ \
void (*_key_dtor_cb)(KEY_TYPE *, void *) = DTOR_KEY; \
- int (*_key_clone_cb)(KEY_TYPE *, const KEY_TYPE *, \
+ int (*_key_clone_cb)(KEY_TYPE *, KEY_TYPE *, \
void *) = CLONE_KEY; \
void (*_value_dtor_cb)(VALUE_TYPE *, void *) = DTOR_VALUE; \
int (*_value_clone_cb)(VALUE_TYPE *, const VALUE_TYPE *, \
Index: git/library.c
===================================================================
--- git.orig/library.c
+++ git/library.c
@@ -353,7 +353,7 @@ static void
library_exported_names_init(struct library_exported_names *names)
{
DICT_INIT(&names->names,
- const char*, uint64_t,
+ char*, uint64_t,
dict_hash_string, dict_eq_string, NULL);
DICT_INIT(&names->addrs,
uint64_t, struct vect*,
Index: git/vect.h
===================================================================
--- git.orig/vect.h
+++ git/vect.h
@@ -66,7 +66,7 @@ int vect_clone(struct vect *target, cons
assert(_source_vec->elt_size == sizeof(ELT_TYPE)); \
/* Check that callbacks are typed properly. */ \
void (*_dtor_callback)(ELT_TYPE *, void *) = DTOR; \
- int (*_clone_callback)(ELT_TYPE *, const ELT_TYPE *, \
+ int (*_clone_callback)(ELT_TYPE *, ELT_TYPE *, \
void *) = CLONE; \
vect_clone((TGT_VEC), _source_vec, \
(int (*)(void *, const void *, \
Index: git/value_dict.c
===================================================================
--- git.orig/value_dict.c
+++ git/value_dict.c
@@ -40,7 +40,7 @@ val_dict_init(struct value_dict *dict)
}
static int
-value_clone_cb(struct value *tgt, const struct value *src, void *data)
+value_clone_cb(struct value *tgt, struct value *src, void *data)
{
return value_clone(tgt, src);
}
@@ -53,7 +53,7 @@ value_dtor(struct value *val, void *data
static int
named_value_clone(struct named_value *tgt,
- const struct named_value *src, void *data)
+ struct named_value *src, void *data)
{
tgt->name = strdup(src->name);
if (tgt->name == NULL)

View File

@@ -0,0 +1,39 @@
--- a/sysdeps/linux-gnu/ppc/ptrace.h
+++ b/sysdeps/linux-gnu/ppc/ptrace.h
@@ -18,4 +18,5 @@
* 02110-1301 USA
*/
+#include <asm/ptrace.h>
#include <sys/ptrace.h>
--- a/sysdeps/linux-gnu/ppc/regs.c
+++ b/sysdeps/linux-gnu/ppc/regs.c
@@ -23,11 +23,14 @@
#include "config.h"
+#include <string.h>
#include <sys/types.h>
#include <sys/ptrace.h>
#include <asm/ptrace.h>
#include <errno.h>
+#ifdef HAVE_ERROR_H
#include <error.h>
+#endif
#include "proc.h"
#include "common.h"
@@ -49,8 +52,11 @@ get_instruction_pointer(struct process *
void
set_instruction_pointer(struct process *proc, void *addr)
{
- if (ptrace(PTRACE_POKEUSER, proc->pid, sizeof(long)*PT_NIP, addr) != 0)
- error(0, errno, "set_instruction_pointer");
+ if (ptrace(PTRACE_POKEUSER, proc->pid, sizeof(long)*PT_NIP, addr) != 0){
+ report_global_error("%s: set_instruction_pointer",
+ strerror(errno));
+ exit(1);
+ }
}
void *

View File

@@ -0,0 +1,36 @@
From 887a403e38f590ebf1d04ce600d94cb7a351744c Mon Sep 17 00:00:00 2001
From: Wenzong Fan <wenzong.fan@windriver.com>
Date: Mon, 1 Dec 2014 00:57:42 -0500
Subject: [PATCH] ltrace: allow to enable/disable selinux support
Upstream-Status: Pending
Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
---
configure.ac | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6fe5e3b..189885a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -125,8 +125,14 @@ AC_SUBST(libstdcxx_LIBS)
dnl Check security_get_boolean_active availability.
-AC_CHECK_HEADERS(selinux/selinux.h)
-AC_CHECK_LIB(selinux, security_get_boolean_active)
+AC_ARG_ENABLE([selinux],
+ AS_HELP_STRING([--enable-selinux],[enable SELinux support [default=auto]]),
+ [], [enable_selinux=auto])
+
+if test x$enable_selinux != xno; then
+ AC_CHECK_HEADERS(selinux/selinux.h)
+ AC_CHECK_LIB(selinux, security_get_boolean_active)
+fi
dnl Whether (and which) elfutils libdw.so to use for unwinding.
AC_ARG_WITH(elfutils,
--
1.7.9.5

View File

@@ -0,0 +1,51 @@
SUMMARY = "ltrace intercepts and records dynamic library calls"
DESCRIPTION = "ltrace intercepts and records dynamic library calls \
which are called by an executed process and the signals received by that process. \
It can also intercept and print the system calls executed by the program.\
"
HOMEPAGE = "http://ltrace.org/"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a"
PE = "1"
PV = "7.91+git${SRCPV}"
SRCREV = "c22d359433b333937ee3d803450dc41998115685"
DEPENDS = "elfutils"
SRC_URI = "git://github.com/sparkleholic/ltrace.git;protocol=https;branch=master \
file://configure-allow-to-disable-selinux-support.patch \
file://0001-replace-readdir_r-with-readdir.patch \
file://0001-Use-correct-enum-type.patch \
file://0002-Fix-const-qualifier-error.patch \
file://0001-ARM-code-has-unreachable-code-after-switch-statement.patch \
file://0001-Fix-tautological-compare-warning.patch \
file://0001-Add-support-for-mips64-n32-n64.patch \
file://0001-configure-Recognise-linux-musl-as-a-host-OS.patch \
file://0001-mips-plt.c-Delete-include-error.h.patch \
file://0001-move-fprintf-into-same-block-where-modname-and-symna.patch \
file://0001-hook-Do-not-append-int-to-std-string.patch \
file://0001-Bug-fix-for-data-type-length-judgment.patch \
file://0001-ensure-the-struct-pointers-are-null-initilized.patch \
file://0001-ppc-Remove-unused-host_powerpc64-function.patch \
file://0001-mips-Use-hardcodes-values-for-ABI-syscall-bases.patch \
file://0001-ppc-plt-do-not-free-symbol-libsym.patch \
file://0001-Fix-type-of-single-bit-bitfields.patch \
"
SRC_URI:append:libc-musl = " file://add_ppc64le.patch"
S = "${WORKDIR}/git"
inherit autotools
PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}"
PACKAGECONFIG[unwind] = "--with-libunwind,--without-libunwind,libunwind"
PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux,libselinux"
COMPATIBLE_HOST:riscv64 = "null"
COMPATIBLE_HOST:riscv32 = "null"
do_configure:prepend () {
( cd ${S}; ./autogen.sh )
}