testing/memdump: new aport

http://www.porcupine.org/forensics/tct.html
utility to dump memory contents to standard output
This commit is contained in:
Niklas Cathor 2020-04-08 15:26:05 +02:00 committed by Rasmus Thomsen
parent 2edb15dec9
commit b58feaab7a
7 changed files with 186 additions and 0 deletions

View File

@ -0,0 +1,16 @@
Description: Fixing FTBFS on Debian GNU/Hurd (Closes: #532390).
Author: Barry deFreese <bdefreese@debian.org>
Last-Update: 2009-06-08
Index: memdump/makedefs
===================================================================
--- memdump.orig/makedefs
+++ memdump/makedefs
@@ -34,6 +34,8 @@ SunOS.5.[0-5]*) DEFS="-DSUNOS5 -DUSE_PRE
;;
Linux.2*) DEFS="-DLINUX2"
;;
+ GNU*) DEFS="-DLINUX2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+ ;;
*) echo unsupported system: $SYSTEM.$RELEASE 1>&2; exit 1
;;
esac

View File

@ -0,0 +1,30 @@
Description: Support all Linux versions
The Makefile defines different compile time options depending on the
current kernel version. When written, the 2.4 kernel was special
cased as a very recent kernel. Now it should be really handled as
the default case... and the old default case for pre-2.4 kernel
can be dropped.
.
This is what this patch does. Since upstream is dead, this patch
can't be forwarded anywhere.
Author: Raphaël Hertzog <hertzog@debian.org>
Origin: vendor
Forwarded: not-needed
Last-Update: 2015-07-28
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: memdump/makedefs
===================================================================
--- memdump.orig/makedefs
+++ memdump/makedefs
@@ -30,9 +30,7 @@ SunOS.5.[0-5]*) DEFS="-DSUNOS5 -DUSE_PRE
SunOS.5*) DEFS="-DSUNOS5 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
RANLIB=":"
;;
- Linux.2.4*) DEFS="-DLINUX2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
- ;;
- Linux.2*) DEFS="-DLINUX2"
+ Linux.*) DEFS="-DLINUX2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
;;
GNU*) DEFS="-DLINUX2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
;;

View File

@ -0,0 +1,48 @@
Description: Support build flags injection
Proper support of LDFLAGS / CFLAGS / CPPFLAGS is required so
that dpkg-buildflags can inject supplementary build options.
Author: Raphaël Hertzog <hertzog@debian.org>
Origin: vendor
Last-Update: 2015-07-28
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: memdump/Makefile
===================================================================
--- memdump.orig/Makefile
+++ memdump/Makefile
@@ -1,9 +1,13 @@
SHELL = /bin/sh
-CC = gcc -Wformat -Wunused
+CC = gcc
OPT = -O
DEBUG = -g
PROGS = memdump
-CFLAGS = $(OPT) $(DEBUG) -I. $(XFLAGS) $(DEFS)
+ifneq ($(DEFS),)
+# Only complete variables once when we're called with make DEFS="something"
+CPPFLAGS += -I. $(DEFS)
+CFLAGS += -Wall -Wno-comment
+endif
OBJS = memdump.o convert_size.o error.o mymalloc.o
PROGS = memdump
MAN = memdump.1
@@ -16,7 +20,7 @@ all: $(PROGS)
manpages: $(MAN)
memdump: $(OBJS)
- $(CC) $(CFLAGS) -o $@ $(OBJS) $(SYSLIBS)
+ $(CC) $(LDFLAGS) -o $@ $(OBJS) $(SYSLIBS)
memdump.1: memdump.c
srctoman $? >$@
Index: memdump/makedefs
===================================================================
--- memdump.orig/makedefs
+++ memdump/makedefs
@@ -40,5 +40,5 @@ esac
unset MAKELEVEL # shut up chatty GNU make
-make DEFS="$DEFS" CC="${CC-gcc -Wunused}" RANLIB="${RANLIB-ranlib}" \
+make DEFS="$DEFS" CC="${CC-gcc}" RANLIB="${RANLIB-ranlib}" \
AR="${AR-ar rv}" SYSLIBS="$SYSLIBS" all

View File

@ -0,0 +1,13 @@
Description: moved manpage from level 1 to 8 because memdump is inside /usr/sbin.
Author: Joao Eriberto Mota Filho <eriberto@debian.org>
Last-Update: 2018-11-27
Index: memdump/memdump.1
===================================================================
--- memdump.orig/memdump.1
+++ memdump/memdump.1
@@ -1,4 +1,4 @@
-.TH MEMDUMP 1
+.TH MEMDUMP 8
.ad
.fi
.SH NAME

View File

@ -0,0 +1,17 @@
Description: fix manpage, changing -d by -s. Thanks to Andrew Kvalheim.
Author: Joao Eriberto Mota Filho <eriberto@debian.org>
Bug-Ubuntu: https://launchpad.net/bugs/784353
Last-Update: 2018-11-27
Index: memdump/memdump.1
===================================================================
--- memdump.orig/memdump.1
+++ memdump/memdump.1
@@ -52,7 +52,7 @@ uses the \fIpage_size\fR value.
.sp
Warning: a too large read buffer size causes memory to be missed on
FreeBSD or Solaris.
-.IP "\fB-d \fIdump-size\fR (default: 0)"
+.IP "\fB-s \fIdump-size\fR (default: 0)"
Number of memory bytes to dump. By default, the program runs
until the memory device reports an end-of-file (Linux), or until
it has dumped from \fB/dev/mem\fR as much memory as reported present

View File

@ -0,0 +1,23 @@
Description: Fall back to default /dev/(k)mem on linux
Some C libraries (e.g. musl c) don't set _PATH_MEM or _PATH_KMEM
in <paths.h>. If it is not set after including that file, fall
back to /dev/mem and /dev/kmem respectively.
Author: Niklas Cathor <niklas.cathor@gmx.de>
Last-Update: 2020-04-08
Index: memdump/memdump.c
===================================================================
--- memdump/memdump.c.orig
+++ memdump/memdump.c
@@ -121,6 +121,12 @@
#ifdef LINUX2
#include <paths.h>
#define GETPAGESIZE getpagesize
+
+#ifndef _PATH_MEM
+#define _PATH_MEM "/dev/mem"
+#define _PATH_KMEM "/dev/kmem"
+#endif
+
#define SUPPORTED
#endif

39
testing/memdump/APKBUILD Normal file
View File

@ -0,0 +1,39 @@
# Maintainer: Niklas Cathor <niklas.cathor@gmx.de>
pkgname=memdump
pkgver=1.01
pkgrel=0
pkgdesc="utility to dump memory contents to standard output"
url="http://www.porcupine.org/forensics/tct.html"
arch="all"
license="IPL-1.0"
options="!check" # No test suite
subpackages="$pkgname-doc"
# Patches 01-05 are taken from Debian (https://salsa.debian.org/pkg-security-team/memdump/)
# Patch 06 is necessary because musl-dev's "paths.h" does not set _PATH_MEM / _PATH_KMEM.
source="
memdump-$pkgver.tar.gz::http://www.porcupine.org/forensics/memdump-$pkgver.tar.gz
01-hurd.patch
02-linux3.patch
03-build-flags-support.patch
04-change-manpage-level.patch
05-fix-option-manpage.patch
06-fall-back-to-default-dev-mem.patch
"
build() {
make
}
package() {
install -Dm755 memdump "$pkgdir"/usr/sbin/memdump
install -Dm644 memdump.1 "$pkgdir"/usr/share/doc/$pkgname
}
sha512sums="46d013f812b0a5807c7ba38d6c3940e105057ba8e64b4f45b75a0800cab212d164caf881efbc1958d5c5c239236fdcb61f6fe093886ff3e28bc0b70791aaee3e memdump-1.01.tar.gz
1f8787875a9e63de99f36fda9d8924a441f9167b13dae244f5fc71f977a5b3e764857d81cbaf1e3af43ca06686d8679371792306f09f5469f1d0f9948a38a92f 01-hurd.patch
fd79b0ad42b2645990b5dab498f30e122894e91414b40604da9a4da58e77ebf1389374a234f70006e2004ebc348607d04146d95be00e174108550644984faa83 02-linux3.patch
7c0506f2487b26da977f411361ad750fbb75bc68a0e1cd54a811379ea7eee2ca41a15e9c4f7169810c2ec0757bfd22020fc6b4cd6b2655814b13ea7889f6a5e1 03-build-flags-support.patch
11c6b2472a3046767b12f0506e62459dcb7ad83880807f004228f3f1025300a370706717caaa3bf3995ca2f9c985d6bb3d605a3407d9fd1b9be8157b8e0df3d6 04-change-manpage-level.patch
0fac725f948080632ad169a4923253cf63d06098181dea5b0eda3828dc50dab15cea7b9c08008029732db2c68e5f78cfa93096c0cf978be962be095535c33a93 05-fix-option-manpage.patch
24b9fe0af8216cc2fb347820d8b999e30c321d0b398d0b603962158986af98156845ceb9717798622983d5dd9cfcc3509a51089c3139ee8e5fef857144dd0545 06-fall-back-to-default-dev-mem.patch"