From patchwork Thu Apr 23 17:05:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185730 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2294288ilf; Thu, 23 Apr 2020 10:06:54 -0700 (PDT) X-Google-Smtp-Source: APiQypLNiS74cKnzhKRoc+tjPSbmk/PibEYy3gsyc/+SXCeZr27DXUVYAoJM0d5WzFY907SGltCT X-Received: by 2002:a37:a090:: with SMTP id j138mr4801824qke.168.1587661614697; Thu, 23 Apr 2020 10:06:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587661614; cv=none; d=google.com; s=arc-20160816; b=vTvcnHU5yKPDvR6njOwDmNHzwEfShZxfJxpqfOYOSp+ohTDatNt4SxlCDLhXFIZ9sg WgTEgdq2a4sVghOFWgDnoacOJ5dcHdbFWHFxrZZR/gofXtqK9p4wATf3urggKvi8Tx7I BqWRlSQ/ltJ4woI7UbBgW59gqaVAPhZGw26zFBcoZp6WhDK8q/zLJ1YheiZSlCMTUUCZ kWrG2vRKX4rzrUCLOuFjfbQaMVGpMDJSG6ygZ5Ace8FU3PSjt5MFjUMmWwnM9VRwoQjT /JxARYbL+XF0s1FviNvCRnG+QGGwQ2yV6NJ0z7J5CCGbPbAdfMCzcsyH3E7IDdPhldQQ JbRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=R+sf6X8cAIIXCbMbS10GOsmkzI4QGsf9SG4MZf79bWg=; b=WojL+lClfs2xqxULuGjmnbY5mAj62hGVbwxYTBvguyJCEiqxBDdXzMMQ//b1I6zsmy cIwOxgth3tKQtrFASxlux4kB2dW6p6f27cEXPVei5rlGgx19U+4OgYLO6+Xmv1rVwm7a A04MxVwgLjaQkX+WDkxARgebLr6KZoIKXQznYSgdJaQ74A1jQpELfso2+RUDgNvQH3dU jWRDSwlIBihLdQpqcYYgDlVL8NmxRa8mdwwUZXqR1YDveOyJ2lSsTfxxkhow5Vkc3zpl KRhb7QLH4K3TTgDXz+jgUeBjnSOJhKmWyjdHu+1t7EDA4kJdiejBGuGBYnVNtnkkIdlp M8zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rF9IDs2f; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id em8si1853854qvb.197.2020.04.23.10.06.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Apr 2020 10:06:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rF9IDs2f; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfJO-0000xM-0M for patch@linaro.org; Thu, 23 Apr 2020 13:06:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44554) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfIb-0000wC-AU for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRfIZ-0005RS-Bu for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:04 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:39432) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRfIY-0005Ql-Tv for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:03 -0400 Received: by mail-wm1-x329.google.com with SMTP id y24so7351266wma.4 for ; Thu, 23 Apr 2020 10:06:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R+sf6X8cAIIXCbMbS10GOsmkzI4QGsf9SG4MZf79bWg=; b=rF9IDs2f0ueUorGw6bRws4/M/I4wXhpx+PRzZpMMMy0vrCY9XStuOaIWooAL5qHc5q PHdKCGTQpVNj2OGs8cxSBqQLI7BmxVLcaMUTjPfhS0Haz/5VYWA1qqqeL85ubaVn4kbw cSgENATgUUKx5dWGc2jButxMs+rKyRj7PwgVstSBpyTdbMTsb7FYvYs7VgZCtlruixLN YMpv9ppLMeho+CAwYm5DEKtm/RoFkTwu6NSA/CtuG2c/WtlgCBkSZO+4yQ7z7HzmK0Kt cm5ssw3Vok7wdiDpYTy/NQaZ8IgnZufiz1HydOse/FtNCnKXmsnJNHaImW3LGYAnP3t/ w06g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R+sf6X8cAIIXCbMbS10GOsmkzI4QGsf9SG4MZf79bWg=; b=fPScEFM/Q0I86xZcFQ2e+FikxuWZUXPa8lp/9VslAZqA9lxUG6dGviuJneRVJyNe2V clnJ9jPr0nMxUv009FNh0Q7puSFUC48rsBbnvsvfew9oiRkhl6YMiLoVWY90vvL4Qrdl FHMpntgvqWYVRyX6gKr8gNuQnDaLB6U5uIL8iNoMic9MPkztn71JvjDkwiHv+XhGWhmO lmn4n8A8QS11BLQ+ZgHrAroBKff0jRu6GBBDVeE7lt9Ss0Al4nMj4plU02XgyKs39F7G 4BP9RMCaQ5o8siwjyKW8hYYcr9tfK0nH+PREU+u/Ik36Y8z+d6oimW9YO8ItRIkILlv6 C4uA== X-Gm-Message-State: AGi0PuZ+aHvuokLyftDIWGwyzPdWyFVa2rGeOJUil9sFjtxzQ5LdqoyD V2vyFQXJ70Z8IvHrDAi2mAUcIw== X-Received: by 2002:a05:600c:2903:: with SMTP id i3mr5126928wmd.65.1587661560836; Thu, 23 Apr 2020 10:06:00 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id a187sm4627447wmh.40.2020.04.23.10.05.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 10:05:58 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 5A7381FF87; Thu, 23 Apr 2020 18:05:57 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 01/14] linux-user: completely re-write init_guest_space Date: Thu, 23 Apr 2020 18:05:44 +0100 Message-Id: <20200423170557.31106-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200423170557.31106-1-alex.bennee@linaro.org> References: <20200423170557.31106-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x329.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::329 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" First we ensure all guest space initialisation logic comes through probe_guest_base once we understand the nature of the binary we are loading. The convoluted init_guest_space routine is removed and replaced with a number of pgb_* helpers which are called depending on what requirements we have when loading the binary. We first try to do what is requested by the host. Failing that we try and satisfy the guest requested base address. If all those options fail we fall back to finding a space in the memory map using our recently written read_self_maps() helper. There are some additional complications we try and take into account when looking for holes in the address space. We try not to go directly after the system brk() space so there is space for a little growth. We also don't want to have to use negative offsets which would result in slightly less efficient code on x86 when it's unable to use the segment offset register. Less mind-binding gotos and hopefully clearer logic throughout. Signed-off-by: Alex Bennée --- v3 - include rth updates that - split probe_guest_base into multiple functions - more heuristics on gap finding v4 - whitespace fix --- linux-user/qemu.h | 31 ++- linux-user/elfload.c | 503 +++++++++++++++++++++--------------------- linux-user/flatload.c | 6 + linux-user/main.c | 23 +- 4 files changed, 277 insertions(+), 286 deletions(-) -- 2.20.1 diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 792c74290f..ce902f5132 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -219,18 +219,27 @@ void init_qemu_uname_release(void); void fork_start(void); void fork_end(int child); -/* Creates the initial guest address space in the host memory space using - * the given host start address hint and size. The guest_start parameter - * specifies the start address of the guest space. guest_base will be the - * difference between the host start address computed by this function and - * guest_start. If fixed is specified, then the mapped address space must - * start at host_start. The real start address of the mapped memory space is - * returned or -1 if there was an error. +/** + * probe_guest_base: + * @image_name: the executable being loaded + * @loaddr: the lowest fixed address in the executable + * @hiaddr: the highest fixed address in the executable + * + * Creates the initial guest address space in the host memory space. + * + * If @loaddr == 0, then no address in the executable is fixed, + * i.e. it is fully relocatable. In that case @hiaddr is the size + * of the executable. + * + * This function will not return if a valid value for guest_base + * cannot be chosen. On return, the executable loader can expect + * + * target_mmap(loaddr, hiaddr - loaddr, ...) + * + * to succeed. */ -unsigned long init_guest_space(unsigned long host_start, - unsigned long host_size, - unsigned long guest_start, - bool fixed); +void probe_guest_base(const char *image_name, + abi_ulong loaddr, abi_ulong hiaddr); #include "qemu/log.h" diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 619c054cc4..01a9323a63 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -11,6 +11,7 @@ #include "qemu/queue.h" #include "qemu/guest-random.h" #include "qemu/units.h" +#include "qemu/selfmap.h" #ifdef _ARCH_PPC64 #undef ARCH_DLINFO @@ -382,68 +383,30 @@ enum { /* The commpage only exists for 32 bit kernels */ -/* Return 1 if the proposed guest space is suitable for the guest. - * Return 0 if the proposed guest space isn't suitable, but another - * address space should be tried. - * Return -1 if there is no way the proposed guest space can be - * valid regardless of the base. - * The guest code may leave a page mapped and populate it if the - * address is suitable. - */ -static int init_guest_commpage(unsigned long guest_base, - unsigned long guest_size) -{ - unsigned long real_start, test_page_addr; - - /* We need to check that we can force a fault on access to the - * commpage at 0xffff0fxx - */ - test_page_addr = guest_base + (0xffff0f00 & qemu_host_page_mask); - - /* If the commpage lies within the already allocated guest space, - * then there is no way we can allocate it. - * - * You may be thinking that that this check is redundant because - * we already validated the guest size against MAX_RESERVED_VA; - * but if qemu_host_page_mask is unusually large, then - * test_page_addr may be lower. - */ - if (test_page_addr >= guest_base - && test_page_addr < (guest_base + guest_size)) { - return -1; - } +#define ARM_COMMPAGE (intptr_t)0xffff0f00u - /* Note it needs to be writeable to let us initialise it */ - real_start = (unsigned long) - mmap((void *)test_page_addr, qemu_host_page_size, - PROT_READ | PROT_WRITE, - MAP_ANONYMOUS | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); +static bool init_guest_commpage(void) +{ + void *want = g2h(ARM_COMMPAGE & -qemu_host_page_size); + void *addr = mmap(want, qemu_host_page_size, PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); - /* If we can't map it then try another address */ - if (real_start == -1ul) { - return 0; + if (addr == MAP_FAILED) { + perror("Allocating guest commpage"); + exit(EXIT_FAILURE); } - - if (real_start != test_page_addr) { - /* OS didn't put the page where we asked - unmap and reject */ - munmap((void *)real_start, qemu_host_page_size); - return 0; + if (addr != want) { + return false; } - /* Leave the page mapped - * Populate it (mmap should have left it all 0'd) - */ - - /* Kernel helper versions */ - __put_user(5, (uint32_t *)g2h(0xffff0ffcul)); + /* Set kernel helper versions; rest of page is 0. */ + __put_user(5, (uint32_t *)g2h(0xffff0ffcu)); - /* Now it's populated make it RO */ - if (mprotect((void *)test_page_addr, qemu_host_page_size, PROT_READ)) { + if (mprotect(addr, qemu_host_page_size, PROT_READ)) { perror("Protecting guest commpage"); - exit(-1); + exit(EXIT_FAILURE); } - - return 1; /* All good */ + return true; } #define ELF_HWCAP get_elf_hwcap() @@ -2075,239 +2038,267 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, return sp; } -unsigned long init_guest_space(unsigned long host_start, - unsigned long host_size, - unsigned long guest_start, - bool fixed) -{ - /* In order to use host shmat, we must be able to honor SHMLBA. */ - unsigned long align = MAX(SHMLBA, qemu_host_page_size); - unsigned long current_start, aligned_start; - int flags; - - assert(host_start || host_size); - - /* If just a starting address is given, then just verify that - * address. */ - if (host_start && !host_size) { -#if defined(TARGET_ARM) && !defined(TARGET_AARCH64) - if (init_guest_commpage(host_start, host_size) != 1) { - return (unsigned long)-1; - } +#ifndef ARM_COMMPAGE +#define ARM_COMMPAGE 0 +#define init_guest_commpage() true #endif - return host_start; - } - /* Setup the initial flags and start address. */ - current_start = host_start & -align; - flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE; - if (fixed) { - flags |= MAP_FIXED; - } +static void pgb_fail_in_use(const char *image_name) +{ + error_report("%s: requires virtual address space that is in use " + "(omit the -B option or choose a different value)", + image_name); + exit(EXIT_FAILURE); +} - /* Otherwise, a non-zero size region of memory needs to be mapped - * and validated. */ +static void pgb_have_guest_base(const char *image_name, abi_ulong guest_loaddr, + abi_ulong guest_hiaddr, long align) +{ + const int flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE; + void *addr, *test; -#if defined(TARGET_ARM) && !defined(TARGET_AARCH64) - /* On 32-bit ARM, we need to map not just the usable memory, but - * also the commpage. Try to find a suitable place by allocating - * a big chunk for all of it. If host_start, then the naive - * strategy probably does good enough. - */ - if (!host_start) { - unsigned long guest_full_size, host_full_size, real_start; - - guest_full_size = - (0xffff0f00 & qemu_host_page_mask) + qemu_host_page_size; - host_full_size = guest_full_size - guest_start; - real_start = (unsigned long) - mmap(NULL, host_full_size, PROT_NONE, flags, -1, 0); - if (real_start == (unsigned long)-1) { - if (host_size < host_full_size - qemu_host_page_size) { - /* We failed to map a continous segment, but we're - * allowed to have a gap between the usable memory and - * the commpage where other things can be mapped. - * This sparseness gives us more flexibility to find - * an address range. - */ - goto naive; - } - return (unsigned long)-1; + if (!QEMU_IS_ALIGNED(guest_base, align)) { + fprintf(stderr, "Requested guest base 0x%lx does not satisfy " + "host minimum alignment (0x%lx)\n", + guest_base, align); + exit(EXIT_FAILURE); + } + + /* Sanity check the guest binary. */ + if (reserved_va) { + if (guest_hiaddr > reserved_va) { + error_report("%s: requires more than reserved virtual " + "address space (0x%" PRIx64 " > 0x%lx)", + image_name, (uint64_t)guest_hiaddr, reserved_va); + exit(EXIT_FAILURE); } - munmap((void *)real_start, host_full_size); - if (real_start & (align - 1)) { - /* The same thing again, but with extra - * so that we can shift around alignment. - */ - unsigned long real_size = host_full_size + qemu_host_page_size; - real_start = (unsigned long) - mmap(NULL, real_size, PROT_NONE, flags, -1, 0); - if (real_start == (unsigned long)-1) { - if (host_size < host_full_size - qemu_host_page_size) { - goto naive; - } - return (unsigned long)-1; - } - munmap((void *)real_start, real_size); - real_start = ROUND_UP(real_start, align); + } else { + if ((guest_hiaddr - guest_base) > ~(uintptr_t)0) { + error_report("%s: requires more virtual address space " + "than the host can provide (0x%" PRIx64 ")", + image_name, (uint64_t)guest_hiaddr - guest_base); + exit(EXIT_FAILURE); } - current_start = real_start; } - naive: -#endif - while (1) { - unsigned long real_start, real_size, aligned_size; - aligned_size = real_size = host_size; + /* + * Expand the allocation to the entire reserved_va. + * Exclude the mmap_min_addr hole. + */ + if (reserved_va) { + guest_loaddr = (guest_base >= mmap_min_addr ? 0 + : mmap_min_addr - guest_base); + guest_hiaddr = reserved_va; + } - /* Do not use mmap_find_vma here because that is limited to the - * guest address space. We are going to make the - * guest address space fit whatever we're given. - */ - real_start = (unsigned long) - mmap((void *)current_start, host_size, PROT_NONE, flags, -1, 0); - if (real_start == (unsigned long)-1) { - return (unsigned long)-1; - } + /* Reserve the address space for the binary, or reserved_va. */ + test = g2h(guest_loaddr); + addr = mmap(test, guest_hiaddr - guest_loaddr, PROT_NONE, flags, -1, 0); + if (test != addr) { + pgb_fail_in_use(image_name); + } +} - /* Check to see if the address is valid. */ - if (host_start && real_start != current_start) { - qemu_log_mask(CPU_LOG_PAGE, "invalid %lx && %lx != %lx\n", - host_start, real_start, current_start); - goto try_again; +/* Return value for guest_base, or -1 if no hole found. */ +static uintptr_t pgb_find_hole(uintptr_t guest_loaddr, uintptr_t guest_size, + long align) +{ + GSList *maps, *iter; + uintptr_t this_start, this_end, next_start, brk; + intptr_t ret = -1; + + assert(QEMU_IS_ALIGNED(guest_loaddr, align)); + + maps = read_self_maps(); + + /* Read brk after we've read the maps, which will malloc. */ + brk = (uintptr_t)sbrk(0); + + /* The first hole is before the first map entry. */ + this_start = mmap_min_addr; + + for (iter = maps; iter; + this_start = next_start, iter = g_slist_next(iter)) { + uintptr_t align_start, hole_size; + + this_end = ((MapInfo *)iter->data)->start; + next_start = ((MapInfo *)iter->data)->end; + align_start = ROUND_UP(this_start, align); + + /* Skip holes that are too small. */ + if (align_start >= this_end) { + continue; + } + hole_size = this_end - align_start; + if (hole_size < guest_size) { + continue; } - /* Ensure the address is properly aligned. */ - if (real_start & (align - 1)) { - /* Ideally, we adjust like - * - * pages: [ ][ ][ ][ ][ ] - * old: [ real ] - * [ aligned ] - * new: [ real ] - * [ aligned ] - * - * But if there is something else mapped right after it, - * then obviously it won't have room to grow, and the - * kernel will put the new larger real someplace else with - * unknown alignment (if we made it to here, then - * fixed=false). Which is why we grow real by a full page - * size, instead of by part of one; so that even if we get - * moved, we can still guarantee alignment. But this does - * mean that there is a padding of < 1 page both before - * and after the aligned range; the "after" could could - * cause problems for ARM emulation where it could butt in - * to where we need to put the commpage. - */ - munmap((void *)real_start, host_size); - real_size = aligned_size + align; - real_start = (unsigned long) - mmap((void *)real_start, real_size, PROT_NONE, flags, -1, 0); - if (real_start == (unsigned long)-1) { - return (unsigned long)-1; + /* If this hole contains brk, give ourselves some room to grow. */ + if (this_start <= brk && brk < this_end) { + hole_size -= guest_size; + if (sizeof(uintptr_t) == 8 && hole_size >= 1 * GiB) { + align_start += 1 * GiB; + } else if (hole_size >= 16 * MiB) { + align_start += 16 * MiB; + } else { + align_start = (this_end - guest_size) & -align; + if (align_start < this_start) { + continue; + } } - aligned_start = ROUND_UP(real_start, align); - } else { - aligned_start = real_start; } -#if defined(TARGET_ARM) && !defined(TARGET_AARCH64) - /* On 32-bit ARM, we need to also be able to map the commpage. */ - int valid = init_guest_commpage(aligned_start - guest_start, - aligned_size + guest_start); - if (valid == -1) { - munmap((void *)real_start, real_size); - return (unsigned long)-1; - } else if (valid == 0) { - goto try_again; + /* Record the lowest successful match. */ + if (ret < 0) { + ret = align_start - guest_loaddr; } -#endif - - /* If nothing has said `return -1` or `goto try_again` yet, - * then the address we have is good. - */ - break; - - try_again: - /* That address didn't work. Unmap and try a different one. - * The address the host picked because is typically right at - * the top of the host address space and leaves the guest with - * no usable address space. Resort to a linear search. We - * already compensated for mmap_min_addr, so this should not - * happen often. Probably means we got unlucky and host - * address space randomization put a shared library somewhere - * inconvenient. - * - * This is probably a good strategy if host_start, but is - * probably a bad strategy if not, which means we got here - * because of trouble with ARM commpage setup. - */ - if (munmap((void *)real_start, real_size) != 0) { - error_report("%s: failed to unmap %lx:%lx (%s)", __func__, - real_start, real_size, strerror(errno)); - abort(); + /* If this hole contains the identity map, select it. */ + if (align_start <= guest_loaddr && + guest_loaddr + guest_size <= this_end) { + ret = 0; } - current_start += align; - if (host_start == current_start) { - /* Theoretically possible if host doesn't have any suitably - * aligned areas. Normally the first mmap will fail. - */ - return (unsigned long)-1; + /* If this hole ends above the identity map, stop looking. */ + if (this_end >= guest_loaddr) { + break; } } + free_self_maps(maps); - qemu_log_mask(CPU_LOG_PAGE, "Reserved 0x%lx bytes of guest address space\n", host_size); - - return aligned_start; + return ret; } -static void probe_guest_base(const char *image_name, - abi_ulong loaddr, abi_ulong hiaddr) +static void pgb_static(const char *image_name, abi_ulong orig_loaddr, + abi_ulong orig_hiaddr, long align) { - /* Probe for a suitable guest base address, if the user has not set - * it explicitly, and set guest_base appropriately. - * In case of error we will print a suitable message and exit. - */ - const char *errmsg; - if (!have_guest_base && !reserved_va) { - unsigned long host_start, real_start, host_size; + uintptr_t loaddr = orig_loaddr; + uintptr_t hiaddr = orig_hiaddr; + uintptr_t addr; - /* Round addresses to page boundaries. */ - loaddr &= qemu_host_page_mask; - hiaddr = HOST_PAGE_ALIGN(hiaddr); + if (hiaddr != orig_hiaddr) { + error_report("%s: requires virtual address space that the " + "host cannot provide (0x%" PRIx64 ")", + image_name, (uint64_t)orig_hiaddr); + exit(EXIT_FAILURE); + } - if (loaddr < mmap_min_addr) { - host_start = HOST_PAGE_ALIGN(mmap_min_addr); + loaddr &= -align; + if (ARM_COMMPAGE) { + /* + * Extend the allocation to include the commpage. + * For a 64-bit host, this is just 4GiB; for a 32-bit host, + * the address arithmetic will wrap around, but the difference + * will produce the correct allocation size. + */ + if (sizeof(uintptr_t) == 8 || loaddr >= 0x80000000u) { + hiaddr = (uintptr_t)4 << 30; } else { - host_start = loaddr; - if (host_start != loaddr) { - errmsg = "Address overflow loading ELF binary"; - goto exit_errmsg; - } + loaddr = ARM_COMMPAGE & -align; } - host_size = hiaddr - loaddr; + } - /* Setup the initial guest memory space with ranges gleaned from - * the ELF image that is being loaded. + addr = pgb_find_hole(loaddr, hiaddr - loaddr, align); + if (addr == -1) { + /* + * If ARM_COMMPAGE, there *might* be a non-consecutive allocation + * that can satisfy both. But as the normal arm32 link base address + * is ~32k, and we extend down to include the commpage, making the + * overhead only ~96k, this is unlikely. */ - real_start = init_guest_space(host_start, host_size, loaddr, false); - if (real_start == (unsigned long)-1) { - errmsg = "Unable to find space for application"; - goto exit_errmsg; - } - guest_base = real_start - loaddr; + error_report("%s: Unable to allocate %#zx bytes of " + "virtual address space", image_name, + (size_t)(hiaddr - loaddr)); + exit(EXIT_FAILURE); + } + + guest_base = addr; +} + +static void pgb_dynamic(const char *image_name, long align) +{ + /* + * The executable is dynamic and does not require a fixed address. + * All we need is a commpage that satisfies align. + * If we do not need a commpage, leave guest_base == 0. + */ + if (ARM_COMMPAGE) { + uintptr_t addr, commpage; - qemu_log_mask(CPU_LOG_PAGE, "Relocating guest address space from 0x" - TARGET_ABI_FMT_lx " to 0x%lx\n", - loaddr, real_start); + /* 64-bit hosts should have used reserved_va. */ + assert(sizeof(uintptr_t) == 4); + + /* + * By putting the commpage at the first hole, that puts guest_base + * just above that, and maximises the positive guest addresses. + */ + commpage = ARM_COMMPAGE & -align; + addr = pgb_find_hole(commpage, -commpage, align); + assert(addr != -1); + guest_base = addr; } - return; +} -exit_errmsg: - fprintf(stderr, "%s: %s\n", image_name, errmsg); - exit(-1); +static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr, + abi_ulong guest_hiaddr, long align) +{ + const int flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE; + void *addr, *test; + + if (guest_hiaddr > reserved_va) { + error_report("%s: requires more than reserved virtual " + "address space (0x%" PRIx64 " > 0x%lx)", + image_name, (uint64_t)guest_hiaddr, reserved_va); + exit(EXIT_FAILURE); + } + + /* Widen the "image" to the entire reserved address space. */ + pgb_static(image_name, 0, reserved_va, align); + + /* Reserve the memory on the host. */ + assert(guest_base != 0); + test = g2h(0); + addr = mmap(test, reserved_va, PROT_NONE, flags, -1, 0); + if (addr == MAP_FAILED) { + error_report("Unable to reserve 0x%lx bytes of virtual address " + "space for use as guest address space (check your " + "virtual memory ulimit setting or reserve less " + "using -R option)", reserved_va); + exit(EXIT_FAILURE); + } + assert(addr == test); } +void probe_guest_base(const char *image_name, abi_ulong guest_loaddr, + abi_ulong guest_hiaddr) +{ + /* In order to use host shmat, we must be able to honor SHMLBA. */ + uintptr_t align = MAX(SHMLBA, qemu_host_page_size); + + if (have_guest_base) { + pgb_have_guest_base(image_name, guest_loaddr, guest_hiaddr, align); + } else if (reserved_va) { + pgb_reserved_va(image_name, guest_loaddr, guest_hiaddr, align); + } else if (guest_loaddr) { + pgb_static(image_name, guest_loaddr, guest_hiaddr, align); + } else { + pgb_dynamic(image_name, align); + } + + /* Reserve and initialize the commpage. */ + if (!init_guest_commpage()) { + /* + * With have_guest_base, the user has selected the address and + * we are trying to work with that. Otherwise, we have selected + * free space and init_guest_commpage must succeeded. + */ + assert(have_guest_base); + pgb_fail_in_use(image_name); + } + + assert(QEMU_IS_ALIGNED(guest_base, align)); + qemu_log_mask(CPU_LOG_PAGE, "Locating guest address space " + "@ 0x%" PRIx64 "\n", (uint64_t)guest_base); +} /* Load an ELF image into the address space. @@ -2399,6 +2390,12 @@ static void load_elf_image(const char *image_name, int image_fd, * MMAP_MIN_ADDR or the QEMU application itself. */ probe_guest_base(image_name, loaddr, hiaddr); + } else { + /* + * The binary is dynamic, but we still need to + * select guest_base. In this case we pass a size. + */ + probe_guest_base(image_name, 0, hiaddr - loaddr); } } diff --git a/linux-user/flatload.c b/linux-user/flatload.c index 66901f39cc..8fb448f0bf 100644 --- a/linux-user/flatload.c +++ b/linux-user/flatload.c @@ -441,6 +441,12 @@ static int load_flat_file(struct linux_binprm * bprm, indx_len = MAX_SHARED_LIBS * sizeof(abi_ulong); indx_len = (indx_len + 15) & ~(abi_ulong)15; + /* + * Alloate the address space. + */ + probe_guest_base(bprm->filename, 0, + text_len + data_len + extra + indx_len); + /* * there are a couple of cases here, the separate code/data * case, and then the fully copied to RAM case which lumps diff --git a/linux-user/main.c b/linux-user/main.c index 22578b1633..1d20a83d4e 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -24,6 +24,7 @@ #include "qemu-version.h" #include #include +#include #include "qapi/error.h" #include "qemu.h" @@ -747,28 +748,6 @@ int main(int argc, char **argv, char **envp) target_environ = envlist_to_environ(envlist, NULL); envlist_free(envlist); - /* - * Now that page sizes are configured in tcg_exec_init() we can do - * proper page alignment for guest_base. - */ - guest_base = HOST_PAGE_ALIGN(guest_base); - - if (reserved_va || have_guest_base) { - guest_base = init_guest_space(guest_base, reserved_va, 0, - have_guest_base); - if (guest_base == (unsigned long)-1) { - fprintf(stderr, "Unable to reserve 0x%lx bytes of virtual address " - "space for use as guest address space (check your virtual " - "memory ulimit setting or reserve less using -R option)\n", - reserved_va); - exit(EXIT_FAILURE); - } - - if (reserved_va) { - mmap_next_start = reserved_va; - } - } - /* * Read in mmap_min_addr kernel parameter. This value is used * When loading the ELF image to determine whether guest_base From patchwork Thu Apr 23 17:05:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185728 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2293675ilf; Thu, 23 Apr 2020 10:06:23 -0700 (PDT) X-Google-Smtp-Source: APiQypKDbhaLH+kx+OGYOlpRqK+Sd9XIw11qnIG8PevPy8tJSICKmR/InbxHni9zVBw0cdnvIShA X-Received: by 2002:a05:620a:1232:: with SMTP id v18mr4750986qkj.429.1587661582894; Thu, 23 Apr 2020 10:06:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587661582; cv=none; d=google.com; s=arc-20160816; b=FJdBvSNkFIJTBQ4l/qqT9XVS6DKXO6H25VI/YWvlhK3XFNMSze7uC+qLYIUUWLd28j 5UuzArjLIOcK5t3f2o6dCWE7wl4VG0X0MBi0JHMohU1gaE41aYH9MH+WSu5hBtk4YW2x zKSJgtS7OfW+WykfDk7Dbdu4CYO0PEgFzKrJt7rci8gy77dcssCRyxDvbvpzhh4YNa7n XT+8LTog505fsjGaWDGZDnaSpK9TRdrXmUFKcsPTlx+/93Bc0we9NUPidThINmCWoLwc cY59KndZfs/PlsNYGGedh9qMOEJX6NmMupXipfTpNKuYGUb8OWbcznE9YIeOe/uhRkcx 4Ydg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Rec4lCI7C2I9ftVXhw3jnhwwniJ/OyIiNlpjw4I33hQ=; b=ZQEJvb7S1gOFH7a0riTDJW0iB2KzqM2k3TjNoWTJtCcT/iITdKlcW6/IZIJRdFumPx H7dn4nTtwGQOJUdeaFaySUD1Y/jMYcxGSEAlcSveZ3/McI6mTLtwpm+LkdAa63Z3eKTW apzYdANxJs/iuqRQ5U9zDm0r+Ty+hlqG1AIpKMLaOCgS+o+JZHY/aAaUyaMZCtjfOXBQ gT//Kpb+nRx/B35lP+z8WKwTVTXM0Qx3r3s/7k3kJ4menPXYQif3AxOW76w/18zCm1hz W6NlfNWzROngScbF92XTeQ4PX/4HX2VwctMwHTEtXNXHeGmT+oaS1bLsfcs0+upvUGPe 7zxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tExudrxB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l30si2000314qtf.192.2020.04.23.10.06.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Apr 2020 10:06:22 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tExudrxB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfIs-0000xc-8R for patch@linaro.org; Thu, 23 Apr 2020 13:06:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44570) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfIb-0000wO-RK for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRfIa-0005S5-PQ for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:05 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:37338) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRfIa-0005Re-CK for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:04 -0400 Received: by mail-wm1-x341.google.com with SMTP id z6so7355876wml.2 for ; Thu, 23 Apr 2020 10:06:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Rec4lCI7C2I9ftVXhw3jnhwwniJ/OyIiNlpjw4I33hQ=; b=tExudrxB9vPk++NxCuVAo8EeZ109asjdxvLWGyve24NzSHb6Dg1N4A7vwp2xnIt+rI +TdPFVmhFYaMtMaPlCHSYd7hh12ZtaOPp4DPr1xvchNsZT39jZ8AdNfOBsB/K9AyQQak 9EfK2aRwD9wOPURWocN59R4dS5IggtEsZrPNn93cjcLnHIvp/GkHVwKt9VtDFgJYrhrA iE5QaOYDiw++HdAqaLzUv10WT3gUHudZqsk9/KNUQY5jkP4wmzsVmba/olTS7r7TkYYI rTztF+WTblsJieNuUDZ47gWuHpRQjyHnRmwj5zbiifqf86qMILEGt3J4dJgLEovZd+cs udtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Rec4lCI7C2I9ftVXhw3jnhwwniJ/OyIiNlpjw4I33hQ=; b=nlJXX1wMGOxJKDiVaK+JpLDZk92aW28FKWcY2+enUVa8U7UeewZ5sWWiIVxkbZOB5/ g7OdrIdcLQjha6lWQ8qzo91F7oJzrgNDmdtFUPe2XMDN4GL6wFI5ENiWhnaznH2ajO7I 26smaXWbXwLbKBeeMFp1T/DxfUuyd8dzJK86MA0ZWb1UMUbLzpj9kMT78L50otfOvZ3i Hr6xuNFi970SElo48umzZx7EOAN93ystVhOKNfCjVlzGBflT33O01l6OKoZwPX0q0iU5 6I5/Xj75yLAbBTrgf8gUVaEdk5dlin/E4QhH2uIRvaZldWNUP3mjLA/foZllrm2LHLyx /AkA== X-Gm-Message-State: AGi0Pubb+N4mEFvKOLSgpDGJlmPnpZfUlOfGsbJey9A2OrdkqeSLoeC7 nqLarha/rggdFknF1CG//Ts+ZQ== X-Received: by 2002:a1c:9cc6:: with SMTP id f189mr5051083wme.75.1587661562041; Thu, 23 Apr 2020 10:06:02 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id y40sm4854696wrd.20.2020.04.23.10.05.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 10:05:58 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 737861FF8C; Thu, 23 Apr 2020 18:05:57 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 02/14] exec/cpu-all: Use bool for have_guest_base Date: Thu, 23 Apr 2020 18:05:45 +0100 Message-Id: <20200423170557.31106-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200423170557.31106-1-alex.bennee@linaro.org> References: <20200423170557.31106-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::341; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x341.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::341 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Riku Voipio , Richard Henderson , Laurent Vivier , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé --- include/exec/cpu-all.h | 2 +- bsd-user/main.c | 4 ++-- linux-user/main.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) -- 2.20.1 diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 49384bb66a..b4fb5832c4 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -159,7 +159,7 @@ static inline void tswap64s(uint64_t *s) * This allows the guest address space to be offset to a convenient location. */ extern unsigned long guest_base; -extern int have_guest_base; +extern bool have_guest_base; extern unsigned long reserved_va; #if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS diff --git a/bsd-user/main.c b/bsd-user/main.c index 770c2b267a..aef5531628 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -42,7 +42,7 @@ int singlestep; unsigned long mmap_min_addr; unsigned long guest_base; -int have_guest_base; +bool have_guest_base; unsigned long reserved_va; static const char *interp_prefix = CONFIG_QEMU_INTERP_PREFIX; @@ -828,7 +828,7 @@ int main(int argc, char **argv) } } else if (!strcmp(r, "B")) { guest_base = strtol(argv[optind++], NULL, 0); - have_guest_base = 1; + have_guest_base = true; } else if (!strcmp(r, "drop-ld-preload")) { (void) envlist_unsetenv(envlist, "LD_PRELOAD"); } else if (!strcmp(r, "bsd")) { diff --git a/linux-user/main.c b/linux-user/main.c index 1d20a83d4e..90ad365b43 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -59,7 +59,7 @@ static const char *cpu_type; static const char *seed_optarg; unsigned long mmap_min_addr; unsigned long guest_base; -int have_guest_base; +bool have_guest_base; /* * Used to implement backwards-compatibility for the `-strace`, and @@ -334,7 +334,7 @@ static void handle_arg_cpu(const char *arg) static void handle_arg_guest_base(const char *arg) { guest_base = strtol(arg, NULL, 0); - have_guest_base = 1; + have_guest_base = true; } static void handle_arg_reserved_va(const char *arg) From patchwork Thu Apr 23 17:05:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185729 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2294232ilf; Thu, 23 Apr 2020 10:06:52 -0700 (PDT) X-Google-Smtp-Source: APiQypKV7d0/vOgeDZb3XR3jaApQNnVytFcJLAeM9AcrtnLBGKcMt7lfG6xuGR3h4tfKm7boMJQZ X-Received: by 2002:ac8:70c:: with SMTP id g12mr4866103qth.71.1587661612370; Thu, 23 Apr 2020 10:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587661612; cv=none; d=google.com; s=arc-20160816; b=n25//ZEC/FZ2yKRJ79PDt36iBePLJtKQ3lLT6sEOOcRisYJocl4ckITz1DcE9E4HiM 9b2VqoA+7LL8ZWxzw8LS6W7rsoLBWhNVNPyinaqtmhqYD9cKddjG9lZ03pjwrCevY0X/ crD681MH+G77yhvZTsAB/9gmckXMAEje1Nou/VkVn3Ai1U1Gs82ijhZKwW4PZI3XF6yx XnX1HV8QjgawhjpzM5Iemmbt4IaLT8h4SKLWljA8dzFXswxM+O2SquoAoABrjeHJrk7L ZfZHNbRhHOALc7VGJ2UsypB7FmqAImqOIyQbQwmfHIVt65a8z/2HrmYkdFMo1FsAplos ETOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=HvqdqtvusanP+sIzJfVgQLDOBPUMzvphXIagTaMAVCw=; b=eqJE+gzC9f3PeNsszyHMtjwciDiCmb8Co/oKMN/K/lEaq5Ih63TcHpAVSfHKGjV4qs l5tBmF3fP4cUt/L+vakRulT4NdQw3UGoi5CMk9bbMa/3x9uTxtMc02ubIqUxZ18ZVoGM bYten92nW0f9lm2sqP/wUStJWMO53trUQCUZ0aVbWLVgnuo8LoKzXZDm8r55LZ+n93Kx 2b90A2hvUHYM649u/TIEZcBN3kQ8UayIzDFnU2oMPyllgxdAhUC7IqRLi+jhABapBjbx GZfOwhjZ8vKsEFVQ3SQ0PX995GtBaC9kkiEKgBA43w6glVO2An+eNitaYWJY89loqYAU xq7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fWyAbXct; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g9si1741612qkk.49.2020.04.23.10.06.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Apr 2020 10:06:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fWyAbXct; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60310 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfJL-0000xu-AU for patch@linaro.org; Thu, 23 Apr 2020 13:06:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44584) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfIc-0000we-Nh for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRfIc-0005Sx-3A for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:06 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:36430) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRfIb-0005Rl-BF for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:05 -0400 Received: by mail-wr1-x443.google.com with SMTP id d15so6099893wrx.3 for ; Thu, 23 Apr 2020 10:06:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HvqdqtvusanP+sIzJfVgQLDOBPUMzvphXIagTaMAVCw=; b=fWyAbXctsyVJ/owdq+iFrtsDZe/U9mVY8Dv6UU5DXNZQo63UQ4IcfvygyjwXDjXbF6 w98wA0bQAsq4+U2wHwU7okTRXjtFZO/g8JZ/taUUmzn3rI/kpYYFe0hniHpe02yBId5S 65jmc05kM1TrdZTCBJoEcrIaFOgKrOCPYWr8oV9+dQxu52EGbNeVPA/25d2/FVQfLih8 NyuIYQZs/TeNhbK9JGkWkYWqF3qlhRcs4Rx7nCJnRMfB6u3JGegZ0agAgJSZ4as88D+z 7MXlawEZNuqYczn1UFwTQEIMQI/9xYD7HbCnMXWL8BeruJX8n3dnSU/vX9wkiPWHh6hT 4CFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HvqdqtvusanP+sIzJfVgQLDOBPUMzvphXIagTaMAVCw=; b=JDTmaFPtyrlsOXoXFjKZgwCZrIu9vGbJjyyWFy37sInQ+xIcgJKL6o/mmJ+iPqfPTM 9lK1n9ArI0HDsei+4nHRXMu/yzT22p6AKqF2ZI3+hBVa795IMOQZaf0DQHgzccKcxMiy O1QhtgtK8xQRdQOqLD1+Oo40dTrb9usmgXzq214Q0JSyM+ybt3zJAtToKHlNzQwxMnIL BOPBPJlHSvAegRnDCPF7A2kMM09x3xQx551rOyhngEpVT6gD+s2BqJ5HNFMvZbOC+0Ap TUnVsFAUq64LG9kqx/dCqu/ZT04rwQ0L3axAUqUMbzm81tIn92UP/3QWABJS/UgRLJSY Ot5w== X-Gm-Message-State: AGi0Pubrqi35EjeHd6JgHCR6ZcamBDzSD7gzVqoLViSr5AtzG3ejKX0D N7bxxs2/14PY/RFw0z+RDr9ufg== X-Received: by 2002:adf:f5c4:: with SMTP id k4mr5970485wrp.294.1587661563032; Thu, 23 Apr 2020 10:06:03 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id c10sm4231466wru.48.2020.04.23.10.05.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 10:05:58 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 8A8161FF8F; Thu, 23 Apr 2020 18:05:57 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 03/14] accel/tcg: Relax va restrictions on 64-bit guests Date: Thu, 23 Apr 2020 18:05:46 +0100 Message-Id: <20200423170557.31106-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200423170557.31106-1-alex.bennee@linaro.org> References: <20200423170557.31106-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::443 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Paolo Bonzini , Richard Henderson , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We cannot at present limit a 64-bit guest to a virtual address space smaller than the host. It will mostly work to ignore this limitation, except if the guest uses high bits of the address space for tags. But it will certainly work better, as presently we can wind up failing to allocate the guest stack. Widen our user-only page tree to the host or abi pointer width. Remove the workaround for this problem from target/alpha. Always validate guest addresses vs reserved_va, as there we control allocation ourselves. Signed-off-by: Richard Henderson Signed-off-by: Alex Bennée --- include/exec/cpu-all.h | 23 +++++++++++++++++++---- target/alpha/cpu-param.h | 15 ++------------- accel/tcg/translate-all.c | 15 +++++++++------ 3 files changed, 30 insertions(+), 23 deletions(-) -- 2.20.1 diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index b4fb5832c4..c0c2fa3cc5 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -162,12 +162,27 @@ extern unsigned long guest_base; extern bool have_guest_base; extern unsigned long reserved_va; -#if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS -#define GUEST_ADDR_MAX (~0ul) +/* + * Limit the guest addresses as best we can. + * + * When not using -R reserved_va, we cannot really limit the guest + * to less address space than the host. For 32-bit guests, this + * acts as a sanity check that we're not giving the guest an address + * that it cannot even represent. For 64-bit guests... the address + * might not be what the real kernel would give, but it is at least + * representable in the guest. + * + * TODO: Improve address allocation to avoid this problem, and to + * avoid setting bits at the top of guest addresses that might need + * to be used for tags. + */ +#if MIN(TARGET_VIRT_ADDR_SPACE_BITS, TARGET_ABI_BITS) <= 32 +# define GUEST_ADDR_MAX_ UINT32_MAX #else -#define GUEST_ADDR_MAX (reserved_va ? reserved_va - 1 : \ - (1ul << TARGET_VIRT_ADDR_SPACE_BITS) - 1) +# define GUEST_ADDR_MAX_ ~0ul #endif +#define GUEST_ADDR_MAX (reserved_va ? reserved_va - 1 : GUEST_ADDR_MAX_) + #else #include "exec/hwaddr.h" diff --git a/target/alpha/cpu-param.h b/target/alpha/cpu-param.h index 692aee27ca..1153992e42 100644 --- a/target/alpha/cpu-param.h +++ b/target/alpha/cpu-param.h @@ -10,22 +10,11 @@ #define TARGET_LONG_BITS 64 #define TARGET_PAGE_BITS 13 -#ifdef CONFIG_USER_ONLY -/* - * ??? The kernel likes to give addresses in high memory. If the host has - * more virtual address space than the guest, this can lead to impossible - * allocations. Honor the long-standing assumption that only kernel addrs - * are negative, but otherwise allow allocations anywhere. This could lead - * to tricky emulation problems for programs doing tagged addressing, but - * that's far fewer than encounter the impossible allocation problem. - */ -#define TARGET_PHYS_ADDR_SPACE_BITS 63 -#define TARGET_VIRT_ADDR_SPACE_BITS 63 -#else + /* ??? EV4 has 34 phys addr bits, EV5 has 40, EV6 has 44. */ #define TARGET_PHYS_ADDR_SPACE_BITS 44 #define TARGET_VIRT_ADDR_SPACE_BITS (30 + TARGET_PAGE_BITS) -#endif + #define NB_MMU_MODES 3 #endif diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 9924e66d1f..e4f703a7e6 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -173,8 +173,13 @@ struct page_collection { #define TB_FOR_EACH_JMP(head_tb, tb, n) \ TB_FOR_EACH_TAGGED((head_tb)->jmp_list_head, tb, n, jmp_list_next) -/* In system mode we want L1_MAP to be based on ram offsets, - while in user mode we want it to be based on virtual addresses. */ +/* + * In system mode we want L1_MAP to be based on ram offsets, + * while in user mode we want it to be based on virtual addresses. + * + * TODO: For user mode, see the caveat re host vs guest virtual + * address spaces near GUEST_ADDR_MAX. + */ #if !defined(CONFIG_USER_ONLY) #if HOST_LONG_BITS < TARGET_PHYS_ADDR_SPACE_BITS # define L1_MAP_ADDR_SPACE_BITS HOST_LONG_BITS @@ -182,7 +187,7 @@ struct page_collection { # define L1_MAP_ADDR_SPACE_BITS TARGET_PHYS_ADDR_SPACE_BITS #endif #else -# define L1_MAP_ADDR_SPACE_BITS TARGET_VIRT_ADDR_SPACE_BITS +# define L1_MAP_ADDR_SPACE_BITS MIN(HOST_LONG_BITS, TARGET_ABI_BITS) #endif /* Size of the L2 (and L3, etc) page tables. */ @@ -2497,9 +2502,7 @@ void page_set_flags(target_ulong start, target_ulong end, int flags) /* This function should never be called with addresses outside the guest address space. If this assert fires, it probably indicates a missing call to h2g_valid. */ -#if TARGET_ABI_BITS > L1_MAP_ADDR_SPACE_BITS - assert(end <= ((target_ulong)1 << L1_MAP_ADDR_SPACE_BITS)); -#endif + assert(end - 1 <= GUEST_ADDR_MAX); assert(start < end); assert_memory_lock(); From patchwork Thu Apr 23 17:05:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185734 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2296270ilf; Thu, 23 Apr 2020 10:08:37 -0700 (PDT) X-Google-Smtp-Source: APiQypKYUY4Y6knQ1MZqHmyrg709zSHg2QQ3vVIMxORRqwB3Cqbm1yG2p4czsD3AHuTXMfwPscDk X-Received: by 2002:ae9:edc8:: with SMTP id c191mr4660272qkg.478.1587661717092; Thu, 23 Apr 2020 10:08:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587661717; cv=none; d=google.com; s=arc-20160816; b=EZVByTBA7yyOf6fjDL6++NBHIHIQyrV1AnUxcmUER5jylP59h5Voc03n0M+uoeIn1W zOC/qAbYZFswlKfFGVvBmgjfEinEI1JrwX3AAspjpfqjX/VAFUY38cZYTWfBuIh0XFSK h1tcbmDjTjII+TZxw4Um5gkGK9ZonV/ZUEvB4DrtwpzRHTXmTGI9jLz4yUOC8wsC6nxr HMP/fo+5NTltOXATCmuKfRVYhpcWUZAS/KBk8LIHJkQoZkLSrScC7KBL1N085m8mUOBg s/TdwrIURaSfErZaatljFP/CthFZCk0/GxQ3ja/G75Q8PTjea/nhpmMx6z1v0JBh4Pz4 6oMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=UJa9O7SlcWT6UhRg1uaROqwj8sngC3TBRya5nKD48qg=; b=gjhtYBYZhxUM0jrGXMLpbwGUKSgn/L33L7t7f8++/991eqedbRRiaDI6B2NrNFJHPL nkbcd/xGTrmBa9BZGTW9NMyczkoFuVTXngyhT3ccXPufEOiPnhNTyxP5Ddub4/qhrPPY pv7jGYucYa+pJHKm+aBRvvQG+WOUvFrWF8yuBO5VueeOJJ7FlO/OX13NNHLa9VhCatlR 0QC/H9WuZ+seKO9BUeYMO0kBZp6kJMjlhFfy0RIuAAzBDLPY/kHtm4eH7fZJ90bcYrOL CJiIyXzWaNzmgP3eLJM7zb06OgshP/DXFjXuMfA/FJgQxyCbdY1kN0YYmjFghOVrMUZM akYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=iRmbP7K0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x76si1745182qkb.93.2020.04.23.10.08.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Apr 2020 10:08:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=iRmbP7K0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfL2-0005nV-FG for patch@linaro.org; Thu, 23 Apr 2020 13:08:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44590) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfIc-0000wk-Ve for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRfIc-0005T3-5Y for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:06 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:41019) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRfIb-0005SD-Oo for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:05 -0400 Received: by mail-wr1-x42e.google.com with SMTP id g13so7698957wrb.8 for ; Thu, 23 Apr 2020 10:06:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UJa9O7SlcWT6UhRg1uaROqwj8sngC3TBRya5nKD48qg=; b=iRmbP7K02SURG8MePkSnYB1oj8pI0UdbEjwY4TrY+CIcCuADJkBUeSiZNiLyOY2taA xf96a0talmzrB8bDxXmEl0HgU0BO4qc8VAnS2MqrNxIgJwbdh0YKDCQvYCspGsUOCJPb yATT4x2az+V9V2XnEk3yULAFkMaM3rTdl/ZxBSZ32UlFMx7mEf1QcmAGk6kl9IO6PdSq wiYNLEQhD9VLdJi21WbpP1iILINQjGqFdWtbqAEXPfTVCOx1ir9dDxoOaUR0d6HTgO/n eBHYV6xAL18CCh3efHH4i8i9WXpaik8hbJxJejwrkvIY9zEt6dKz71iiuFlYB58sVvJp 58og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UJa9O7SlcWT6UhRg1uaROqwj8sngC3TBRya5nKD48qg=; b=IiNlSnnpZDMosQgSsbHCYDvw8Hyymzatj4EVb+WO0qY2o+iJDPePeBMx8zy8zwisfG UBQjTbTyfauVG2Ksm8Kf/HXA/rhG7FBQXlSpSxAgtyOnUkNSixTfY8ueSPUXNuqDRiRT Fe5Hi1JGli/5AKzNCC60ytDP3BsrbxxsZVWPb9j00WFc1dKOB/sIs8+y6QrhI3eBehW3 Ex/APcXXsOoTlTjQg03QHdhYalobgiEuO5hZOr1pswSxTcqSIspe2QcLtmhWDa4XVWbx Q5XkITuzMtb9arSO0CwNHPkbwimbJKLKYWcuPainPmktqLx/pwJcIYoYmPD/6ukjw91O IglA== X-Gm-Message-State: AGi0PuaamixxA96NAuJD6j7dv4++ZqeNev0BMXqmHUlDwiC9zbevTRdR mP7gph5cXYhUN4o5y0yEVud8Fg== X-Received: by 2002:a5d:4042:: with SMTP id w2mr5587250wrp.195.1587661564341; Thu, 23 Apr 2020 10:06:04 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id d5sm4702433wrp.44.2020.04.23.10.05.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 10:05:59 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 9E4851FF90; Thu, 23 Apr 2020 18:05:57 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 04/14] .gitignore: include common build sub-directories Date: Thu, 23 Apr 2020 18:05:47 +0100 Message-Id: <20200423170557.31106-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200423170557.31106-1-alex.bennee@linaro.org> References: <20200423170557.31106-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42e.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::42e X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" As out-of-tree builds become more common (or rather building in a subdir) we can add a lot of load to "git ls-files" as it hunts down sub-directories that are irrelevant to the source tree. This is especially annoying if you have a prompt that attempts to summarise the current git status on command completion. Signed-off-by: Alex Bennée Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daudé --- v2 - use build*/ to capture build and it's variants --- .gitignore | 1 + 1 file changed, 1 insertion(+) -- 2.20.1 diff --git a/.gitignore b/.gitignore index 0c5af83aa7..8dccb61a44 100644 --- a/.gitignore +++ b/.gitignore @@ -141,6 +141,7 @@ cscope.* tags TAGS docker-src.* +build*/ *~ *.ast_raw *.depend_raw From patchwork Thu Apr 23 17:05:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185732 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2295776ilf; Thu, 23 Apr 2020 10:08:12 -0700 (PDT) X-Google-Smtp-Source: APiQypIQMM7CTlA6ricRWaIDK+kruy0iJe+OFE4FRCGqmjaIA76/V6WSgCDkSJHHfG6r6iHzd9KO X-Received: by 2002:a37:8604:: with SMTP id i4mr4538049qkd.481.1587661691744; Thu, 23 Apr 2020 10:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587661691; cv=none; d=google.com; s=arc-20160816; b=YQlPLJ4moUKEPgQTE51NZV4cKXzzsNZGCBJPI6x+F3Drc2rkL4Q8/61qR+hc+qJa+/ XGgQdVnFFGThcsgPURthNeaMmYSkGp7MjWfdq2CF00asGF82v457ZghdqLUkZmj26wK2 4IgMeaUPYgYE/Q8rj15NGJN6gDF0HuAjQ87NtFLW90lapSQzZUuYfTsqSLYJo9TAeH6e Gn0PBThUxWhZKWD4ipebTnZCyzhKrrLj9VnNU8wEN7oPBo0YjKh0OBSQXg8rTK5DwoeU wBhdNIkEZQXagELoKgnWxsU+Iiq/ggH5CH39fa7Axo2K+cxaIAJ2GsZMFw15hiO4eAUN nrbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=yWh3aRGKef9xVplQd968UKYGmgCSPBAT3qOdlODDYkY=; b=JOTK1wGt5sayg0o9uEPNnPwrr2jxn1yl2iUPy4Kn6MhCLFOE+stiU85dxfOh96e5r1 w8Num15Gwb2hei/ARYlQMplmdQJGEoTPgd0H0qIfZlPKoOCgH5IEr68+OeAQOAsj8/Nh 969wlIZoIUyQhoZ0yFoS0GHaUAnygrMT9qK7slHI4EJzBBx9dZ0qL3CGjBiEepeQy64N XoBSGVz2QG3G8TP6go+k+kw89EKPAcaOoUHZcbA+LLYI5PjKOtRNs6MTMp5sD2ZRCJow Qt9KQVUm2jzUKfMYptyxB/stDlQSH8UBNMd5SAfkyKkRjUQJgz2SxusYn/Vbx05bxNHc yemw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=blmg5Yts; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x23si1744853qtb.253.2020.04.23.10.08.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Apr 2020 10:08:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=blmg5Yts; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfKc-0006B7-VU for patch@linaro.org; Thu, 23 Apr 2020 13:08:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44646) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfIi-00016g-5q for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRfIg-0005WL-T5 for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:11 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:35802) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRfIg-0005VN-FT for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:10 -0400 Received: by mail-wr1-x441.google.com with SMTP id x18so7716598wrq.2 for ; Thu, 23 Apr 2020 10:06:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yWh3aRGKef9xVplQd968UKYGmgCSPBAT3qOdlODDYkY=; b=blmg5Yts3E2FGVs0grpxsfYS8jud8lWn3j+SF33/gpZRJABufOPfba5LX5OAuhWtnJ arbfWMWXeI5/CuA6Cp0goThYJZBjtzmGkE8/tQLdTjel8JA4LYeOUNo1htzx2XALctUF SMq2rnmHj9LaHMODFjcKh79XIR3kFcNrKc38CGeq/9bTQNO1hMqdPvzIkPQXJoNy8t1b 3lAAePsqtGKkBnxqLAVzzdJ/07Como5kE8X4GJhtdejnPLseSSreelYH7FepII/7fdTB e+Btyi5gT9OmAWD7Yaw1ywORdv7kRUyCARDABOx5OandNZh12d6MP8GRdinDWni2BAfh mJhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yWh3aRGKef9xVplQd968UKYGmgCSPBAT3qOdlODDYkY=; b=KA9Ij5fIVZNitHs62tDPDArtaD/F6JhYeLB6OkpQQcfuEmOlf54rvpm222/eUV9Gws EecsuU5Bi1HMzNVXnm0JPZU+67ZclbdB8UgbobS/8XghZL3OeMSg2WEdCOf6YrWOPRvK kq4P6NFwm8Pswpd9knz/C7DxC1JVmFvHXbRzo/FhYbejR7uTc1hYXjEo9NAHmBc0u811 146A2zb9BQmGxHT+cUnUf+kTpfg8eS5/Yviy8QWUOSIroEbpmwsfP7Et9aLCJ/QmszJR SG7NC3Ffvba8sokVduspzx3WvuSwQwiBZi9nYrxdYXPdRbH56VOPf4kyQmUa9jNHJD1K QTyA== X-Gm-Message-State: AGi0PubnlCf6PIo3w0sO5HPkgVppaFg5GZ4S6ekVi6th1LBYHmC1oklE FnZhXc+K+f/NYOYch4mK4XJjaA== X-Received: by 2002:adf:9168:: with SMTP id j95mr5724202wrj.145.1587661569041; Thu, 23 Apr 2020 10:06:09 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id h1sm4686289wme.42.2020.04.23.10.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 10:06:04 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B1C741FF91; Thu, 23 Apr 2020 18:05:57 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 05/14] configure: favour gdb-multiarch if we have it Date: Thu, 23 Apr 2020 18:05:48 +0100 Message-Id: <20200423170557.31106-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200423170557.31106-1-alex.bennee@linaro.org> References: <20200423170557.31106-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::441; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x441.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::441 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" As gdb will generally be talking to "foreign" guests lets use that if we can. Otherwise the chances of gdb barfing are considerably higher. Signed-off-by: Alex Bennée --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/configure b/configure index 23b5e93752..c58787100f 100755 --- a/configure +++ b/configure @@ -303,7 +303,7 @@ libs_qga="" debug_info="yes" stack_protector="" use_containers="yes" -gdb_bin=$(command -v "gdb") +gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb") if test -e "$source_path/.git" then From patchwork Thu Apr 23 17:05:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185735 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2296271ilf; Thu, 23 Apr 2020 10:08:37 -0700 (PDT) X-Google-Smtp-Source: APiQypIC4ZZLS0tO/1wmlw/YCRYZZlDmg1VazDh1+YT8HQHOCMvSqF50hIQBHV/ARlnZ3d46fQnp X-Received: by 2002:a37:6296:: with SMTP id w144mr4608787qkb.310.1587661716943; Thu, 23 Apr 2020 10:08:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587661716; cv=none; d=google.com; s=arc-20160816; b=pKGb3UXONOb/nIHugq/X7Hmtp+4kSZ9ihfJEGOOkZniun7hPLOdN0b9otxyAMlbVh5 wJ48CxUA/0pwdl3q4bIqbQaulydH1FaJykLMLmhFxV6hdJBKfkKbMRcHm/t1hIf+sboL SViREhQuwt0Dp0eB+ob1UQsW6s1E6rgLmArID44R3IzeNLToyOlLr6c97zhRien4fWVd z1yay8bgOhAAKnTvhzHaFHZzkG68XUbyxn8PKBuniA3uyFRHbt3OlbGl/lRdDCDA/z5b 84SZdrnTrxp/0XBQPkKHEkaCoe29SoYK/fIVoGYwrdXLCwoZPgVpOKX6IBnhfm3f96X0 A6BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=zg2dR+/RlCjvNQhC4AT2xzR1UuuQk7HaGZ9Y5groXFk=; b=qjK+15QwBA/OWDcvbY8XaLSbdxHBx1bOq6dF3rRAX3d2YcNaVqf9r0Z+IoiIpOXbo6 fZCQ/ETtGyYLS0Kxaub+GwrZsPsxmyFV0bgDhdSROlfiSc6wneNUILw4xrA3DY1gGLIM GcpwYQGipaBUDoWnH1hnhQnMQyWnWsgHm+8iNW9HzYU50PRGJ/4JRW7/2VqdrjIZlD6U OLCZ5yVmORDWfNv1oQGvPwh9cvH//uX75uQF5KgjK+X0pd1VXA629/DJMTtWMkme8nh5 oDI1WwFdVxp/VkjMf+1AI5XpJeseLNfdfDHoO/tyfZkhOGo0GXeCw2XUEjapDKqjg6sJ Ny4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pNCYiAY0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l2si1930805qvq.3.2020.04.23.10.08.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Apr 2020 10:08:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pNCYiAY0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfL2-0005ru-99 for patch@linaro.org; Thu, 23 Apr 2020 13:08:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44604) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfIf-0000yi-4g for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRfIe-0005Ul-H4 for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:08 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:37069) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRfIe-0005TY-3p for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:08 -0400 Received: by mail-wr1-x432.google.com with SMTP id k1so7728570wrx.4 for ; Thu, 23 Apr 2020 10:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zg2dR+/RlCjvNQhC4AT2xzR1UuuQk7HaGZ9Y5groXFk=; b=pNCYiAY00eT6Apf7e5j30GROa+d8kski7hPFKxOATF3bumu1NIEVn4DsiEXLq4TJoI oR4AoEJWoxk2mKt1+30SaBLO+oXNzRMefh9OddYie9ipFJNSOHC/RcY24cIZRFQ+XCC0 yHZhAhArqLosynIsJP+jg0vOtLiol2h0iUkVTxEklirzXYYZIQVdx2WdM1wmT3zHdTh5 4Z/Z3n0FYMGXSlCuRvPlg18wcT9P89MXqBViOGfA9Bgrc/gGk+PccaPPdNZhYVeo08fQ 36GfUsVfMGcSDKCLBkHzrJuhTqG0ltNWkvUhER2YXh5JO96EytVudziMtpf3C3VMdrx+ bYdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zg2dR+/RlCjvNQhC4AT2xzR1UuuQk7HaGZ9Y5groXFk=; b=D6dQfQfiHhiuNNJ4P/pxhX5VuklshFatDqh8/z4eZrRobgBJIUe55msV+hcG87cPlg VbZGXGxwKFm9RaC3qcwL6RW4hkO6rvWLYa5G6ESp5gbhInI63EfHNub8bpnlwf70rep0 +fLHxWVV0DvqdwMOQsnWB2o1xz+QwcY4RVG+4b1L68KVaEJ3tpwYiZcZKiim2Hvqu4pw kpo+SDM4TJdcDE5pVy+MyOvyaT/prC++mi/IfPodR4AuzJ68IPq1lup108d4sulB6R2Y Ezf+XICoku39x/B7O8F3VT2BWqL2ZoxFlnRX2dqMgKozc7rCYIuFxz+1MJNuARW6fH7h HBPw== X-Gm-Message-State: AGi0PuYPJZZWcVCHphGxn3K2v90rRrJwnKSWfTx7vWEPZ76yDyWqpUrt fQU/jmMJ4kIgVBN3LZnMIEtLXA== X-Received: by 2002:adf:9d8d:: with SMTP id p13mr5874329wre.17.1587661566668; Thu, 23 Apr 2020 10:06:06 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id w11sm4369417wmi.32.2020.04.23.10.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 10:06:04 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id CADAE1FF92; Thu, 23 Apr 2020 18:05:57 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 06/14] gdbstub: Introduce gdb_get_float64() to get 64-bit float registers Date: Thu, 23 Apr 2020 18:05:49 +0100 Message-Id: <20200423170557.31106-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200423170557.31106-1-alex.bennee@linaro.org> References: <20200423170557.31106-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x432.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::432 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:PowerPC TCG CPUs" , =?utf-8?q?Alex_Ben?= =?utf-8?q?n=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , David Gibson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé When converted to use GByteArray in commits 462474d760c and a010bdbe719, the call to stfq_p() was removed. This call serialize a float. Since we now use a GByteArray, we can not use stfq_p() directly. Introduce the gdb_get_float64() helper to load a float64 register. Fixes: 462474d760c ("target/m68k: use gdb_get_reg helpers") Fixes: a010bdbe719 ("extend GByteArray to read register helpers") Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-Id: <20200414163853.12164-3-philmd@redhat.com> --- include/exec/gdbstub.h | 11 +++++++++++ target/m68k/helper.c | 3 ++- target/ppc/gdbstub.c | 4 ++-- target/ppc/translate_init.inc.c | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 20e1072692..4a2b8e3089 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -134,6 +134,17 @@ static inline int gdb_get_float32(GByteArray *array, float32 val) return sizeof(buf); } + +static inline int gdb_get_float64(GByteArray *array, float64 val) +{ + uint8_t buf[sizeof(CPU_DoubleU)]; + + stfq_p(buf, val); + g_byte_array_append(array, buf, sizeof(buf)); + + return sizeof(buf); +} + static inline int gdb_get_zeroes(GByteArray *array, size_t len) { guint oldlen = array->len; diff --git a/target/m68k/helper.c b/target/m68k/helper.c index cad4083895..79b0b10ea9 100644 --- a/target/m68k/helper.c +++ b/target/m68k/helper.c @@ -72,7 +72,8 @@ static int cf_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n) { if (n < 8) { float_status s; - return gdb_get_reg64(mem_buf, floatx80_to_float64(env->fregs[n].d, &s)); + return gdb_get_float64(mem_buf, + floatx80_to_float64(env->fregs[n].d, &s)); } switch (n) { case 8: /* fpcontrol */ diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index eb362dd9ae..5c11c88b2a 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -130,7 +130,7 @@ int ppc_cpu_gdb_read_register(CPUState *cs, GByteArray *buf, int n) gdb_get_regl(buf, env->gpr[n]); } else if (n < 64) { /* fprs */ - gdb_get_reg64(buf, *cpu_fpr_ptr(env, n - 32)); + gdb_get_float64(buf, *cpu_fpr_ptr(env, n - 32)); } else { switch (n) { case 64: @@ -184,7 +184,7 @@ int ppc_cpu_gdb_read_register_apple(CPUState *cs, GByteArray *buf, int n) gdb_get_reg64(buf, env->gpr[n]); } else if (n < 64) { /* fprs */ - gdb_get_reg64(buf, *cpu_fpr_ptr(env, n - 32)); + gdb_get_float64(buf, *cpu_fpr_ptr(env, n - 32)); } else if (n < 96) { /* Altivec */ gdb_get_reg64(buf, n - 64); diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index e853164a86..d825cb5975 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -9881,7 +9881,7 @@ static int gdb_get_float_reg(CPUPPCState *env, GByteArray *buf, int n) { uint8_t *mem_buf; if (n < 32) { - gdb_get_reg64(buf, *cpu_fpr_ptr(env, n)); + gdb_get_float64(buf, *cpu_fpr_ptr(env, n)); mem_buf = gdb_get_reg_ptr(buf, 8); ppc_maybe_bswap_register(env, mem_buf, 8); return 8; From patchwork Thu Apr 23 17:05:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185731 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2294344ilf; Thu, 23 Apr 2020 10:06:57 -0700 (PDT) X-Google-Smtp-Source: APiQypKL4akj0cLIwqMcvKKwwMqZgDLis5g5Fscqk7NF14aBUvK+mwBKTAtod/LKQ4CiKh0CywFL X-Received: by 2002:a05:620a:13e1:: with SMTP id h1mr4689779qkl.10.1587661617084; Thu, 23 Apr 2020 10:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587661617; cv=none; d=google.com; s=arc-20160816; b=Qv3vnVWB5nuqIXx0uCeeQebkJE8LgulBYbeynXOpJ9gNCh9eyUCeO7zT1DkcdwRoEQ HnvY0TT4ES7A6OAOmvKRJGQWJt5Tm/2wxmLdxrAEoJ9cmEsz7PVVXxob8VlFKgwwkaXj zrZrIFtNbmqYmMelfo1eC+//UcFa1jBPv0qGk8FlP6RRyvTU4ixIESCUs08Me2KXKOWh vPDHiwRlNDNSiR9RC8ZxmuxEQ4oR4XzSN8gY/FYvdhqwMnJlW4LKlPmIi1yIWQXbBy13 mEQxXwgT8BawkjpdUfGExOUMC67KGb4UsGy5As8dfLjDoZTRRHbkXQw6Fj4ewhZf/FS4 F8BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=0Xn/wGLfgFLD46kRhQwU2daT/QhgqlaCuFRqlRFnVf8=; b=mCrZt/91S9g+Kc3k1O9Z+r2JSJs4PyR/+Tn79JS9xhrm0LoL0dqr5b8hvkympQhPO+ ln8ATZks/N7qTHqbHInWLcD3o1wiA/xVDkMus+B9hSxvAPq34I30Gti1/clMlttz8Oap urYqCHr4spxgRWPNk3wohYFgeDT+eEwOdwyKy9YMvvZ+byUjXCSJpWrvihSy7z91uBKi T5KguVlfAECutK103YlobzwwGlBJNcCK+/KqKN+FFzVCWwKj4zWwFaYrDWzqgzpNwx4t ZtZZUVGxPtlSvCSpJXbiBBCePonrYlM6lXVuB4aCZpcZJL3LFhGL7G3xOgpfdSFaxCte 7i0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DRPoJNbC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i4si1897599qvr.23.2020.04.23.10.06.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Apr 2020 10:06:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DRPoJNbC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60338 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfJQ-00018y-El for patch@linaro.org; Thu, 23 Apr 2020 13:06:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44634) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfIg-00013y-MI for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRfIf-0005Ve-Rr for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:10 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:33411) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRfIf-0005Uh-Az for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:09 -0400 Received: by mail-wm1-x333.google.com with SMTP id v8so7927696wma.0 for ; Thu, 23 Apr 2020 10:06:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0Xn/wGLfgFLD46kRhQwU2daT/QhgqlaCuFRqlRFnVf8=; b=DRPoJNbCfoD7YP8g55X7LdkmXphvibqng/WH+lcvTZr++fsfa7LlEL87NiZHdtHceP P16Op08PVs+04nxv069zTiCW/i6g92cjHmPryOVuhZVaymEhzKS/slqeZuNfSBtNT5Mt Nb8F9+lLHLdE0TvVKBzcklCs3cFgFvWQ3vgUGRVFT4emayoEYSrd/zlJvoG4PlXjhnen D6SRCldiWgcCaXEKAf6Js1jwY/HTIZ99zuOWTTTRslL/VHVUnFmEITjKiL2j8UqrJX/U gDUUYlpqEk0dTPv/J91iK695XdFkYNH7APz/d2yh2RHH7a6pStfzZWZoXD6s0jCty9Pq F9HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0Xn/wGLfgFLD46kRhQwU2daT/QhgqlaCuFRqlRFnVf8=; b=F3KjE2rrGLI3UCew3XlLb9viGnv0IUWAuG7+P6htVKuDR0SUGATdHHgOSEeEdvY0No N4M4A++cE5VlSGorBQpcG6MEI1dKPvQbUKLPr9ubyKOrm6+3wb1tm2HPDVtgq8Matyis 6S20QCl8KiyjurDof63/3Bm2xkBJnlpVV2RvRm3Uz4VqMj3OJdSFNYWToyq1CCs1krut uCIeEQuEMLOBRnAdQ3wXqoWBQyT0YLSnRr/yjze4qXjNw0EjOgxWjW5cV2dw4juk3dDl khTmzEc+qBYUeIElQECAq98aE43zORKZlGyiijqHK8/PFzyb8f750KWG/a1TcbA+74RB Qnog== X-Gm-Message-State: AGi0PuYicFLjZjAGRRA9QQ2QmutLnYhbcNoHCo481Ndw8h7ZH7KYPOD7 Qj14KEz6MFIrThToFUvHmmLxzA== X-Received: by 2002:a05:600c:22d3:: with SMTP id 19mr5348534wmg.110.1587661567859; Thu, 23 Apr 2020 10:06:07 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id 17sm4396657wmo.2.2020.04.23.10.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 10:06:04 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E34F61FF93; Thu, 23 Apr 2020 18:05:57 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 07/14] tests/tcg: better trap gdb failures Date: Thu, 23 Apr 2020 18:05:50 +0100 Message-Id: <20200423170557.31106-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200423170557.31106-1-alex.bennee@linaro.org> References: <20200423170557.31106-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x333.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::333 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , "open list:ARM TCG CPUs" , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" It seems older and non-multiarach aware GDBs might not fail gracefully when faced with something they don't know. For example when faced with a target XML for s390x the Ubuntu 18.04 gdb will generate an internal fault and prompt for a core dump. Work around this by invoking GDB in a more batch orientated way and then trying to filter out between test failures and gdb failures. Signed-off-by: Alex Bennée --- tests/guest-debug/run-test.py | 19 ++++++++++++++++++- tests/tcg/aarch64/gdbstub/test-sve-ioctl.py | 1 - tests/tcg/aarch64/gdbstub/test-sve.py | 1 - 3 files changed, 18 insertions(+), 3 deletions(-) -- 2.20.1 diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py index 8c49ee2f22..2bbb8fbaa3 100755 --- a/tests/guest-debug/run-test.py +++ b/tests/guest-debug/run-test.py @@ -50,8 +50,25 @@ if __name__ == '__main__': inferior = subprocess.Popen(shlex.split(cmd)) # Now launch gdb with our test and collect the result - gdb_cmd = "%s %s -ex 'target remote localhost:1234' -x %s" % (args.gdb, args.binary, args.test) + gdb_cmd = "%s %s" % (args.gdb, args.binary) + # run quietly and ignore .gdbinit + gdb_cmd += " -q -n -batch" + # disable prompts in case of crash + gdb_cmd += " -ex 'set confirm off'" + # connect to remote + gdb_cmd += " -ex 'target remote localhost:1234'" + # finally the test script itself + gdb_cmd += " -x %s" % (args.test) + + print("GDB CMD: %s" % (gdb_cmd)) result = subprocess.call(gdb_cmd, shell=True); + # A negative result is the result of an internal gdb failure like + # a crash. We force a return of 0 so we don't fail the test on + # account of broken external tools. + if result < 0: + print("GDB crashed? SKIPPING") + exit(0) + exit(result) diff --git a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py b/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py index 984fbeb277..387b2fc20a 100644 --- a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py +++ b/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py @@ -70,7 +70,6 @@ except (gdb.error, AttributeError): try: # These are not very useful in scripts gdb.execute("set pagination off") - gdb.execute("set confirm off") # Run the actual tests run_test() diff --git a/tests/tcg/aarch64/gdbstub/test-sve.py b/tests/tcg/aarch64/gdbstub/test-sve.py index dbe7f2aa93..5995689625 100644 --- a/tests/tcg/aarch64/gdbstub/test-sve.py +++ b/tests/tcg/aarch64/gdbstub/test-sve.py @@ -71,7 +71,6 @@ except (gdb.error, AttributeError): try: # These are not very useful in scripts gdb.execute("set pagination off") - gdb.execute("set confirm off") # Run the actual tests run_test() From patchwork Thu Apr 23 17:05:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185736 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2297856ilf; Thu, 23 Apr 2020 10:10:01 -0700 (PDT) X-Google-Smtp-Source: APiQypJ83UvsoN7HRL7WiZUrIjqIlx9jBfMnfdlC5Wu3LjCLLVNyebE+Y4hAmnM3avyfGl5cMBFj X-Received: by 2002:a37:61d3:: with SMTP id v202mr4833335qkb.142.1587661801018; Thu, 23 Apr 2020 10:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587661801; cv=none; d=google.com; s=arc-20160816; b=sA238W5xwUXya/Fjrw0kpTIcRdJlXBBbMQ/gC17ukhqYbC3Grxxg/Ti0SSM6MTwaep EsmB89CWfzgfF7M2Zq9qIgar8jPjvBbkeo2ZWlYaeeWbZQu18KVlqaWLVqe7OTUR1Yci uHBPL4bpJiuRAzGFjyusx/p0SWF978AEXt4rLhEWSM+J99fHd7B8NVzz9nApukWIeb8q bCVnUXZYlgC3vwhVekwba9EPgzB+SyRjI17qr01WmXZI6TLH1KeBBhgNEnxWSF/5T4Jp RviOU2JLnc901+MMnpnGuJL2FIlFfuNtKQ1p+DthatPE0UtqWZaoLYtu17Bkh4aOvuyq DsZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=CdlDA7BMPwodMgRCX0xuQP7nMRxxWJAZKYksxv5dmZ0=; b=ib6DsF5wNbpMgAw9hH5Tdpaq/9BNeogK6bUrU92/mYubKA4a5u2wK+/s6aL6YIehF2 KKDHKBdxJWzjo1La4anU6qbiSg1yHeDBHBZvxYoqQQKqwZhvpEYNOo9vGFQ6caqamfwt rWkZPHDIo6fU/xACj6D0u9Gv1BjtBvd7iMR1HmNdy1sdIf3AocAaSmYVElDrZIA120Zm yeZwTtu/A1tfCosyZL9eUVb3VpGjYMr5wtwHnEG3WG7MRAuOnkwdFa/611RBDybJ3Fbu b5X56LEC5XbTsj6Ksn+/qaidCpr5f/Z4T59LiBRxJBQFD7h33rdNY/Y8V4YxsQMfPet1 lL4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="sR6/T+IP"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i4si1902434qvr.23.2020.04.23.10.10.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Apr 2020 10:10:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="sR6/T+IP"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfMO-0002gF-FN for patch@linaro.org; Thu, 23 Apr 2020 13:10:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44674) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfIk-0001Co-Ki for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRfIj-0005YZ-Mc for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:14 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:51749) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRfIj-0005X3-6K for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:13 -0400 Received: by mail-wm1-x32d.google.com with SMTP id x4so7216021wmj.1 for ; Thu, 23 Apr 2020 10:06:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CdlDA7BMPwodMgRCX0xuQP7nMRxxWJAZKYksxv5dmZ0=; b=sR6/T+IPT/LhQM1el7P5J867T+50zb6pxIuUciQSVFlhpVgyPUCUCFbpcETxarz+B8 z3GvF0g4pDWRCeCQG0FYq80hnzTXqJ+lLNE929EptKAhcLnPXYncXxpJAwGLQTT+t4uf aev/lmE5wfql0uiUZQ4gXWpLh1Y3jbc0MNDFCuiHjrBNiPZ94GjEOQWcGI57cD2R4NsX 2L+mPn0Xqa2u9LgrflfcoVDw2jrRyMbGqJHyIBp9rJ3LH8WqluAq+U08/gCjEkoPmmTf +98R1ojrJLDI5ue92sh4MNmaAyo4tgey0lq1FydJyu4gS6Rfv8CyMsbDOwnplcAKHM2M 9XYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CdlDA7BMPwodMgRCX0xuQP7nMRxxWJAZKYksxv5dmZ0=; b=NBLTnx7prA2uhl977rN2cdm2wHVlZKSlR1odOf+mbktlu+ZGhNZ15tPewz9ADue+eK wTGMQqKvhCFtYGuhZUptCo7mqjgf+mmUS4nhkocLoa7d0MvATIODVOHcC0ATODC56K7A 4AzcsEuoq9IEK7kFzRAYyINrnqdM6yMv6/hEg5PqWea+/j/GSfjbynS1a/wEFTMOZYwL 2V7pV+A02bPuvRh0pHYy84DmNGX1GXWdX9+IptcsjhniFVBvDiJZwXM1AhKDp+WDttJ7 kZXh+xUUB6QPwPRsU/4Jz4woM1vg3ci5091wgR2Cqs+w3wTdhabOmjpvQrBXspIMQzJa 37cg== X-Gm-Message-State: AGi0PuYP4rygsWjnwCf9pGWpDfnGrGbe1JfHstQsNW1uC8IurnfD8sJW kPhsxCveER8+L+D3c+ENRK1WUA== X-Received: by 2002:a05:600c:20c:: with SMTP id 12mr5089738wmi.158.1587661571637; Thu, 23 Apr 2020 10:06:11 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id d7sm4399812wrn.78.2020.04.23.10.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 10:06:04 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 064F21FF96; Thu, 23 Apr 2020 18:05:58 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 08/14] tests/tcg: drop inferior.was_attached() test Date: Thu, 23 Apr 2020 18:05:51 +0100 Message-Id: <20200423170557.31106-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200423170557.31106-1-alex.bennee@linaro.org> References: <20200423170557.31106-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32d.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::32d X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , "open list:ARM TCG CPUs" , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This test seems flaky and reports attachment even when we failed to negotiate the architecture. However the fetching of the guest architecture will fail tripping up the gdb AttributeError which will trigger our early no error status exit from the test Signed-off-by: Alex Bennée --- tests/tcg/aarch64/gdbstub/test-sve-ioctl.py | 3 --- tests/tcg/aarch64/gdbstub/test-sve.py | 3 --- 2 files changed, 6 deletions(-) -- 2.20.1 diff --git a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py b/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py index 387b2fc20a..972cf73c31 100644 --- a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py +++ b/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py @@ -58,9 +58,6 @@ def run_test(): # try: inferior = gdb.selected_inferior() - if inferior.was_attached == False: - print("SKIPPING (failed to attach)", file=sys.stderr) - exit(0) arch = inferior.architecture() report(arch.name() == "aarch64", "connected to aarch64") except (gdb.error, AttributeError): diff --git a/tests/tcg/aarch64/gdbstub/test-sve.py b/tests/tcg/aarch64/gdbstub/test-sve.py index 5995689625..b96bdbb99a 100644 --- a/tests/tcg/aarch64/gdbstub/test-sve.py +++ b/tests/tcg/aarch64/gdbstub/test-sve.py @@ -59,9 +59,6 @@ def run_test(): # try: inferior = gdb.selected_inferior() - if inferior.was_attached == False: - print("SKIPPING (failed to attach)", file=sys.stderr) - exit(0) arch = inferior.architecture() report(arch.name() == "aarch64", "connected to aarch64") except (gdb.error, AttributeError): From patchwork Thu Apr 23 17:05:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185737 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2298076ilf; Thu, 23 Apr 2020 10:10:12 -0700 (PDT) X-Google-Smtp-Source: APiQypLx2qQzcdWuABzPeyk9htBH6K6POk040TLvIBBuam4tJ4WVl5WoEVIYRDwx+5/wuHqguxwj X-Received: by 2002:ac8:70c8:: with SMTP id g8mr5047297qtp.385.1587661811956; Thu, 23 Apr 2020 10:10:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587661811; cv=none; d=google.com; s=arc-20160816; b=hFoJxWJV7+cdl31p+0QPgqPNm0/wyPWBuO28wkTo0jsu1JCCjki18YlshfSs+kyiqS SQvsUc+8yp49d7kCTW6Oe5Knto8IUjaxCr7CaccWBNEEfcPbGYLMt72NanN+slqZJSwX qsHQiyX9DXRN5Fr5gVyX1eOj1USyL2sl+iffV1VXe6xhwlUgFnFbWU2M63R2zDieH9HY ye0U48Q06umguKDZWOasXf+ZaZ4zTq02F4d4kjRoY301FBMEe5RSzGIJVJWxo/uB9+DF Dc+ddj/+++Y8L/c943SG5bdt8XDpe/zOmvypZn8kXnkP5mgmFYIG25xruopXS6uCRi2O mhJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=qwQ9PGD8JYBaJEUwYaNKOztNdvsthQ8POu4+c0qzYlM=; b=uP94U5JGDvW+u8sj7iDWz6Qthik7qct5yJBxI1uNIpG6eg4Oo7I8Qh4SAU4ZOy5cuV mq2zj1s8J4Do/4CvAtP4tl3lwflVTKb0gdTYqltDrp+nO6nEHyWUeSj9eurN4sqcDIFH vk6IrLUp7rJtGLz22w/TdGKzdRjudEwIRbvG5R5NGWnx3zogn6cHfhrzFXPP91haujRp K3fu+5QwVrjQ0Bv0zQtqtxidEehws37OFMf2Tk9wWc2siCR1LaqbLg6/71dyy73Ti5nK X24b7dsghInd6B8FUUIGFGMy/6njTPLC4Fj+xsI0ZtnAGkMgLv+UDT9z81nXx/rUpT3y WkLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="QU4/DDBS"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b128si1735938qke.202.2020.04.23.10.10.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Apr 2020 10:10:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="QU4/DDBS"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfMZ-0003CB-Aj for patch@linaro.org; Thu, 23 Apr 2020 13:10:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44658) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfIj-000195-DY for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRfIi-0005XA-Rp for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:13 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:40472) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRfIi-0005WV-EH for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:12 -0400 Received: by mail-wr1-x441.google.com with SMTP id k13so7709927wrw.7 for ; Thu, 23 Apr 2020 10:06:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qwQ9PGD8JYBaJEUwYaNKOztNdvsthQ8POu4+c0qzYlM=; b=QU4/DDBSsFHMgP0XBi0ERXtnhHWII6sSAxKElJofcsbfkldNqoRioyReTPu9GXoVRF lxSiTqiOET55aXB3x2dlMiWdJAN2XisqNZ5Y2QjBkUqoyx4Ur4o6GwkcpxaOYpmLT9KW A0M9NhL3KHLplBsyr4jcZAy8tV5509u7FsjsxCFJrPp06b7FZ7pwaH1nbLnnksgf1L+b 4umwNrqjWJZmsFmbTzTKUvSLVtR7ROAh/m4qRg5juyjg/BUkXz7GxEUcFr4a+kFWKPWQ w8mDoFTt2M98vJXMCy/rgtLF6uaVqfMGTc0YmnMsusN1AxGfVNxsuVb7+RLK66jYZDYe mh3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qwQ9PGD8JYBaJEUwYaNKOztNdvsthQ8POu4+c0qzYlM=; b=dRCBlFZ5n7jIUQZB+RpLK9s7uo2DO4/219wTQSd4U6TO0dha0JSsClXVZ1+E3Jjz4U TqloMhpAvvCfvIGy+XYHoax4AtIX6M4nNmi5/jhpG68/22bAO7eFpF3QTWiri3569B1A 4oDBPm6n4adE7pxuIlYRjqcmu19MPAMG9s9TRGPk4qYDoBgy2O+DRaM4qabHBdzQsDJn Y3KB25bpgtIFMUKYiHivBI/8ALaCe7jXx0sQcFD2OIs/TiNjRqbXWvXvQPryJuhMJJW8 HMNAggpgy7//6ReoousTZ+jG8cnuZRpAMbSFfx75fxo2TgLaGCPwaD+bM8S3EV1ruHXJ NQng== X-Gm-Message-State: AGi0PuZIMnGhT7EOKkNEYhTFvUMg6WPW7D+dyog9+glgLE1vRTQ3o38f XtA0fJJzhnyEAOWeRR67BEjFbQ== X-Received: by 2002:adf:afdf:: with SMTP id y31mr5939803wrd.120.1587661570778; Thu, 23 Apr 2020 10:06:10 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id o28sm4531899wra.84.2020.04.23.10.06.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 10:06:04 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 1B8A51FF98; Thu, 23 Apr 2020 18:05:58 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 09/14] gdbstub: eliminate gdbserver_fd global Date: Thu, 23 Apr 2020 18:05:52 +0100 Message-Id: <20200423170557.31106-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200423170557.31106-1-alex.bennee@linaro.org> References: <20200423170557.31106-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::441; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x441.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::441 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We don't really need to track this fd beyond the initial creation of the socket. We already know if the system has been initialised by virtue of the gdbserver_state so lets remove it. This makes the later re-factoring easier. Signed-off-by: Alex Bennée --- gdbstub.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/gdbstub.c b/gdbstub.c index 171e150950..8c53cc0e1c 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -398,8 +398,6 @@ static void reset_gdbserver_state(void) bool gdb_has_xml; #ifdef CONFIG_USER_ONLY -/* XXX: This is not thread safe. Do we care? */ -static int gdbserver_fd = -1; static int get_char(void) { @@ -2964,7 +2962,7 @@ void gdb_exit(CPUArchState *env, int code) return; } #ifdef CONFIG_USER_ONLY - if (gdbserver_fd < 0 || gdbserver_state.fd < 0) { + if (gdbserver_state.fd < 0) { return; } #endif @@ -3011,7 +3009,7 @@ gdb_handlesig(CPUState *cpu, int sig) char buf[256]; int n; - if (gdbserver_fd < 0 || gdbserver_state.fd < 0) { + if (!gdbserver_state.init || gdbserver_state.fd < 0) { return sig; } @@ -3060,7 +3058,7 @@ void gdb_signalled(CPUArchState *env, int sig) { char buf[4]; - if (gdbserver_fd < 0 || gdbserver_state.fd < 0) { + if (!gdbserver_state.init || gdbserver_state.fd < 0) { return; } @@ -3068,7 +3066,7 @@ void gdb_signalled(CPUArchState *env, int sig) put_packet(buf); } -static bool gdb_accept(void) +static bool gdb_accept(int gdb_fd) { struct sockaddr_in sockaddr; socklen_t len; @@ -3076,7 +3074,7 @@ static bool gdb_accept(void) for(;;) { len = sizeof(sockaddr); - fd = accept(gdbserver_fd, (struct sockaddr *)&sockaddr, &len); + fd = accept(gdb_fd, (struct sockaddr *)&sockaddr, &len); if (fd < 0 && errno != EINTR) { perror("accept"); return false; @@ -3137,13 +3135,12 @@ static int gdbserver_open(int port) int gdbserver_start(int port) { - gdbserver_fd = gdbserver_open(port); - if (gdbserver_fd < 0) + int gdb_fd = gdbserver_open(port); + if (gdb_fd < 0) return -1; /* accept connections */ - if (!gdb_accept()) { - close(gdbserver_fd); - gdbserver_fd = -1; + if (!gdb_accept(gdb_fd)) { + close(gdb_fd); return -1; } return 0; @@ -3152,7 +3149,7 @@ int gdbserver_start(int port) /* Disable gdb stub for child processes. */ void gdbserver_fork(CPUState *cpu) { - if (gdbserver_fd < 0 || gdbserver_state.fd < 0) { + if (!gdbserver_state.init || gdbserver_state.fd < 0) { return; } close(gdbserver_state.fd); From patchwork Thu Apr 23 17:05:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185742 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2304413ilf; Thu, 23 Apr 2020 10:15:49 -0700 (PDT) X-Google-Smtp-Source: APiQypINIRCKG0Kjqpe9nmyhfztHa7OWHTLb6cCMtQKVQ54YuVsFL+2z0yOOHYV3F9tEM4nAfufz X-Received: by 2002:a05:6214:17d0:: with SMTP id cu16mr5200031qvb.177.1587662148863; Thu, 23 Apr 2020 10:15:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587662148; cv=none; d=google.com; s=arc-20160816; b=uY3RuN6QpQ2L2GmlwDt0cVCxnrTQGLyLwRdSSytIItafaL2vtCVGFgVhfG6s1BdrXe PHORqlO5ChpquNWJOFTcZgul0QzSe5brgEYz5DKvJ/NwXZkzLpkXLQY+iUdwwmLfnulJ j+yIq6VYHTdd1eDAgcQh3HJvvdQZglMae4akFZLXfG1wzGG0w15yH1TQ42YJuRq1lr67 XOhd8bCBCkQzbsnXoCZAgqm0K2e/Y6xnAFZS9E8s1YVJU1RvUCu5LAtHeGvQ9qavdIbD BoWbucISIL76gizEa5I6Ev1eCAZxbvv8fOR8OznSglHlZ3jEvHAe3fLzSWee8KxQubKj NuLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=aHegfHPgyPs1Wvs1cpXFErjCleZY/bKPEApSTIkCDYM=; b=pkKTurpkXoTvKDLj/uv/XvdBUzp6AgOfZh+UomxIdyeTvJdx9rWQdJl9ny88FpGxUs ytZh6p6ViE8UPRXn0Jnx7zjSTDbKaN4gLc/ovl1cwWcTezi4hbkqmRmn0VbmAsK8a1KX nWkdy+mHPKAqymMDZTDY+W5wKloCiL7cG/CdgxKIK4R2eVN4LKzwAXlkffTN3NMq0kLD vuLYGI4p4r0i9bYaFUrWj0bybMsC4v/MYW47L4ksY+ev8cU0At2GjC8jqgek3yzYK/tz efgUfua1neRNQMxGmTgj1T6q5244VyuR5e6CBZ5FTud3+eui4RaDLGm0MlnRGnFmW+b1 IDvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YwgH2nwJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w70si1722457qkb.360.2020.04.23.10.15.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Apr 2020 10:15:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YwgH2nwJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfS0-0004Ax-Ad for patch@linaro.org; Thu, 23 Apr 2020 13:15:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44766) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfIx-0001mD-C1 for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRfIi-0005Wn-3w for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:27 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:55575) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRfIh-0005W7-LE for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:11 -0400 Received: by mail-wm1-x341.google.com with SMTP id e26so7201688wmk.5 for ; Thu, 23 Apr 2020 10:06:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aHegfHPgyPs1Wvs1cpXFErjCleZY/bKPEApSTIkCDYM=; b=YwgH2nwJzth0i/Drozrc5MqkxpyyRPV4Dkl4+8SJXjBRqkKPf9ZY/ouUwdBSyafLWF AZd9U0rXOBSbD6Ot6ipWFOrGlAbvTmowTHgqxihjVq3RR7tupuR5OMJpZOkPfo/9JNGY fd1If3Obd4chH9j4lgfPbbDiCpgn9Sx3khqGYFkH9ixQPndURuIeqY2rW8TfWEgzk0z8 WpE7L084ANuthoIRfYfFCOO6OzJDpRPPBVCISwNRdeSBE3psNMLAskARPadVCMtfjMCj rVYjBDwSS1Gxsq5qCbUjns4QRlFPWoo9CIDLLElyeWgj+vy+Zysy8UkERiGsR79aK6FA bS+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aHegfHPgyPs1Wvs1cpXFErjCleZY/bKPEApSTIkCDYM=; b=Q+JHIuwk51Y6D1u070AfQpEFzEvqE32ZD5Lj8pq+o18BLA/0Q5BVGAohpPvXOAR+Cu 2pCQ/raGJ9n3OEawdXP34x+i0VKauBP25Xf+/ue9TD0lq9OR2rxZn+QvE/I9rtcb00+c JdOyKTxzVtnaDWmulvszUCXo7KiRCtslQ5CWaNIoKWgkGQUsBu/EhQnBdFn40BlKxqI0 yY6qt0RItG9kcPnkn0dFjMAc0vyXumL6uLRBi4G3UHUlN1BAUlmmSXdGNpC2vrEVvrnh 41x9gx5yn1H6T86udVIdVL1FaYznRyg1BDkBsB56mBIVIVx3ecj5yRT2siY2KOFICPEZ dtCw== X-Gm-Message-State: AGi0PuZTLffzn2bk7tbuz444toH1HGGakPaR2W+n/ZtQUtNS1krv+pqf 3pTAEDIveBoc8mN/IyWHdv5d5Q== X-Received: by 2002:a1c:6389:: with SMTP id x131mr5362749wmb.155.1587661569900; Thu, 23 Apr 2020 10:06:09 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id s18sm4766801wra.94.2020.04.23.10.06.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 10:06:04 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 38BB91FF99; Thu, 23 Apr 2020 18:05:58 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 10/14] gdbstub/linux-user: support debugging over a unix socket Date: Thu, 23 Apr 2020 18:05:53 +0100 Message-Id: <20200423170557.31106-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200423170557.31106-1-alex.bennee@linaro.org> References: <20200423170557.31106-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::341; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x341.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::341 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Riku Voipio , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" While debugging over TCP is fairly straightforward now we have test cases that want to orchestrate via make and currently a parallel build fails as two processes can't use the same listening port. While system emulation offers a wide cornucopia of connection methods thanks to the chardev abstraction we are a little more limited for linux user. Thankfully the programming API for a TCP socket and a local UNIX socket is pretty much the same once it's set up. Signed-off-by: Alex Bennée --- include/exec/gdbstub.h | 14 ++++-- bsd-user/main.c | 8 +-- gdbstub.c | 107 ++++++++++++++++++++++++++++++++++------- linux-user/main.c | 12 ++--- 4 files changed, 108 insertions(+), 33 deletions(-) -- 2.20.1 diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 4a2b8e3089..94d8f83e92 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -177,11 +177,15 @@ static inline uint8_t * gdb_get_reg_ptr(GByteArray *buf, int len) #endif -#ifdef CONFIG_USER_ONLY -int gdbserver_start(int); -#else -int gdbserver_start(const char *port); -#endif +/** + * gdbserver_start: start the gdb server + * @port_or_device: connection spec for gdb + * + * For CONFIG_USER this is either a tcp port or a path to a fifo. For + * system emulation you can use a full chardev spec for your gdbserver + * port. + */ +int gdbserver_start(const char *port_or_device); void gdbserver_cleanup(void); diff --git a/bsd-user/main.c b/bsd-user/main.c index aef5531628..0bfe46cff9 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -738,7 +738,7 @@ int main(int argc, char **argv) CPUState *cpu; int optind; const char *r; - int gdbstub_port = 0; + const char *gdbstub = NULL; char **target_environ, **wrk; envlist_t *envlist = NULL; char *trace_file = NULL; @@ -814,7 +814,7 @@ int main(int argc, char **argv) exit(1); } } else if (!strcmp(r, "g")) { - gdbstub_port = atoi(argv[optind++]); + gdbstub = g_strdup(argv[optind++]); } else if (!strcmp(r, "r")) { qemu_uname_release = argv[optind++]; } else if (!strcmp(r, "cpu")) { @@ -1124,8 +1124,8 @@ int main(int argc, char **argv) #error unsupported target CPU #endif - if (gdbstub_port) { - gdbserver_start (gdbstub_port); + if (gdbstub) { + gdbserver_start(gdbstub); gdb_handlesig(cpu, 0); } cpu_loop(env); diff --git a/gdbstub.c b/gdbstub.c index 8c53cc0e1c..51e2ab9110 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -355,6 +355,7 @@ typedef struct GDBState { int signal; #ifdef CONFIG_USER_ONLY int fd; + char *socket_path; int running_state; #else CharBackend chr; @@ -2962,6 +2963,9 @@ void gdb_exit(CPUArchState *env, int code) return; } #ifdef CONFIG_USER_ONLY + if (gdbserver_state.socket_path) { + unlink(gdbserver_state.socket_path); + } if (gdbserver_state.fd < 0) { return; } @@ -3034,7 +3038,6 @@ gdb_handlesig(CPUState *cpu, int sig) n = read(gdbserver_state.fd, buf, 256); if (n > 0) { int i; - for (i = 0; i < n; i++) { gdb_read_byte(buf[i]); } @@ -3066,7 +3069,66 @@ void gdb_signalled(CPUArchState *env, int sig) put_packet(buf); } -static bool gdb_accept(int gdb_fd) +static void gdb_accept_init(int fd) +{ + init_gdbserver_state(); + create_default_process(&gdbserver_state); + gdbserver_state.processes[0].attached = true; + gdbserver_state.c_cpu = gdb_first_attached_cpu(); + gdbserver_state.g_cpu = gdbserver_state.c_cpu; + gdbserver_state.fd = fd; + gdb_has_xml = false; +} + +static bool gdb_accept_socket(int gdb_fd) +{ + int fd; + + for(;;) { + fd = accept(gdb_fd, NULL, NULL); + if (fd < 0 && errno != EINTR) { + perror("accept socket"); + return false; + } else if (fd >= 0) { + qemu_set_cloexec(fd); + break; + } + } + + gdb_accept_init(fd); + return true; +} + +static int gdbserver_open_socket(const char *path) +{ + struct sockaddr_un sockaddr; + int fd, ret; + + fd = socket(AF_UNIX, SOCK_STREAM, 0); + if (fd < 0) { + perror("create socket"); + return -1; + } + + sockaddr.sun_family = AF_UNIX; + pstrcpy(sockaddr.sun_path, sizeof(sockaddr.sun_path)-1, path); + ret = bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)); + if (ret < 0) { + perror("bind socket"); + close(fd); + return -1; + } + ret = listen(fd, 1); + if (ret < 0) { + perror("listen socket"); + close(fd); + return -1; + } + + return fd; +} + +static bool gdb_accept_tcp(int gdb_fd) { struct sockaddr_in sockaddr; socklen_t len; @@ -3091,17 +3153,11 @@ static bool gdb_accept(int gdb_fd) return false; } - init_gdbserver_state(); - create_default_process(&gdbserver_state); - gdbserver_state.processes[0].attached = true; - gdbserver_state.c_cpu = gdb_first_attached_cpu(); - gdbserver_state.g_cpu = gdbserver_state.c_cpu; - gdbserver_state.fd = fd; - gdb_has_xml = false; + gdb_accept_init(fd); return true; } -static int gdbserver_open(int port) +static int gdbserver_open_port(int port) { struct sockaddr_in sockaddr; int fd, ret; @@ -3130,20 +3186,35 @@ static int gdbserver_open(int port) close(fd); return -1; } + return fd; } -int gdbserver_start(int port) +int gdbserver_start(const char *port_or_path) { - int gdb_fd = gdbserver_open(port); - if (gdb_fd < 0) - return -1; - /* accept connections */ - if (!gdb_accept(gdb_fd)) { - close(gdb_fd); + int port = g_ascii_strtoull(port_or_path, NULL, 10); + int gdb_fd; + + if (port > 0) { + gdb_fd = gdbserver_open_port(port); + } else { + gdb_fd = gdbserver_open_socket(port_or_path); + } + + if (gdb_fd < 0) { return -1; } - return 0; + + if (port > 0 && gdb_accept_tcp(gdb_fd)) { + return 0; + } else if (gdb_accept_socket(gdb_fd)) { + gdbserver_state.socket_path = g_strdup(port_or_path); + return 0; + } + + /* gone wrong */ + close(gdb_fd); + return -1; } /* Disable gdb stub for child processes. */ diff --git a/linux-user/main.c b/linux-user/main.c index 90ad365b43..3597e99bb1 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -52,7 +52,7 @@ char *exec_path; int singlestep; static const char *argv0; -static int gdbstub_port; +static const char *gdbstub; static envlist_t *envlist; static const char *cpu_model; static const char *cpu_type; @@ -311,7 +311,7 @@ static void handle_arg_seed(const char *arg) static void handle_arg_gdb(const char *arg) { - gdbstub_port = atoi(arg); + gdbstub = g_strdup(arg); } static void handle_arg_uname(const char *arg) @@ -840,10 +840,10 @@ int main(int argc, char **argv, char **envp) target_cpu_copy_regs(env, regs); - if (gdbstub_port) { - if (gdbserver_start(gdbstub_port) < 0) { - fprintf(stderr, "qemu: could not open gdbserver on port %d\n", - gdbstub_port); + if (gdbstub) { + if (gdbserver_start(gdbstub) < 0) { + fprintf(stderr, "qemu: could not open gdbserver on %s\n", + gdbstub); exit(EXIT_FAILURE); } gdb_handlesig(cpu, 0); From patchwork Thu Apr 23 17:05:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185738 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2300335ilf; Thu, 23 Apr 2020 10:12:14 -0700 (PDT) X-Google-Smtp-Source: APiQypJN/5SGQHTqf1ob9OIrLJFcMvQNEbW5FGLLcF2MxCmBuLO2pYNx7QBfQNTUdsoCdBXFenu9 X-Received: by 2002:a37:66d8:: with SMTP id a207mr4543340qkc.127.1587661934128; Thu, 23 Apr 2020 10:12:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587661934; cv=none; d=google.com; s=arc-20160816; b=M25aEjYkt2HX3A4mBdApd/x51j90fUdYnMkgK5TrTu8VChuFjBaMTvmaaFtVq1dUAN phGriTIAbxJBaWvVTYoUuaw0NeO7cs3X+5lGke19bVShkXOL1uLH4xngT+C5PJGcvxkG z/OsZ0lOfrPpYYAnTco4n9Q1ga6c8QRFQ+EmwYt9ZOgy3jcEPh6DDDJ8KW5JNAzrTe1p ExsiemGt6WYCO5l2KCgwHxzJYjeqabI60UMJfkb2HpChjnxuo1JJ4eXqbZ+rNN9cUVLv O2J9VRn46uNwaJS3DF1/Ji3dd0dZofyG8YBRLhSsS0ldsBz7lfcdGtx5LLckmkilX2Uv 9lcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Y8OzSKmIFiuLHfxz8DEOePw2xLZ8ATDtg6VRRYMl4sc=; b=xZHri9G7o0d/JjWRBPz2VdDfi1vHSyj3vNOwjtlDtHp+dOxngwGclWFCRFCxq2yTL8 jxueDjGExWI9ELEByxqMIMYbZLQeDX0DxiqAV8zE7rxOZmGMXFxPtn1eARNsiLwbl6mT uVVhh/ZsmngJGjHvB1GKllqBvejl6XMN9EixaKneOjAAllShLWk9ZNnqirFgfkwH1Ycv VkUCwAY1qrxht0HSVDTtyVBBL5dlKONKw7IKDA69JPwCNPILsMSkYEFSK+Whv7EXwcfS TgWPcQk4bPXVuPpSZQsCnBL+rudaUd0D8uHkJTRbKKleeXNJQLbq+BZNn+VdL/+OKNN1 DxGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wYg220OT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o3si1730552qkj.31.2020.04.23.10.12.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Apr 2020 10:12:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wYg220OT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:32848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfOX-0006js-Ib for patch@linaro.org; Thu, 23 Apr 2020 13:12:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44686) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfIm-0001JC-F4 for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRfIl-0005bo-Sp for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:16 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:34459) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRfIl-0005bB-F1 for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:15 -0400 Received: by mail-wr1-x443.google.com with SMTP id j1so7717940wrt.1 for ; Thu, 23 Apr 2020 10:06:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y8OzSKmIFiuLHfxz8DEOePw2xLZ8ATDtg6VRRYMl4sc=; b=wYg220OTNpfgoYnWxxgyBCi5xOG4qmF9wbC9NzmnwLUZT6drZM0KuvZFIXnmpccHmb vauj8E/R7uYV7LmV1unP4OdVwij3vZ5S7QIYsR/L/3/zDgV3WI1ziUeJ7nR3rYxmKrK+ qrgcB0AG0i/LJXScpR8lrmJRU77k253bf9eCKeWLhFhMFCaVl/dY9S9eyBBRqWNT7b2X H/nIgeJQ6Ooxva0ZoHX2dSAlJgthdW69OsmrCPb+6DEwYblUGei0bx2bpzb560Bld5da PnWdjFU8rJogvgtaqgWG9jH6Sv34ClIRVN96b9JGs4MV0Gy+gbMlWoUh1ROq/idW+zhQ HN3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y8OzSKmIFiuLHfxz8DEOePw2xLZ8ATDtg6VRRYMl4sc=; b=F2k4V74Bu8vQynmfKHFOiHWQJeCKNO+nO+luudFBnMV2TOqVHxhWrrWfEBbfzibCOA tkGyel2bTSM5hqFFIdVXl66DMiXU+iY2avNUpaFM1Rp2TcRwwTSRvfPEJ0cRbcGo4Qi5 C2OxFYbjCTWLtlUnGvgZ+yOHsNbA/QA92YuYGy39K+CBXKsb9p01ljLswJomNybajxnI jvDws7XcPQVH0dvEwAXvIsSZgqbRO7poKFK9q9Ue7BPHdk89Orkd2dIWYdpdHNtbvwGf E+c46ZaTEU9bPoZqZWE/QSJUYvHoPyVos+QmruPuCmwnVgTrupYCTzVhLouS9ALJcC4z WnHQ== X-Gm-Message-State: AGi0PuaKzpr/H6NC978hUYMKASPjAXB9diAam1HQvtKyX7JP8TDHhmMg vTTb0HyU67s3k3iECuAQr206U4hhIOo= X-Received: by 2002:a5d:4b43:: with SMTP id w3mr6095741wrs.208.1587661573681; Thu, 23 Apr 2020 10:06:13 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id b2sm5216121wrn.6.2020.04.23.10.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 10:06:05 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4EC961FF9A; Thu, 23 Apr 2020 18:05:58 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 11/14] tests/guest-debug: use the unix socket for linux-user tests Date: Thu, 23 Apr 2020 18:05:54 +0100 Message-Id: <20200423170557.31106-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200423170557.31106-1-alex.bennee@linaro.org> References: <20200423170557.31106-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::443 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Now we have support for debugging over a unix socket for linux-user lets use it in our test harness. Signed-off-by: Alex Bennée --- tests/guest-debug/run-test.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py index 2bbb8fbaa3..2441a1d623 100755 --- a/tests/guest-debug/run-test.py +++ b/tests/guest-debug/run-test.py @@ -15,6 +15,8 @@ import argparse import subprocess import shutil import shlex +import os +from tempfile import TemporaryDirectory def get_args(): parser = argparse.ArgumentParser(description="A gdbstub test runner") @@ -41,11 +43,14 @@ if __name__ == '__main__': print("We need gdb to run the test") exit(-1) + socket_dir = TemporaryDirectory("qemu-gdbstub") + socket_name = os.path.join(socket_dir.name, "gdbstub.socket") + # Launch QEMU with binary if "system" in args.qemu: cmd = "%s %s %s -s -S" % (args.qemu, args.qargs, args.binary) else: - cmd = "%s %s -g 1234 %s" % (args.qemu, args.qargs, args.binary) + cmd = "%s %s -g %s %s" % (args.qemu, args.qargs, socket_name, args.binary) inferior = subprocess.Popen(shlex.split(cmd)) @@ -56,7 +61,10 @@ if __name__ == '__main__': # disable prompts in case of crash gdb_cmd += " -ex 'set confirm off'" # connect to remote - gdb_cmd += " -ex 'target remote localhost:1234'" + if "system" in args.qemu: + gdb_cmd += " -ex 'target remote localhost:1234'" + else: + gdb_cmd += " -ex 'target remote %s'" % (socket_name) # finally the test script itself gdb_cmd += " -x %s" % (args.test) From patchwork Thu Apr 23 17:05:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185740 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2302600ilf; Thu, 23 Apr 2020 10:14:14 -0700 (PDT) X-Google-Smtp-Source: APiQypJKXt2f2IMIOfM6k0XEGHNgBpX7XzfA0tL6CKzE93KPeEa8+cb075mUz/Et2tlioUTIxLFP X-Received: by 2002:a0c:ac41:: with SMTP id m1mr5238244qvb.71.1587662054344; Thu, 23 Apr 2020 10:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587662054; cv=none; d=google.com; s=arc-20160816; b=gKB6Fc6UtdUzoxVT5S5xerHu59eMTax52C0VxETbrPjAXx4KyCgP6nUfHJNr7fowFN R9hYOHegENMFnauGHB2Q3Fm+fnGb7afxfOcLy1wc+6LoDL3ny/m8WfNLUUua2n/NsEVG 0UEye92g2FkpjHPfq/9yJ05XfBaKEf/bGb4UDKfTFL3lUQQd3F5HWU7yoL+7gPdBptDn 5FghcOuXLWmjflvi7ZIRoQzTkVAcQMrnrPIAYG9p8V13jc+h4LByhNNyaWsFB2EIeM9S 4T/l0l0tYFeCKYg9QE7HxsLbCMb0kZM/5UfB2xTr4vbYdxFWOnOCTDoFCQPYaewDiwfN L7TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=67oQwpEs2PvLm/27/7hAV2hnOAJBQY7TkPiq2zfh6Fw=; b=rzf7GMb4cPdE2lPUfWO8LstJ+rgIuOwwtLpuplhGz5z5tm2QkyGhbOOntu/BSmhIGO hdjiVnAqnSl0nUCzDf4cYTXOkHgeH5oL9CMDnpEbEax/Hn0F6x0K1jYAFTIlYemlPtBk 1Fx+x0OP66RBYv9gf/zrK7d2SfyO7s1yEIwgATu5UyLKHsR1p3hvmLtr5RZrdmRT24Dp fczt3G0wG+IhtwxCqva3cLLOMoGsaUOsQNbwwtY3NdOMYsfRcxGocWrTKqC3bk+gSRn0 VuUEP66emp/i4RLEwlWqOGUFM67jcndheV2FVDB5+t2PJtz8AV1a3YgJa1HV8b+oEUdV eMFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=brad7Rq2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z17si1721047qtv.48.2020.04.23.10.14.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Apr 2020 10:14:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=brad7Rq2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:32994 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfQT-0001YM-Px for patch@linaro.org; Thu, 23 Apr 2020 13:14:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44712) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfIp-0001Ry-1a for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRfIo-0005f7-5l for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:18 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:37935) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRfIn-0005cr-OR for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:17 -0400 Received: by mail-wm1-x343.google.com with SMTP id g12so7333261wmh.3 for ; Thu, 23 Apr 2020 10:06:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=67oQwpEs2PvLm/27/7hAV2hnOAJBQY7TkPiq2zfh6Fw=; b=brad7Rq2sbjxkQJ7dfaw01wkBgXa0jBPIMo/EVMbjnVrcLk1SDk7BUy4E8L1/D0WPg 3Cnfuw+DiiaijgZBK0hJnGzuHfUde0u3TMArRWizTB5UX4MMghPfGzWg0YJtCz2VREsc iJzi/8k7f7vcvGE7XPlVCEVc8a76bVaprCtfWS/tqqHBODiUl271q5T3y+APjhZtQGmr Q6DbPskYNaLtFfGVvA4DzMD+O3cRTkE/wz9nitkbR5BgMahZVYDI0/IRLnU7+dQ+lWi9 PfcIIMUQwKSovNeihWUbaOtD493KAODS8MUwPkSDiW4mLP/sBjG9805NWuN7vTYuhMHF LD5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=67oQwpEs2PvLm/27/7hAV2hnOAJBQY7TkPiq2zfh6Fw=; b=szVotpU2QY6pNfI5mvNMAEGECVViSAFENH0tbo4C2WsDPTUorUyb/A7TbisUo5Xjq2 +pC/hX0suvF0hDe45w4m0Meoq9Y81eW1ix4023LwIsKlxpNSxVD5HcET8dbVqYqFeRde AKomXG5VPx4vmZ1JBp+obv5Cqwuh57OccfrJC7ULiXmlIsjYxMgNQdKdNItgyBjrppI6 bWlZV5mXqr7kjT7Gb+X69eoRln50gZAVgr7Nw6I/xH+Rqpi/2AiL9fg/BlXQwomIgoMU 4Iw7kfNwufPbnClw2G/HIMoMrFOa+0MygdWEu13V1O7P0fWPtYcN/VBNEkC5M/BS4G5t LKYQ== X-Gm-Message-State: AGi0PubmvbYph1KiW/bdwwB5r/ryvxOI/r2rYdtG2G355eCR2z/tRkdp nvyupBFpvIlfQjO6wnKg7Kivbw== X-Received: by 2002:a1c:5403:: with SMTP id i3mr5477209wmb.10.1587661576163; Thu, 23 Apr 2020 10:06:16 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id t17sm4188958wro.2.2020.04.23.10.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 10:06:05 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 68FF51FF9B; Thu, 23 Apr 2020 18:05:58 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 12/14] tests/tcg: add a multiarch linux-user gdb test Date: Thu, 23 Apr 2020 18:05:55 +0100 Message-Id: <20200423170557.31106-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200423170557.31106-1-alex.bennee@linaro.org> References: <20200423170557.31106-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::343; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x343.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::343 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , "open list:ARM TCG CPUs" , =?utf-8?q?Alex_Benn=C3=A9e?= , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" When the gdbstub code was converted to the new API we missed a few snafus in the various guests. Add a simple gdb test script which can be used on all our linux-user guests to check for obvious failures. Signed-off-by: Alex Bennée --- v2 - use EXTRA_RUNS to queue the tests so as not to break plugins --- tests/tcg/aarch64/Makefile.target | 5 +- tests/tcg/cris/Makefile.target | 1 + tests/tcg/multiarch/Makefile.target | 14 +++++ tests/tcg/multiarch/gdbstub/sha1.py | 81 +++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 tests/tcg/multiarch/gdbstub/sha1.py -- 2.20.1 diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target index d99b2a9ece..312f36cde5 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -54,9 +54,6 @@ sve-ioctls: CFLAGS+=-march=armv8.1-a+sve ifneq ($(HAVE_GDB_BIN),) GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py -AARCH64_TESTS += gdbstub-sysregs gdbstub-sve-ioctls - -.PHONY: gdbstub-sysregs gdbstub-sve-ioctls run-gdbstub-sysregs: sysregs $(call run-test, $@, $(GDB_SCRIPT) \ --gdb $(HAVE_GDB_BIN) \ @@ -70,6 +67,8 @@ run-gdbstub-sve-ioctls: sve-ioctls --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ --bin $< --test $(AARCH64_SRC)/gdbstub/test-sve-ioctl.py, \ "basic gdbstub SVE ZLEN support") + +EXTRA_RUNS += run-gdbstub-sysregs run-gdbstub-sve-ioctls endif endif diff --git a/tests/tcg/cris/Makefile.target b/tests/tcg/cris/Makefile.target index 24c7f2e761..e72d3cbdb2 100644 --- a/tests/tcg/cris/Makefile.target +++ b/tests/tcg/cris/Makefile.target @@ -23,6 +23,7 @@ CRIS_RUNS = $(patsubst %, run-%, $(CRIS_USABLE_TESTS)) # override the list of tests, as we can't build the multiarch tests TESTS = $(CRIS_USABLE_TESTS) +EXTRA_RUNS = VPATH = $(CRIS_SRC) AS = $(CC) -x assembler-with-cpp diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target index 035b09c853..51fb75ecfd 100644 --- a/tests/tcg/multiarch/Makefile.target +++ b/tests/tcg/multiarch/Makefile.target @@ -42,5 +42,19 @@ run-test-mmap-%: test-mmap $(call run-test, test-mmap-$*, $(QEMU) -p $* $<,\ "$< ($* byte pages) on $(TARGET_NAME)") +ifneq ($(HAVE_GDB_BIN),) +GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py + +run-gdbstub-sha1: sha1 + $(call run-test, $@, $(GDB_SCRIPT) \ + --gdb $(HAVE_GDB_BIN) \ + --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ + --bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \ + "basic gdbstub support") + +EXTRA_RUNS += run-gdbstub-sha1 +endif + + # Update TESTS TESTS += $(MULTIARCH_TESTS) diff --git a/tests/tcg/multiarch/gdbstub/sha1.py b/tests/tcg/multiarch/gdbstub/sha1.py new file mode 100644 index 0000000000..734553b98b --- /dev/null +++ b/tests/tcg/multiarch/gdbstub/sha1.py @@ -0,0 +1,81 @@ +from __future__ import print_function +# +# A very simple smoke test for debugging the SHA1 userspace test on +# each target. +# +# This is launched via tests/guest-debug/run-test.py +# + +import gdb +import sys + +initial_vlen = 0 +failcount = 0 + +def report(cond, msg): + "Report success/fail of test" + if cond: + print("PASS: %s" % (msg)) + else: + print("FAIL: %s" % (msg)) + global failcount + failcount += 1 + +def check_break(sym_name): + "Setup breakpoint, continue and check we stopped." + sym, ok = gdb.lookup_symbol(sym_name) + bp = gdb.Breakpoint(sym_name) + + gdb.execute("c") + + # hopefully we came back + end_pc = gdb.parse_and_eval('$pc') + report(bp.hit_count == 1, + "break @ %s (%s %d hits)" % (end_pc, sym.value(), bp.hit_count)) + + bp.delete() + +def run_test(): + "Run through the tests one by one" + + check_break("SHA1Init") + + # check step and inspect values + gdb.execute("next") + val_ctx = gdb.parse_and_eval("context->state[0]") + exp_ctx = 0x67452301 + report(int(val_ctx) == exp_ctx, "context->state[0] == %x" % exp_ctx); + + gdb.execute("next") + val_ctx = gdb.parse_and_eval("context->state[1]") + exp_ctx = 0xEFCDAB89 + report(int(val_ctx) == exp_ctx, "context->state[1] == %x" % exp_ctx); + + # finally check we don't barf inspecting registers + gdb.execute("info registers") + +# +# This runs as the script it sourced (via -x, via run-test.py) +# +try: + inferior = gdb.selected_inferior() + arch = inferior.architecture() + print("ATTACHED: %s" % arch.name()) +except (gdb.error, AttributeError): + print("SKIPPING (not connected)", file=sys.stderr) + exit(0) + +try: + # These are not very useful in scripts + gdb.execute("set pagination off") + gdb.execute("set confirm off") + + # Run the actual tests + run_test() +except (gdb.error): + print ("GDB Exception: %s" % (sys.exc_info()[0])) + failcount += 1 + pass + +print("All tests complete: %d failures" % failcount) +exit(failcount) From patchwork Thu Apr 23 17:05:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185741 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2302604ilf; Thu, 23 Apr 2020 10:14:14 -0700 (PDT) X-Google-Smtp-Source: APiQypJzxGsrl23tfuWf4xKh99juYzFMQYL76fMHqxUCNcJ0S0cq1KWksSk2yLCxHdCONrfzieuZ X-Received: by 2002:a37:6285:: with SMTP id w127mr4770748qkb.189.1587662053959; Thu, 23 Apr 2020 10:14:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587662053; cv=none; d=google.com; s=arc-20160816; b=qYC8GxQtRtvNoiwl1s+vnCUnMZi5BRmvpRi5JSwIrsgE3uYTbZSdMMoD2NAE2vAZie kdhlFjArK49GBc/Kq4hJVx02QThiG5flyPLVtHIhyz7zndipU06kBr2q3SXzzLeKju1X 8OBtYeqdx0gjQ/l5K+U58AKSkpR1h7vv32mxbWzm14YfaFKmqGu5X9hGIcFmJCzZdHGY 21Z1WrEu+nOGB0/hV+uBLfaxQCgYa/8NV7M1K4T7DeSmGvIvH+VuC7/gaPQTxPJ8Petp loyf+a0Wu/Lxov83wva3psVQ9A0aIz7JoGGqzydGH8UGL8v9ismJLmRO5ohzVwB5Qyyn IvAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=kf0p55kOiK118/utgn//7jUqdaKpdOOWjZERXX6I/SQ=; b=V0rIc0mWph9+sR2M565PiudAAMKFH/mv6PTX1BeJw1SbXT0SdZBKucPcweavFIXiZJ SEoN9uRE/GYdEscF/LqxhFLoudeG1i6AB3r0SjkRVxN0zrOVUJ+KLx6yUUiMyPo7C4cL +6z5L7adI5IbgTS6TUXtt1oscCC2kCIFZkFgLVoOHWhhfjKF26ei40svwCq+WYm9kV++ XVhIW/Gc4vesJjD9ggEBHAn5lXrOiEaFUVc3eW7SLiFqOAuHjHLvzdbXTFbCtoIwZr+P 4z3uzsX6NYvu6BYRdIs+pQ4jqnNqXKnO8ajL59LM1RgJVpmxiiMClz7W0qeVv9orNzgD zv0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AZzKG99W; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n206si1793983qke.130.2020.04.23.10.14.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Apr 2020 10:14:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AZzKG99W; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:32998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfQT-0001YU-EI for patch@linaro.org; Thu, 23 Apr 2020 13:14:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44730) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfIp-0001UD-Ot for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRfIp-0005gs-7n for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:19 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:37730) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRfIo-0005en-Og for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:18 -0400 Received: by mail-wr1-x442.google.com with SMTP id k1so7729284wrx.4 for ; Thu, 23 Apr 2020 10:06:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kf0p55kOiK118/utgn//7jUqdaKpdOOWjZERXX6I/SQ=; b=AZzKG99Whs7a+qEtXmQJDjjsjjJUf4ImMMzXkhOw5NSM+eEzwecO8a4J+xhFpSP2NW pjs835vZ3vO5XAqbnRIMikBUsTECJrTjbZ07F6ZNKKrMMQFxfwEamUCXpI3PInksHKoU 0xBKS6BKWrOmdDGDu9OwVoq310T9S5smUuj+Nckqamh7R7BIHCRvPkZhE597i8CLUrzn Q9OI4J/Dr9antlIiLFVNfibqrFKXlL3eXULvkmn4v+IArzDvEmdoapZhNczY4NkFa3Rt FSaZEskLd+njvdvEOfS/EWxYlb2FxX1yYKW6RtuCV2BAT83v+OXGQxF3DKZdN4QEbfqL wQ2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kf0p55kOiK118/utgn//7jUqdaKpdOOWjZERXX6I/SQ=; b=fCehrksZtmC+EVpMH/zdJwCjnwk6sYRFfWJfGMYuk1z1AUfSHFaZCoVJGrdyDtEWFS 3dO4eL1So1qaY5SLYduIJQvJ8Co4R0eqtlQWCGTDb8TyJ1aTarZnMjs9KMdt7AzQar1Q kgLaEELf01RvmyNK8dCeewCBxEXx4qyKnUzkYWfR82HXhU318FquIeIov1+ujcAdGCp0 3epnPd2i2jAbiSKI/0OEmbvPNEBswCURdummVyT1YZLRNsASA2BfTZxS+djk25oL21o6 B4ShXsycGARRscUUGt/YMnGpiX1XNf0oVSD6JRsv5yV6ksXpM9ndjfR4613JCmd5R0y/ 4nOA== X-Gm-Message-State: AGi0Pub5d3kDunYSfrkRLNgWT/WM11fk1cHeIqpxVr/O9PI3cueA4raI AY3MadcMeM9qDDP7bw/WEx/zLQ== X-Received: by 2002:adf:fd0a:: with SMTP id e10mr5895094wrr.160.1587661577395; Thu, 23 Apr 2020 10:06:17 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id i6sm4946050wrc.82.2020.04.23.10.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 10:06:11 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 7D4EE1FF9C; Thu, 23 Apr 2020 18:05:58 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 13/14] .travis.yml: show free disk space at end of run Date: Thu, 23 Apr 2020 18:05:56 +0100 Message-Id: <20200423170557.31106-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200423170557.31106-1-alex.bennee@linaro.org> References: <20200423170557.31106-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::442; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x442.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::442 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alex Bennée --- .travis.yml | 1 + 1 file changed, 1 insertion(+) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/.travis.yml b/.travis.yml index 2fd63eceaa..a4c3c6c805 100644 --- a/.travis.yml +++ b/.travis.yml @@ -113,6 +113,7 @@ script: $(exit $BUILD_RC); fi after_script: + - df -h - if command -v ccache ; then ccache --show-stats ; fi From patchwork Thu Apr 23 17:05:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185739 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2301071ilf; Thu, 23 Apr 2020 10:12:53 -0700 (PDT) X-Google-Smtp-Source: APiQypLU1K/PgXQOjVDzvYs+yQ7Gxx0MILNdRunDBEbiElXBhxxbPx/wBzWAqS+Iy8m0EiHfcHTG X-Received: by 2002:ad4:42b1:: with SMTP id e17mr5185622qvr.149.1587661973551; Thu, 23 Apr 2020 10:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587661973; cv=none; d=google.com; s=arc-20160816; b=AarjeCa/YUC89Bxqxwy8yIH7LzPvfKni0rnIOAdrO/UB6KMolpzv4Rpzgu6TFOKcUM TDF9VMO8jOsrukuBoadQlvnAfLAGZOLkA/BdJ2XgnNbPzDJTbfaEoAn0I9LCjwgSNWu5 pKDJxEuDhSpaMKB2pFwdVUFmo3XAXP9B9ipFW4YVKiU/14ittd7RPBLqaluILELZcBc1 HGZoa8+hvY526V1HJU+jlZWOIu+ZLWMTf+G3RqHRI7+lgksb9shC5DT0YCJbG1578aMo /VlpcWjeryCUBCgXNJYWaH4IVUiRp2CseUJ80ws1CGUi5mSOib4MQ1k7/I8r1AjhQ/F5 oe3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=dbl7vz/2JDzRYFnfm6XKsckDvoap7FMNqmtKMQ9jX5c=; b=C3SAgi3CMs+IdeWMvOFvDfaKH7X6aScdNaTx+23jmWzD/jhO2pTD7yyImsVwdv2h2a lhuVpDX9LKZUyI/nmQj3hVe6d1UDGXSGjrrazVyVgR7ZX1RWvDvTiMbAdNXAd17xo1bL jjunNfGMxT4hOIBwMbNzq/rP2cROvOhU1iFE7zpLVnnzZ8/erd3fHvYgZvGsm/cA/Nzb vFn8Homh+fzZhxCwykrE9tXeNvzlTygmPxXbzWU4lc9Us9nPt8vOV3iqDsOFNdLjNAqM EAPpPHgw6WQlANNhYPxeL+vMOQrmLWf0RpxjpXNkLcofXTIJpLlCPxpchatHP97giG3M dEgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=B68PIvhB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c16si1723153qtd.254.2020.04.23.10.12.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Apr 2020 10:12:53 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=B68PIvhB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:32874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfPB-00079a-2J for patch@linaro.org; Thu, 23 Apr 2020 13:12:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44700) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRfIn-0001O4-Sa for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRfIn-0005dU-47 for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:17 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:56110) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRfIm-0005bm-M2 for qemu-devel@nongnu.org; Thu, 23 Apr 2020 13:06:16 -0400 Received: by mail-wm1-x336.google.com with SMTP id e26so7201991wmk.5 for ; Thu, 23 Apr 2020 10:06:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dbl7vz/2JDzRYFnfm6XKsckDvoap7FMNqmtKMQ9jX5c=; b=B68PIvhBuzDpuVi5b+BMq2qJcbrpy6e4xqEXDQJaax7k7sNBDQsfGbcdSpOmEAgao/ AMfOdaRFRyXmB0ox7BC/CCA1irRIhWFdCoUdBosO8jp2dA7XQPq5kFvWc8SlkBThwwsf +Ar1AlSmciDlTjPM3Dpyl6UOnYmV8b+QlyDVWOB4Sq/BjPcN5PGW4T8iGEkG5DwGYADQ CwLHb/IdS370Iou3j/WIIFPO3d96z9FyFR6obnRu7QUrq118SONEqqDUiVE886743TON DF6wSlDjhdb90BpLJhXo+SysiJGi3izd4qtW2ig83synYoofSNMjNWkX+3pzmsmugsP8 bseQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dbl7vz/2JDzRYFnfm6XKsckDvoap7FMNqmtKMQ9jX5c=; b=LrkR0PtBVWC45eotHrej/rvGVmTK3pvpWcdIZBx3zTDx6SwYncRR05ZFtK6eKqW9h9 f7j9KU+u5wedgKpwIuaP1br/C4x0R/aygRIT2piy4lKY3TpE0NdYg8kdDJkkzak0EHRF EqQxrig3ngWagpwIK70eDR2FwI2W3smfLsrjKZgK14UJ3r1XdH3icwSI1dBWkxaE4jXv eSqXT1WjnjPY9qMy3tVL/0aRUAvLsApqy2ODS2yJKsUmuQbphUlaavRht89KHt8JOTji Qdoxoq5RwO1qWFJsr6BREjRyUYmfaCdXUIZ9dUen3MgCJuLIJwyMoX2N7U56SNJ9Vzlo tFBw== X-Gm-Message-State: AGi0PuZYThDRYy5ZdoThMYGVCn7ebTA3ErkUDdYylzfR5wJ3j4q85B2s d2N7Md1r1bsFN97xUQiKGlsXHA== X-Received: by 2002:a1c:a344:: with SMTP id m65mr5238332wme.20.1587661574908; Thu, 23 Apr 2020 10:06:14 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id a67sm4735296wmc.30.2020.04.23.10.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 10:06:11 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 911391FF9D; Thu, 23 Apr 2020 18:05:58 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 14/14] .travis.yml: drop MacOSX Date: Thu, 23 Apr 2020 18:05:57 +0100 Message-Id: <20200423170557.31106-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200423170557.31106-1-alex.bennee@linaro.org> References: <20200423170557.31106-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x336.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::336 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This keeps breaking on Travis so lets just fall back to the Cirrus CI builds which seem to be better maintained. Fix up the comments while we are doing this as we never had a windows build. Signed-off-by: Alex Bennée --- .travis.yml | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/.travis.yml b/.travis.yml index a4c3c6c805..49267b73b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,8 @@ compiler: cache: # There is one cache per branch and compiler version. # characteristics of each job are used to identify the cache: - # - OS name (currently, linux, osx, or windows) + # - OS name (currently only linux) # - OS distribution (for Linux, xenial, trusty, or precise) - # - macOS image name (e.g., xcode7.2) # - Names and values of visible environment variables set in .travis.yml or Settings panel timeout: 1200 ccache: true @@ -271,31 +270,6 @@ jobs: - TEST_CMD="" - # MacOSX builds - cirrus.yml also tests some MacOS builds including latest Xcode - - - name: "OSX Xcode 10.3" - env: - - BASE_CONFIG="--disable-docs --enable-tools" - - CONFIG="--target-list=i386-softmmu,ppc-softmmu,ppc64-softmmu,m68k-softmmu,x86_64-softmmu" - os: osx - osx_image: xcode10.3 - compiler: clang - addons: - homebrew: - packages: - - ccache - - glib - - pixman - - gnu-sed - - python - update: true - before_script: - - brew link --overwrite python - - export PATH="/usr/local/opt/ccache/libexec:$PATH" - - mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR} - - ${SRC_DIR}/configure ${BASE_CONFIG} ${CONFIG} || { cat config.log && exit 1; } - - # Python builds - name: "GCC Python 3.5 (x86_64-softmmu)" env: