From b190a780c0cad4497189e4a7cffcc67f1c339a2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kadl=C4=8D=C3=ADk?= Date: Wed, 19 May 2021 13:16:01 +0200 Subject: [PATCH] Import RHEL's regression test for #890961 --- .../Makefile | 64 +++++++++++++++++++ .../PURPOSE | 5 ++ .../ksh_bug.ksh | 8 +++ .../main.fmf | 18 ++++++ .../runtest.sh | 58 +++++++++++++++++ 5 files changed, 153 insertions(+) create mode 100644 tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/Makefile create mode 100644 tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/PURPOSE create mode 100644 tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/ksh_bug.ksh create mode 100644 tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/main.fmf create mode 100755 tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/runtest.sh diff --git a/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/Makefile b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/Makefile new file mode 100644 index 0000000..5e95fda --- /dev/null +++ b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/Makefile @@ -0,0 +1,64 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due +# Description: Test for BZ#890961 ([RHEL 5] ltrace crashes with memory corruption due) +# Author: Miroslav Franc +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE ksh_bug.ksh + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Miroslav Franc " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test for BZ#890961 ([RHEL 5] ltrace crashes with memory corruption due)" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: ltrace" >> $(METADATA) + @echo "Requires: ltrace ksh ltrace-debuginfo" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 890961" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/PURPOSE b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/PURPOSE new file mode 100644 index 0000000..d1ca455 --- /dev/null +++ b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/PURPOSE @@ -0,0 +1,5 @@ +PURPOSE of /tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due +Description: Test for BZ#890961 ([RHEL 5] ltrace crashes with memory corruption due) +Author: Miroslav Franc +Bug summary: [RHEL 5] ltrace crashes with memory corruption due to double free() +Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=890961 diff --git a/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/ksh_bug.ksh b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/ksh_bug.ksh new file mode 100644 index 0000000..09f2bf7 --- /dev/null +++ b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/ksh_bug.ksh @@ -0,0 +1,8 @@ +#!/usr/bin/env ksh +# from bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=890961 + +echo "Before processing a subshell" + +NUMFILES=$(ls | wc -l) + +echo "After processing a subshell" diff --git a/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/main.fmf b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/main.fmf new file mode 100644 index 0000000..4e0962f --- /dev/null +++ b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/main.fmf @@ -0,0 +1,18 @@ +summary: Test for BZ#890961 ([RHEL 5] ltrace crashes with memory corruption due) +description: | + Bug summary: [RHEL 5] ltrace crashes with memory corruption due to double free() + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=890961 +contact: Miroslav Franc +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +- ksh +- ltrace-debuginfo +duration: 5m +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=890961 +extra-summary: /tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due +extra-task: /tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due diff --git a/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/runtest.sh b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/runtest.sh new file mode 100755 index 0000000..5cc8819 --- /dev/null +++ b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/runtest.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due +# Description: Test for BZ#890961 ([RHEL 5] ltrace crashes with memory corruption due) +# Author: Miroslav Franc +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="$(rpm -qf $(which ltrace))" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlAssertRpm ksh + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "cp ksh_bug.ksh $TmpDir" + rlRun "pushd $TmpDir" + rlPhaseEnd + + for ((i=0; i<10; ++i)); do + rlPhaseStartTest "test... $i" + rlRun "LIBC_FATAL_STDERR_=1 ltrace -f -o ./ltrace.out ksh ./ksh_bug.ksh 2> log.err > log.out" + rlAssertNotGrep 'glibc detected' log.err + rlRun "[[ $(wc -l