ltrace: 0.7.3 -> 0.7.91

0.7.91 is a "fake" version of ltrace from Red Hat / Fedora which
includes many patches for better compatibility with non-x86
architectures as well as fixes for bugs found since the 0.7.3 release
back in 2013.
This commit is contained in:
Pierre Bourdon 2022-09-20 11:05:28 +02:00
parent 94320898c5
commit 8511f9a55f
No known key found for this signature in database
GPG key ID: 6FB80DCD84DA0F1C
3 changed files with 386 additions and 12 deletions

View file

@ -1,30 +1,63 @@
{ lib, stdenv, fetchurl, elfutils, libunwind }:
{ lib, stdenv, fetchurl, fetchgit, autoreconfHook, dejagnu, elfutils }:
stdenv.mkDerivation rec {
pname = "ltrace";
version = "0.7.3";
version = "0.7.91";
src = fetchurl {
url = "mirror://debian/pool/main/l/${pname}/${pname}_${version}.orig.tar.bz2";
sha256 = "00wmbdghqbz6x95m1mcdd3wd46l6hgcr4wggdp049dbifh3qqvqf";
url = "https://src.fedoraproject.org/repo/pkgs/ltrace/ltrace-0.7.91.tar.bz2/9db3bdee7cf3e11c87d8cc7673d4d25b/ltrace-0.7.91.tar.bz2";
sha256 = "sha256-HqellbKh2ZDHxslXl7SSIXtpjV1sodtgVwh8hgTC3Dc=";
};
buildInputs = [ elfutils libunwind ];
nativeBuildInputs = [ autoreconfHook ]; # Some patches impact ./configure.
buildInputs = [ elfutils ];
checkInputs = [ dejagnu ];
# Import Fedora's (very) large patch series: bug fixes, architecture support,
# etc. RH/Fedora are currently working with upstream to merge all these
# patches for the next major branch.
prePatch = let
debian = fetchurl {
url = "mirror://debian/pool/main/l/ltrace/ltrace_0.7.3-6.debian.tar.xz";
sha256 = "0xc4pfd8qw53crvdxr29iwl8na53zmknca082kziwpvlzsick4kp";
fedora = fetchgit {
url = "https://src.fedoraproject.org/rpms/ltrace.git";
rev = "00f430ccbebdbd13bdd4d7ee6303b091cf005542";
sha256 = "sha256-FBGEgmaslu7xrJtZ2WsYwu9Cw1ZQrWRV1+Eu9qLXO4s=";
};
in ''
tar xf '${debian}'
patches="$patches $(cat debian/patches/series | sed 's|^|debian/patches/|')"
# Order matters, read the patch list from the RPM spec. Our own patches
# are applied on top of the Fedora baseline.
fedorapatches=""
for p in $(grep '^Patch[0-9]\+:' ${fedora}/ltrace.spec | awk '{ print $2 }'); do
fedorapatches="$fedorapatches ${fedora}/$p"
done
patches="$fedorapatches $patches"
'';
# Cherry-pick extra patches for recent glibc support in the test suite.
patches = [
# https://gitlab.com/cespedes/ltrace/-/merge_requests/14
./testsuite-newfstatat.patch
# https://gitlab.com/cespedes/ltrace/-/merge_requests/15
./sysdeps-x86.patch
];
doCheck = true;
checkPhase = ''
# Hardening options interfere with some of the low-level expectations in
# the test suite (e.g. printf ends up redirected to __printf_chk).
NIX_HARDENING_ENABLE="" \
# Disable test that requires ptrace-ing a non-child process, this might be
# forbidden by YAMA ptrace policy on the build host.
RUNTESTFLAGS="--host=${stdenv.hostPlatform.config} \
--target=${stdenv.targetPlatform.config} \
--ignore attach-process.exp" \
make check
'';
meta = with lib; {
description = "Library call tracer";
homepage = "https://www.ltrace.org/";
platforms = [ "i686-linux" "x86_64-linux" ];
license = licenses.gpl2;
platforms = platforms.linux;
license = licenses.gpl2Plus;
maintainers = with maintainers; [ delroth ];
};
}

View file

@ -0,0 +1,328 @@
diff --git a/sysdeps/linux-gnu/x86/syscallent.h b/sysdeps/linux-gnu/x86/syscallent.h
index 345fe20..66ac522 100644
--- a/sysdeps/linux-gnu/x86/syscallent.h
+++ b/sysdeps/linux-gnu/x86/syscallent.h
@@ -238,7 +238,7 @@
"setfsgid32", /* 216 */
"pivot_root", /* 217 */
"mincore", /* 218 */
- "madvise1", /* 219 */
+ "madvise", /* 219 */
"getdents64", /* 220 */
"fcntl64", /* 221 */
"222", /* 222 */
@@ -279,14 +279,14 @@
"remap_file_pages", /* 257 */
"set_tid_address", /* 258 */
"timer_create", /* 259 */
- "260", /* 260 */
- "261", /* 261 */
- "262", /* 262 */
- "263", /* 263 */
- "264", /* 264 */
- "265", /* 265 */
- "266", /* 266 */
- "267", /* 267 */
+ "timer_settime", /* 260 */
+ "timer_gettime", /* 261 */
+ "timer_getoverrun", /* 262 */
+ "timer_delete", /* 263 */
+ "clock_settime", /* 264 */
+ "clock_gettime", /* 265 */
+ "clock_getres", /* 266 */
+ "clock_nanosleep", /* 267 */
"statfs64", /* 268 */
"fstatfs64", /* 269 */
"tgkill", /* 270 */
@@ -297,11 +297,11 @@
"get_mempolicy", /* 275 */
"set_mempolicy", /* 276 */
"mq_open", /* 277 */
- "278", /* 278 */
- "279", /* 279 */
- "280", /* 280 */
- "281", /* 281 */
- "282", /* 282 */
+ "mq_unlink", /* 278 */
+ "mq_timedsend", /* 279 */
+ "mq_timedreceive", /* 280 */
+ "mq_notify", /* 281 */
+ "mq_getsetattr", /* 282 */
"kexec_load", /* 283 */
"waitid", /* 284 */
"285", /* 285 */
@@ -368,3 +368,105 @@
"setns", /* 346 */
"process_vm_readv", /* 347 */
"process_vm_writev", /* 348 */
+ "kcmp", /* 349 */
+ "finit_module", /* 350 */
+ "sched_setattr", /* 351 */
+ "sched_getattr", /* 352 */
+ "renameat2", /* 353 */
+ "seccomp", /* 354 */
+ "getrandom", /* 355 */
+ "memfd_create", /* 356 */
+ "bpf", /* 357 */
+ "execveat", /* 358 */
+ "socket", /* 359 */
+ "socketpair", /* 360 */
+ "bind", /* 361 */
+ "connect", /* 362 */
+ "listen", /* 363 */
+ "accept4", /* 364 */
+ "getsockopt", /* 365 */
+ "setsockopt", /* 366 */
+ "getsockname", /* 367 */
+ "getpeername", /* 368 */
+ "sendto", /* 369 */
+ "sendmsg", /* 370 */
+ "recvfrom", /* 371 */
+ "recvmsg", /* 372 */
+ "shutdown", /* 373 */
+ "userfaultfd", /* 374 */
+ "membarrier", /* 375 */
+ "mlock2", /* 376 */
+ "copy_file_range", /* 377 */
+ "preadv2", /* 378 */
+ "pwritev2", /* 379 */
+ "pkey_mprotect", /* 380 */
+ "pkey_alloc", /* 381 */
+ "pkey_free", /* 382 */
+ "statx", /* 383 */
+ "arch_prctl", /* 384 */
+ "io_pgetevents", /* 385 */
+ "rseq", /* 386 */
+ "387", /* 387 */
+ "388", /* 388 */
+ "389", /* 389 */
+ "390", /* 390 */
+ "391", /* 391 */
+ "392", /* 392 */
+ "semget", /* 393 */
+ "semctl", /* 394 */
+ "shmget", /* 395 */
+ "shmctl", /* 396 */
+ "shmat", /* 397 */
+ "shmdt", /* 398 */
+ "msgget", /* 399 */
+ "msgsnd", /* 400 */
+ "msgrcv", /* 401 */
+ "msgctl", /* 402 */
+ "clock_gettime64", /* 403 */
+ "clock_settime64", /* 404 */
+ "clock_adjtime64", /* 405 */
+ "clock_getres_time64", /* 406 */
+ "clock_nanosleep_time64", /* 407 */
+ "timer_gettime64", /* 408 */
+ "timer_settime64", /* 409 */
+ "timerfd_gettime64", /* 410 */
+ "timerfd_settime64", /* 411 */
+ "utimensat_time64", /* 412 */
+ "pselect6_time64", /* 413 */
+ "ppoll_time64", /* 414 */
+ "415", /* 415 */
+ "io_pgetevents_time64", /* 416 */
+ "recvmmsg_time64", /* 417 */
+ "mq_timedsend_time64", /* 418 */
+ "mq_timedreceive_time64", /* 419 */
+ "semtimedop_time64", /* 420 */
+ "rt_sigtimedwait_time64", /* 421 */
+ "futex_time64", /* 422 */
+ "sched_rr_get_interval_time64", /* 423 */
+ "pidfd_send_signal", /* 424 */
+ "io_uring_setup", /* 425 */
+ "io_uring_enter", /* 426 */
+ "io_uring_register", /* 427 */
+ "open_tree", /* 428 */
+ "move_mount", /* 429 */
+ "fsopen", /* 430 */
+ "fsconfig", /* 431 */
+ "fsmount", /* 432 */
+ "fspick", /* 433 */
+ "pidfd_open", /* 434 */
+ "clone3", /* 435 */
+ "close_range", /* 436 */
+ "openat2", /* 437 */
+ "pidfd_getfd", /* 438 */
+ "faccessat2", /* 439 */
+ "process_madvise", /* 440 */
+ "epoll_pwait2", /* 441 */
+ "mount_setattr", /* 442 */
+ "quotactl_fd", /* 443 */
+ "landlock_create_ruleset", /* 444 */
+ "landlock_add_rule", /* 445 */
+ "landlock_restrict_self", /* 446 */
+ "memfd_secret", /* 447 */
+ "process_mrelease", /* 448 */
+ "futex_waitv", /* 449 */
+ "set_mempolicy_home_node", /* 450 */
diff --git a/sysdeps/linux-gnu/x86/syscallent1.h b/sysdeps/linux-gnu/x86/syscallent1.h
index 91ae8d6..f8b15f7 100644
--- a/sysdeps/linux-gnu/x86/syscallent1.h
+++ b/sysdeps/linux-gnu/x86/syscallent1.h
@@ -36,8 +36,8 @@
"rt_sigprocmask", /* 14 */
"rt_sigreturn", /* 15 */
"ioctl", /* 16 */
- "pread", /* 17 */
- "pwrite", /* 18 */
+ "pread64", /* 17 */
+ "pwrite64", /* 18 */
"readv", /* 19 */
"writev", /* 20 */
"access", /* 21 */
@@ -233,8 +233,8 @@
"get_thread_area", /* 211 */
"lookup_dcookie", /* 212 */
"epoll_create", /* 213 */
- "epoll_ctl", /* 214 */
- "epoll_wait", /* 215 */
+ "epoll_ctl_old", /* 214 */
+ "epoll_wait_old", /* 215 */
"remap_file_pages", /* 216 */
"getdents64", /* 217 */
"set_tid_address", /* 218 */
@@ -331,3 +331,142 @@
"getcpu", /* 309 */
"process_vm_readv", /* 310 */
"process_vm_writev", /* 311 */
+ "kcmp", /* 312 */
+ "finit_module", /* 313 */
+ "sched_setattr", /* 314 */
+ "sched_getattr", /* 315 */
+ "renameat2", /* 316 */
+ "seccomp", /* 317 */
+ "getrandom", /* 318 */
+ "memfd_create", /* 319 */
+ "kexec_file_load", /* 320 */
+ "bpf", /* 321 */
+ "execveat", /* 322 */
+ "userfaultfd", /* 323 */
+ "membarrier", /* 324 */
+ "mlock2", /* 325 */
+ "copy_file_range", /* 326 */
+ "preadv2", /* 327 */
+ "pwritev2", /* 328 */
+ "pkey_mprotect", /* 329 */
+ "pkey_alloc", /* 330 */
+ "pkey_free", /* 331 */
+ "statx", /* 332 */
+ "io_pgetevents", /* 333 */
+ "rseq", /* 334 */
+ "335", /* 335 */
+ "336", /* 336 */
+ "337", /* 337 */
+ "338", /* 338 */
+ "339", /* 339 */
+ "340", /* 340 */
+ "341", /* 341 */
+ "342", /* 342 */
+ "343", /* 343 */
+ "344", /* 344 */
+ "345", /* 345 */
+ "346", /* 346 */
+ "347", /* 347 */
+ "348", /* 348 */
+ "349", /* 349 */
+ "350", /* 350 */
+ "351", /* 351 */
+ "352", /* 352 */
+ "353", /* 353 */
+ "354", /* 354 */
+ "355", /* 355 */
+ "356", /* 356 */
+ "357", /* 357 */
+ "358", /* 358 */
+ "359", /* 359 */
+ "360", /* 360 */
+ "361", /* 361 */
+ "362", /* 362 */
+ "363", /* 363 */
+ "364", /* 364 */
+ "365", /* 365 */
+ "366", /* 366 */
+ "367", /* 367 */
+ "368", /* 368 */
+ "369", /* 369 */
+ "370", /* 370 */
+ "371", /* 371 */
+ "372", /* 372 */
+ "373", /* 373 */
+ "374", /* 374 */
+ "375", /* 375 */
+ "376", /* 376 */
+ "377", /* 377 */
+ "378", /* 378 */
+ "379", /* 379 */
+ "380", /* 380 */
+ "381", /* 381 */
+ "382", /* 382 */
+ "383", /* 383 */
+ "384", /* 384 */
+ "385", /* 385 */
+ "386", /* 386 */
+ "387", /* 387 */
+ "388", /* 388 */
+ "389", /* 389 */
+ "390", /* 390 */
+ "391", /* 391 */
+ "392", /* 392 */
+ "393", /* 393 */
+ "394", /* 394 */
+ "395", /* 395 */
+ "396", /* 396 */
+ "397", /* 397 */
+ "398", /* 398 */
+ "399", /* 399 */
+ "400", /* 400 */
+ "401", /* 401 */
+ "402", /* 402 */
+ "403", /* 403 */
+ "404", /* 404 */
+ "405", /* 405 */
+ "406", /* 406 */
+ "407", /* 407 */
+ "408", /* 408 */
+ "409", /* 409 */
+ "410", /* 410 */
+ "411", /* 411 */
+ "412", /* 412 */
+ "413", /* 413 */
+ "414", /* 414 */
+ "415", /* 415 */
+ "416", /* 416 */
+ "417", /* 417 */
+ "418", /* 418 */
+ "419", /* 419 */
+ "420", /* 420 */
+ "421", /* 421 */
+ "422", /* 422 */
+ "423", /* 423 */
+ "pidfd_send_signal", /* 424 */
+ "io_uring_setup", /* 425 */
+ "io_uring_enter", /* 426 */
+ "io_uring_register", /* 427 */
+ "open_tree", /* 428 */
+ "move_mount", /* 429 */
+ "fsopen", /* 430 */
+ "fsconfig", /* 431 */
+ "fsmount", /* 432 */
+ "fspick", /* 433 */
+ "pidfd_open", /* 434 */
+ "clone3", /* 435 */
+ "close_range", /* 436 */
+ "openat2", /* 437 */
+ "pidfd_getfd", /* 438 */
+ "faccessat2", /* 439 */
+ "process_madvise", /* 440 */
+ "epoll_pwait2", /* 441 */
+ "mount_setattr", /* 442 */
+ "quotactl_fd", /* 443 */
+ "landlock_create_ruleset", /* 444 */
+ "landlock_add_rule", /* 445 */
+ "landlock_restrict_self", /* 446 */
+ "memfd_secret", /* 447 */
+ "process_mrelease", /* 448 */
+ "futex_waitv", /* 449 */
+ "set_mempolicy_home_node", /* 450 */

View file

@ -0,0 +1,13 @@
diff --git a/testsuite/ltrace.main/system_calls.exp b/testsuite/ltrace.main/system_calls.exp
index 1b64cb0..af19916 100644
--- a/testsuite/ltrace.main/system_calls.exp
+++ b/testsuite/ltrace.main/system_calls.exp
@@ -133,7 +133,7 @@ Match [Diff [Calls [ltraceRun -L -S -- $bin]] \
{ {^write$} == 1 }
{ {^unlink(at)?$} >= 2 }
{ {^open(at)?$} == 1 }
- { {^(new|f)?stat(64)?$} >= 1 }
+ { {^(new)?f?statx?(at)?(64)?$} >= 1 }
{ {^close$} == 1 }
{ {^getcwd$} == 1 }
{ {^chdir$} == 1 }