Emulation of some arm programs fail with "Assertion `have_guest_base' failed."
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Fix Released
|
Undecided
|
Alex Bennée |
Bug Description
This issue is observer with QEMU ToT, checked out around May 15th (but I believe it is present in current master too), and wasn't present in QEMU v5.0.0.
I am using 32-bit Intel(R) Pentium(R) M processor 1.73GHz host.
Arm cross-compiler is a standard cross-compiler that comes with Debian-based distributions, and gcc version is:
$ arm-linux-
arm-linux-
Compile this program with cross compiler:
$ arm-linux-
Emulation with QEMU v5.0.0 is correct, and gives expected output:
$ ~/Build/
CONTROL RESULT: (toupper_string)
nwlrbbmqbhcdarz owkkyhiddqscdxr jmowfrxsjybldbe fsarcbynecdyggx xpklorellnmpapq
NWLRBBMQBHCDARZ OWKKYHIDDQSCDXR JMOWFRXSJYBLDBE FSARCBYNECDYGGX XPKLORELLNMPAPQ
While, in case of QEMU master it fails:
$ ~/Build/
qemu-arm: /home/rtrk/
Aborted
There are many other programs that exibit the same behavior. The failure is arm-sprecific.
-------
source code: (let's call this file toupper_string.c) (similar file is also in attachment)
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#define MAX_STRING_LENGHT 15
#define NUMBER_
#define DEFAULT_
#define MAX_NUMBER_
#define NUMBER_
/* Structure for keeping an array of strings */
struct StringStruct {
char chars[MAX_
};
/**
* Sets characters of the given string to random small letters a-z.
* @param s String to get random characters.
* @len Length of the input string.
*/
static void gen_random_
{
static const char letters[] = "abcdefghijklmn
for (size_t i = 0; i < len; i++) {
chars[i] = letters[rand() % (sizeof(letters) - 1)];
}
chars[len] = 0;
}
void main (int argc, char* argv[])
{
struct StringStruct random_
struct StringStruct strings_
int32_t number_
int32_t option;
/* Parse command line options */
while ((option = getopt(argc, argv, "n:")) != -1) {
if (option == 'n') {
int32_t user_number_
/* Check if the value is a negative number */
if (user_number_
}
/* Check if the value is a string or zero */
if (user_number_
}
/* Check if the value is too large */
if (user_number_
}
} else {
}
}
/* Create an array of strings with random content */
srand(1);
for (size_t i = 0; i < NUMBER_
}
/* Perform uppercasing of a set of random strings multiple times */
for (size_t j = 0; j < number_
/* Copy initial set of random strings to the set to be uppercased */
/* Do actual changing case to uppercase */
for (size_t i = 0; i < NUMBER_
int k = 0;
while (strings_
}
}
}
/* Control printing */
printf("CONTROL RESULT: (toupper_
for (size_t i = 0; i < NUMBER_
printf(" %s", random_
}
printf("\n");
for (size_t i = 0; i < NUMBER_
printf(" %s", strings_
}
printf("\n");
}
tags: | added: testcase |
Changed in qemu: | |
status: | New → Confirmed |
assignee: | nobody → Alex Bennée (ajbennee) |
Aleksandar Markovic <email address hidden> writes:
> Public bug reported: gnueabi- gcc --version gnueabi- gcc (Debian 8.3.0-2) 8.3.0 gnueabi- gcc -O2 -static toupper_string.c -o toupper_string- qemu-5. 0.0/build- gcc/arm- linux-user/ qemu-arm ./toupper_ string- arm qemu-master/ build-gcc/ arm-linux- user/qemu- arm ./toupper_ string- arm Build/qemu- master/ linux-user/ elfload. c:2294: probe_guest_base: Assertion `have_guest_base' failed.
>
> This issue is observer with QEMU ToT, checked out around May 15th (but I
> believe it is present in current master too), and wasn't present in QEMU
> v5.0.0.
>
> I am using 32-bit Intel(R) Pentium(R) M processor 1.73GHz host.
>
> Arm cross-compiler is a standard cross-compiler that comes with Debian-
> based distributions, and gcc version is:
>
> $ arm-linux-
> arm-linux-
>
> Compile this program with cross compiler:
>
> $ arm-linux-
> arm
>
> Emulation with QEMU v5.0.0 is correct, and gives expected output:
>
> $ ~/Build/
> CONTROL RESULT: (toupper_string)
> nwlrbbmqbhcdarz owkkyhiddqscdxr jmowfrxsjybldbe fsarcbynecdyggx xpklorellnmpapq
> NWLRBBMQBHCDARZ OWKKYHIDDQSCDXR JMOWFRXSJYBLDBE FSARCBYNECDYGGX XPKLORELLNMPAPQ
>
> While, in case of QEMU master it fails:
>
> $ ~/Build/
> qemu-arm: /home/rtrk/
> Aborted
<snip>
Works for me in our TCG tests on master:
20:15:43 [alex@zen: ~/l/q/b/ user.static] review/ aarch64- vms-v7| … + ./arm-linux- user/qemu- arm ./tests/ tcg/arm- linux-user/ toupper
CONTROL RESULT: (toupper_string)
nwlrbbmqbhcdarz owkkyhiddqscdxr jmowfrxsjybldbe fsarcbynecdyggx xpklorellnmpapq
NWLRBBMQBHCDARZ OWKKYHIDDQSCDXR JMOWFRXSJYBLDBE FSARCBYNECDYGGX XPKLORELLNMPAPQ
I have submitted a fix to the list that affected programs that couldn't
see /proc/self/maps but I guess that isn't the case here.
--
Alex Bennée