diff options
author | Andreas Grapentin <andreas@grapentin.org> | 2018-03-20 14:09:46 +0100 |
---|---|---|
committer | Andreas Grapentin <andreas@grapentin.org> | 2018-03-20 14:10:47 +0100 |
commit | b9afff56b2651322de7ea23792fb9daef478c219 (patch) | |
tree | ec8837d813b0bcb848ff7b1b8768acb63cf6fa73 /pcr | |
parent | 4727766b35ea63837841da6dccaa0a4ae5ad634e (diff) | |
download | abslibre-b9afff56b2651322de7ea23792fb9daef478c219.tar.gz abslibre-b9afff56b2651322de7ea23792fb9daef478c219.tar.bz2 abslibre-b9afff56b2651322de7ea23792fb9daef478c219.zip |
pcr/qemu-user-static-git: updated to v2.11.0.r2577.gc26ef39204
Diffstat (limited to 'pcr')
13 files changed, 80 insertions, 743 deletions
diff --git a/pcr/qemu-user-static-git/0001-fix-program-invocation-name.patch b/pcr/qemu-user-static-git/0001-fix-program-invocation-name.patch new file mode 100644 index 000000000..f2b915b67 --- /dev/null +++ b/pcr/qemu-user-static-git/0001-fix-program-invocation-name.patch @@ -0,0 +1,75 @@ +diff --git a/linux-user/main.c b/linux-user/main.c +index 108e1f202c..30cbb73496 100644 +--- a/linux-user/main.c ++++ b/linux-user/main.c +@@ -4450,7 +4450,7 @@ static void usage(int exitcode) + exit(exitcode); + } + +-static int parse_args(int argc, char **argv) ++static int parse_args(int argc, char **argv, int assume_P_flag) + { + const char *r; + int optind; +@@ -4467,6 +4467,19 @@ static int parse_args(int argc, char **argv) + } + } + ++ if (assume_P_flag) { ++ /* Assume started by binmisc and binfmt P flag is set */ ++ if (argc < 3) { ++ fprintf(stderr, "%s: Please use me through binfmt with P flag\n", ++ argv[0]); ++ exit(1); ++ } ++ filename = argv[1]; ++ exec_path = argv[1]; ++ /* Next argv must be argv0 for the app */ ++ return 2; ++ } ++ + optind = 1; + for (;;) { + if (optind >= argc) { +@@ -4565,7 +4578,8 @@ int main(int argc, char **argv, char **envp) + + qemu_add_opts(&qemu_trace_opts); + +- optind = parse_args(argc, argv); ++ execfd = qemu_getauxval(AT_EXECFD); ++ optind = parse_args(argc, argv, execfd > 0); + + if (!trace_init_backends()) { + exit(1); +@@ -4585,7 +4599,6 @@ int main(int argc, char **argv, char **envp) + + init_qemu_uname_release(); + +- execfd = qemu_getauxval(AT_EXECFD); + if (execfd == 0) { + execfd = open(filename, O_RDONLY); + if (execfd < 0) { +diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh +index f39ad344fc..d070c33a74 100755 +--- a/scripts/qemu-binfmt-conf.sh ++++ b/scripts/qemu-binfmt-conf.sh +@@ -292,7 +292,7 @@ SYSTEMDDIR="/etc/binfmt.d" + DEBIANDIR="/usr/share/binfmts" + + QEMU_PATH=/usr/local/bin +-FLAGS="" ++FLAGS="P" + + options=$(getopt -o ds:Q:e:hc: -l debian,systemd:,qemu-path:,exportdir:,help,credential: -- "$@") + eval set -- "$options" +@@ -341,9 +341,7 @@ while true ; do + -c|--credential) + shift + if [ "$1" = "yes" ] ; then +- FLAGS="OC" +- else +- FLAGS="" ++ FLAGS+="OC" + fi + ;; + *) diff --git a/pcr/qemu-user-static-git/0001-linux-user-Use-if-to-only-call-validate_guest_space-.patch b/pcr/qemu-user-static-git/0001-linux-user-Use-if-to-only-call-validate_guest_space-.patch deleted file mode 100644 index bbc3840fe..000000000 --- a/pcr/qemu-user-static-git/0001-linux-user-Use-if-to-only-call-validate_guest_space-.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 0c5afb7a15b6bb0e3fe276e377ad3702427e85d1 Mon Sep 17 00:00:00 2001 -From: Luke Shumaker <lukeshu@parabola.nu> -Date: Wed, 27 Dec 2017 03:33:21 -0500 -Subject: [PATCH 01/10] linux-user: Use #if to only call validate_guest_space - for 32-bit ARM target - -Instead of defining a bogus validate_guest_space that always returns 1 on -targets other than 32-bit ARM, use #if blocks to only call it on 32-bit ARM -targets. This makes the "normal" flow control clearer. - -Signed-off-by: Luke Shumaker <lukeshu@parabola.nu> ---- - linux-user/elfload.c | 21 +++++++++------------ - 1 file changed, 9 insertions(+), 12 deletions(-) - -diff --git a/linux-user/elfload.c b/linux-user/elfload.c -index 20f3d8c2c3..cac991159c 100644 ---- a/linux-user/elfload.c -+++ b/linux-user/elfload.c -@@ -354,7 +354,6 @@ enum { - - /* The commpage only exists for 32 bit kernels */ - --#define TARGET_HAS_VALIDATE_GUEST_SPACE - /* 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. -@@ -1823,15 +1822,6 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, - return sp; - } - --#ifndef TARGET_HAS_VALIDATE_GUEST_SPACE --/* If the guest doesn't have a validation function just agree */ --static int validate_guest_space(unsigned long guest_base, -- unsigned long guest_size) --{ -- return 1; --} --#endif -- - unsigned long init_guest_space(unsigned long host_start, - unsigned long host_size, - unsigned long guest_start, -@@ -1845,11 +1835,12 @@ unsigned long init_guest_space(unsigned long host_start, - /* 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 (validate_guest_space(host_start, host_size) == 1) { -- return host_start; -- } else { - return (unsigned long)-1; - } -+#endif -+ return host_start; - } - - /* Setup the initial flags and start address. */ -@@ -1888,6 +1879,8 @@ unsigned long init_guest_space(unsigned long host_start, - - /* Check to see if the address is valid. */ - if (!host_start || real_start == current_start) { -+#if defined(TARGET_ARM) && !defined(TARGET_AARCH64) -+ /* On 32-bit ARM, we need to also be able to map the commpage. */ - int valid = validate_guest_space(real_start - guest_start, - real_size); - if (valid == 1) { -@@ -1896,6 +1889,10 @@ unsigned long init_guest_space(unsigned long host_start, - return (unsigned long)-1; - } - /* valid == 0, so try again. */ -+#else -+ /* On other architectures, whatever we have here is fine. */ -+ break; -+#endif - } - - /* That address didn't work. Unmap and try a different one. --- -2.15.1 - diff --git a/pcr/qemu-user-static-git/0002-linux-user-Rename-validate_guest_space-init_guest_co.patch b/pcr/qemu-user-static-git/0002-linux-user-Rename-validate_guest_space-init_guest_co.patch deleted file mode 100644 index 06e508219..000000000 --- a/pcr/qemu-user-static-git/0002-linux-user-Rename-validate_guest_space-init_guest_co.patch +++ /dev/null @@ -1,54 +0,0 @@ -From b5b929b0423e5db333c9d5dfc104bb3598ff4182 Mon Sep 17 00:00:00 2001 -From: Luke Shumaker <lukeshu@parabola.nu> -Date: Thu, 28 Dec 2017 08:03:26 -0500 -Subject: [PATCH 02/10] linux-user: Rename validate_guest_space => - init_guest_commpage - -init_guest_commpage is a much more honest description of what the function -does. validate_guest_space not only suggests that the function has no -side-effects, but also introduces confusion as to why it is only needed on -32-bit ARM targets. - -Signed-off-by: Luke Shumaker <lukeshu@parabola.nu> ---- - linux-user/elfload.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/linux-user/elfload.c b/linux-user/elfload.c -index cac991159c..453394239c 100644 ---- a/linux-user/elfload.c -+++ b/linux-user/elfload.c -@@ -362,8 +362,8 @@ enum { - * The guest code may leave a page mapped and populate it if the - * address is suitable. - */ --static int validate_guest_space(unsigned long guest_base, -- unsigned long guest_size) -+static int init_guest_commpage(unsigned long guest_base, -+ unsigned long guest_size) - { - unsigned long real_start, test_page_addr; - -@@ -1836,7 +1836,7 @@ unsigned long init_guest_space(unsigned long host_start, - * address. */ - if (host_start && !host_size) { - #if defined(TARGET_ARM) && !defined(TARGET_AARCH64) -- if (validate_guest_space(host_start, host_size) == 1) { -+ if (init_guest_commpage(host_start, host_size) != 1) { - return (unsigned long)-1; - } - #endif -@@ -1881,8 +1881,8 @@ unsigned long init_guest_space(unsigned long host_start, - if (!host_start || real_start == current_start) { - #if defined(TARGET_ARM) && !defined(TARGET_AARCH64) - /* On 32-bit ARM, we need to also be able to map the commpage. */ -- int valid = validate_guest_space(real_start - guest_start, -- real_size); -+ int valid = init_guest_commpage(real_start - guest_start, -+ real_size); - if (valid == 1) { - break; - } else if (valid == -1) { --- -2.15.1 - diff --git a/pcr/qemu-user-static-git/0003-linux-user-init_guest_space-Clean-up-if-we-can-t-ini.patch b/pcr/qemu-user-static-git/0003-linux-user-init_guest_space-Clean-up-if-we-can-t-ini.patch deleted file mode 100644 index ea9eff138..000000000 --- a/pcr/qemu-user-static-git/0003-linux-user-init_guest_space-Clean-up-if-we-can-t-ini.patch +++ /dev/null @@ -1,29 +0,0 @@ -From c03d2cc51c5fa496f894b641c035b12e49fd637b Mon Sep 17 00:00:00 2001 -From: Luke Shumaker <lukeshu@parabola.nu> -Date: Wed, 27 Dec 2017 14:40:39 -0500 -Subject: [PATCH 03/10] linux-user: init_guest_space: Clean up if we can't - initialize the commpage - -We'll just exit with an error anyway, so it doesn't really matter, but it -is cleaned up in all of the other places were we error out. - -Signed-off-by: Luke Shumaker <lukeshu@parabola.nu> ---- - linux-user/elfload.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/linux-user/elfload.c b/linux-user/elfload.c -index 453394239c..1a6b660b25 100644 ---- a/linux-user/elfload.c -+++ b/linux-user/elfload.c -@@ -1886,6 +1886,7 @@ unsigned long init_guest_space(unsigned long host_start, - if (valid == 1) { - break; - } else if (valid == -1) { -+ munmap((void *)real_start, host_size); - return (unsigned long)-1; - } - /* valid == 0, so try again. */ --- -2.15.1 - diff --git a/pcr/qemu-user-static-git/0004-linux-user-init_guest_space-Correctly-handle-guest_s.patch b/pcr/qemu-user-static-git/0004-linux-user-init_guest_space-Correctly-handle-guest_s.patch deleted file mode 100644 index 7f9cfc7a8..000000000 --- a/pcr/qemu-user-static-git/0004-linux-user-init_guest_space-Correctly-handle-guest_s.patch +++ /dev/null @@ -1,47 +0,0 @@ -From bc26025ccc64a2a63fc58776c93e2e4392445abe Mon Sep 17 00:00:00 2001 -From: Luke Shumaker <lukeshu@parabola.nu> -Date: Wed, 27 Dec 2017 19:44:00 -0500 -Subject: [PATCH 04/10] linux-user: init_guest_space: Correctly handle - guest_start in commpage initialization - -init_guest_commpage needs to check if the mapped space, which ends at -real_start+real_size overlaps with where it needs to put the commpage, -which is (assuming sane qemu_host_page_size) guest_base + 0xffff000, where -guest_base is real_start - guest_start. - - [guest_base][ 0xffff0000 ][commpage] - [guest_base][guest_start][real_size] [commpage] - [ real_start ][real_size] [commpage] - ^ - fail if this gap < 0 - -Since init_guest_commpage wants to do everything relative to guest_base -(rather than real_start), it obviously needs to be comparing 0xffff0000 -against guest_start+real_size, not just real_size. - -This bug has been present since 806d102141b99d4f1e55a97d68b7ea8c8ba3129f in -2012, but guest_start is usually 0, and prior to v2.11 real_size was -usually much smaller than 0xffff0000, so it was uncommon for it to have -made a difference. - -Signed-off-by: Luke Shumaker <lukeshu@parabola.nu> ---- - linux-user/elfload.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/linux-user/elfload.c b/linux-user/elfload.c -index 1a6b660b25..f41cecc3cb 100644 ---- a/linux-user/elfload.c -+++ b/linux-user/elfload.c -@@ -1882,7 +1882,7 @@ unsigned long init_guest_space(unsigned long host_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(real_start - guest_start, -- real_size); -+ real_size + guest_start); - if (valid == 1) { - break; - } else if (valid == -1) { --- -2.15.1 - diff --git a/pcr/qemu-user-static-git/0005-linux-user-init_guest_space-Clarify-page-alignment-l.patch b/pcr/qemu-user-static-git/0005-linux-user-init_guest_space-Clarify-page-alignment-l.patch deleted file mode 100644 index 1570774ee..000000000 --- a/pcr/qemu-user-static-git/0005-linux-user-init_guest_space-Clarify-page-alignment-l.patch +++ /dev/null @@ -1,120 +0,0 @@ -From b2432d1b415143a55083782712f11241f194c0ba Mon Sep 17 00:00:00 2001 -From: Luke Shumaker <lukeshu@parabola.nu> -Date: Wed, 27 Dec 2017 20:05:52 -0500 -Subject: [PATCH 05/10] linux-user: init_guest_space: Clarify page alignment - logic - -There are 3 parts to this change: - - Add a comment showing the relative sizes and positions of the blocks of - memory - - introduce and use new aligned_{start,size} instead of adjusting - real_{start_size} - - When we clean up (on failure), munmap(real_start, real_size) instead of - munmap(aligned_start, aligned_size). It *shouldn't* make any - difference, but I will admit that this does mean we are making the - syscall with different values, so this isn't quite a no-op patch. - -Signed-off-by: Luke Shumaker <lukeshu@parabola.nu> ---- - linux-user/elfload.c | 43 +++++++++++++++++++++++++++++++++---------- - 1 file changed, 33 insertions(+), 10 deletions(-) - -diff --git a/linux-user/elfload.c b/linux-user/elfload.c -index f41cecc3cb..22f2632dfa 100644 ---- a/linux-user/elfload.c -+++ b/linux-user/elfload.c -@@ -1827,7 +1827,7 @@ unsigned long init_guest_space(unsigned long host_start, - unsigned long guest_start, - bool fixed) - { -- unsigned long current_start, real_start; -+ unsigned long current_start, aligned_start; - int flags; - - assert(host_start || host_size); -@@ -1853,7 +1853,8 @@ unsigned long init_guest_space(unsigned long host_start, - /* Otherwise, a non-zero size region of memory needs to be mapped - * and validated. */ - while (1) { -- unsigned long real_size = host_size; -+ unsigned long real_start, real_size, aligned_size; -+ aligned_size = real_size = host_size; - - /* Do not use mmap_find_vma here because that is limited to the - * guest address space. We are going to make the -@@ -1867,26 +1868,48 @@ unsigned long init_guest_space(unsigned long host_start, - - /* Ensure the address is properly aligned. */ - if (real_start & ~qemu_host_page_mask) { -+ /* 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 = host_size + qemu_host_page_size; -+ real_size = aligned_size + qemu_host_page_size; - 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; - } -- real_start = HOST_PAGE_ALIGN(real_start); -+ aligned_start = HOST_PAGE_ALIGN(real_start); -+ } else { -+ aligned_start = real_start; - } - - /* Check to see if the address is valid. */ -- if (!host_start || real_start == current_start) { -+ if (!host_start || aligned_start == current_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(real_start - guest_start, -- real_size + guest_start); -+ int valid = init_guest_commpage(aligned_start - guest_start, -+ aligned_size + guest_start); - if (valid == 1) { - break; - } else if (valid == -1) { -- munmap((void *)real_start, host_size); -+ munmap((void *)real_start, real_size); - return (unsigned long)-1; - } - /* valid == 0, so try again. */ -@@ -1905,7 +1928,7 @@ unsigned long init_guest_space(unsigned long host_start, - * address space randomization put a shared library somewhere - * inconvenient. - */ -- munmap((void *)real_start, host_size); -+ munmap((void *)real_start, real_size); - current_start += qemu_host_page_size; - if (host_start == current_start) { - /* Theoretically possible if host doesn't have any suitably -@@ -1917,7 +1940,7 @@ unsigned long init_guest_space(unsigned long host_start, - - qemu_log_mask(CPU_LOG_PAGE, "Reserved 0x%lx bytes of guest address space\n", host_size); - -- return real_start; -+ return aligned_start; - } - - static void probe_guest_base(const char *image_name, --- -2.15.1 - diff --git a/pcr/qemu-user-static-git/0006-linux-user-init_guest_commpage-Add-a-comment-about-s.patch b/pcr/qemu-user-static-git/0006-linux-user-init_guest_commpage-Add-a-comment-about-s.patch deleted file mode 100644 index 4436b7817..000000000 --- a/pcr/qemu-user-static-git/0006-linux-user-init_guest_commpage-Add-a-comment-about-s.patch +++ /dev/null @@ -1,30 +0,0 @@ -From ca873a81cc020df0ee0ec072a60678bb83dce9e2 Mon Sep 17 00:00:00 2001 -From: Luke Shumaker <lukeshu@parabola.nu> -Date: Wed, 27 Dec 2017 21:05:29 -0500 -Subject: [PATCH 06/10] linux-user: init_guest_commpage: Add a comment about - size check - -Signed-off-by: Luke Shumaker <lukeshu@parabola.nu> ---- - linux-user/elfload.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/linux-user/elfload.c b/linux-user/elfload.c -index 22f2632dfa..b560f5d6fe 100644 ---- a/linux-user/elfload.c -+++ b/linux-user/elfload.c -@@ -374,6 +374,11 @@ static int init_guest_commpage(unsigned long guest_base, - - /* 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)) { --- -2.15.1 - diff --git a/pcr/qemu-user-static-git/0007-linux-user-init_guest_space-Clean-up-control-flow-a-.patch b/pcr/qemu-user-static-git/0007-linux-user-init_guest_space-Clean-up-control-flow-a-.patch deleted file mode 100644 index 59be04cf9..000000000 --- a/pcr/qemu-user-static-git/0007-linux-user-init_guest_space-Clean-up-control-flow-a-.patch +++ /dev/null @@ -1,94 +0,0 @@ -From dbbba45fa37da85ac213fbbe1f7eab3e1de74b41 Mon Sep 17 00:00:00 2001 -From: Luke Shumaker <lukeshu@parabola.nu> -Date: Wed, 27 Dec 2017 21:17:52 -0500 -Subject: [PATCH 07/10] linux-user: init_guest_space: Clean up control flow a - bit - -Instead of doing - - if (check1) { - if (check2) { - success; - } - } - - retry; - -Do a clearer - - if (!check1) { - goto try_again; - } - - if (!check2) { - goto try_again; - } - - success; - - try_again: - retry; - -Besides being clearer, this makes it easier to insert more checks that -need to trigger a retry on check failure, or rearrange them, or anything -like that. - -Because some indentation is changing, "ignore space change" may be useful -for viewing this patch. - -Signed-off-by: Luke Shumaker <lukeshu@parabola.nu> ---- - linux-user/elfload.c | 34 +++++++++++++++++++--------------- - 1 file changed, 19 insertions(+), 15 deletions(-) - -diff --git a/linux-user/elfload.c b/linux-user/elfload.c -index b560f5d6fe..5c0ad65611 100644 ---- a/linux-user/elfload.c -+++ b/linux-user/elfload.c -@@ -1906,24 +1906,28 @@ unsigned long init_guest_space(unsigned long host_start, - } - - /* Check to see if the address is valid. */ -- if (!host_start || aligned_start == current_start) { -+ if (host_start && aligned_start != current_start) { -+ goto try_again; -+ } -+ - #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) { -- break; -- } else if (valid == -1) { -- munmap((void *)real_start, real_size); -- return (unsigned long)-1; -- } -- /* valid == 0, so try again. */ --#else -- /* On other architectures, whatever we have here is fine. */ -- break; --#endif -+ /* 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 == -1) { -+ goto try_again; - } -+#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 --- -2.15.1 - diff --git a/pcr/qemu-user-static-git/0008-linux-user-init_guest_space-Don-t-try-to-align-if-we.patch b/pcr/qemu-user-static-git/0008-linux-user-init_guest_space-Don-t-try-to-align-if-we.patch deleted file mode 100644 index 9f434e116..000000000 --- a/pcr/qemu-user-static-git/0008-linux-user-init_guest_space-Don-t-try-to-align-if-we.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 8f38106de8d023be8b3b28955df3615637c65dd9 Mon Sep 17 00:00:00 2001 -From: Luke Shumaker <lukeshu@parabola.nu> -Date: Thu, 28 Dec 2017 06:42:12 -0500 -Subject: [PATCH 08/10] linux-user: init_guest_space: Don't try to align if - we'll reject it - -If the ensure-alignment code gets triggered, then the -"if (host_start && real_start != current_start)" check will always trigger, -so save 2 syscalls and put that check first. - -Note that we can't just switch to using MAP_FIXED for that check, because -then we couldn't differentiate between a failure because "there isn't -enough space" and "there isn't enough space *here*". - -Signed-off-by: Luke Shumaker <lukeshu@parabola.nu> ---- - linux-user/elfload.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/linux-user/elfload.c b/linux-user/elfload.c -index 5c0ad65611..1b7583d659 100644 ---- a/linux-user/elfload.c -+++ b/linux-user/elfload.c -@@ -1871,6 +1871,11 @@ unsigned long init_guest_space(unsigned long host_start, - return (unsigned long)-1; - } - -+ /* Check to see if the address is valid. */ -+ if (host_start && real_start != current_start) { -+ goto try_again; -+ } -+ - /* Ensure the address is properly aligned. */ - if (real_start & ~qemu_host_page_mask) { - /* Ideally, we adjust like -@@ -1905,11 +1910,6 @@ unsigned long init_guest_space(unsigned long host_start, - aligned_start = real_start; - } - -- /* Check to see if the address is valid. */ -- if (host_start && aligned_start != current_start) { -- goto try_again; -- } -- - #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, --- -2.15.1 - diff --git a/pcr/qemu-user-static-git/0009-linux-user-init_guest_space-Add-a-comment-about-sear.patch b/pcr/qemu-user-static-git/0009-linux-user-init_guest_space-Add-a-comment-about-sear.patch deleted file mode 100644 index e91fdefd8..000000000 --- a/pcr/qemu-user-static-git/0009-linux-user-init_guest_space-Add-a-comment-about-sear.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 81033c66738a2e3b713c414e8e07e6ef8e59d8d7 Mon Sep 17 00:00:00 2001 -From: Luke Shumaker <lukeshu@parabola.nu> -Date: Thu, 28 Dec 2017 07:22:29 -0500 -Subject: [PATCH 09/10] linux-user: init_guest_space: Add a comment about - search strategy - -Signed-off-by: Luke Shumaker <lukeshu@parabola.nu> ---- - linux-user/elfload.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/linux-user/elfload.c b/linux-user/elfload.c -index 1b7583d659..7736ea2c3a 100644 ---- a/linux-user/elfload.c -+++ b/linux-user/elfload.c -@@ -1936,6 +1936,10 @@ unsigned long init_guest_space(unsigned long host_start, - * 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. - */ - munmap((void *)real_start, real_size); - current_start += qemu_host_page_size; --- -2.15.1 - diff --git a/pcr/qemu-user-static-git/0010-linux-user-init_guest_space-Try-to-make-ARM-space-co.patch b/pcr/qemu-user-static-git/0010-linux-user-init_guest_space-Try-to-make-ARM-space-co.patch deleted file mode 100644 index 587293564..000000000 --- a/pcr/qemu-user-static-git/0010-linux-user-init_guest_space-Try-to-make-ARM-space-co.patch +++ /dev/null @@ -1,99 +0,0 @@ -From f8ccd5e7353937e0a48ccd8bfbc07202dc85afac Mon Sep 17 00:00:00 2001 -From: Luke Shumaker <lukeshu@parabola.nu> -Date: Thu, 28 Dec 2017 07:27:20 -0500 -Cc: paul@codesourcery.com -Subject: [PATCH 10/10] linux-user: init_guest_space: Try to make ARM - space+commpage continuous - -At a fixed distance after the usable memory that init_guest_space maps, for -32-bit ARM targets we also need to map a commpage. The normal -init_guest_space logic doesn't keep this in mind when searching for an -address range. - -If !host_start, then try to find a big continuous segment where we can put -both the usable memory and the commpage; we then munmap that segment and -set current_start to that address; and let the normal code mmap the usable -memory and the commpage separately. That is: if we don't have hint of -where to start looking for memory, come up with one that is better than -NULL. Depending on host_size and guest_start, there may or may not be a -gap between the usable memory and the commpage, so this is slightly more -restrictive than it needs to be; but it's only a hint, so that's OK. - -We only do that for !host start, because if host_start, then either: - - we got an address passed in with -B, in which case we don't want to - interfere with what the user said; - - or host_start is based off of the ELF image's loaddr. The check "if - (host_start && real_start != current_start)" suggests that we really - want lowest available address that is >= loaddr. I don't know why that - is, but I'm trusting that Paul Brook knew what he was doing when he - wrote the original version of that check in - c581deda322080e8beb88b2e468d4af54454e4b3 way back in 2010. - -Signed-off-by: Luke Shumaker <lukeshu@parabola.nu> ---- - linux-user/elfload.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 49 insertions(+) - -diff --git a/linux-user/elfload.c b/linux-user/elfload.c -index 7736ea2c3a..cd3a7d877d 100644 ---- a/linux-user/elfload.c -+++ b/linux-user/elfload.c -@@ -1857,6 +1857,55 @@ unsigned long init_guest_space(unsigned long host_start, - - /* Otherwise, a non-zero size region of memory needs to be mapped - * and validated. */ -+ -+#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; -+ } -+ munmap((void *)real_start, host_full_size); -+ if (real_start & ~qemu_host_page_mask) { -+ /* The same thing again, but with an extra qemu_host_page_size -+ * 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 = HOST_PAGE_ALIGN(real_start); -+ } -+ current_start = real_start; -+ } -+ naive: -+#endif -+ - while (1) { - unsigned long real_start, real_size, aligned_size; - aligned_size = real_size = host_size; --- -2.15.1 - diff --git a/pcr/qemu-user-static-git/PKGBUILD b/pcr/qemu-user-static-git/PKGBUILD index a16fa8ebc..7761b79c9 100644 --- a/pcr/qemu-user-static-git/PKGBUILD +++ b/pcr/qemu-user-static-git/PKGBUILD @@ -7,34 +7,16 @@ _pkgbase=qemu-git _gitname=qemu pkgname=(qemu-user-static-git qemu-user-static-binfmt-git) pkgdesc="A generic and open source machine emulator and virtualizer. Git version." -pkgver=2.11.50.r59752.fb5fff1588 +pkgver=v2.11.0.r2577.gc26ef39204 pkgrel=1 arch=(x86_64) license=(GPL2 LGPL2.1) url="http://wiki.qemu.org/" makedepends=(git pixman-static glib2-static pcre-static python2) source=(git://git.qemu.org/qemu.git - 0001-linux-user-Use-if-to-only-call-validate_guest_space-.patch - 0002-linux-user-Rename-validate_guest_space-init_guest_co.patch - 0003-linux-user-init_guest_space-Clean-up-if-we-can-t-ini.patch - 0004-linux-user-init_guest_space-Correctly-handle-guest_s.patch - 0005-linux-user-init_guest_space-Clarify-page-alignment-l.patch - 0006-linux-user-init_guest_commpage-Add-a-comment-about-s.patch - 0007-linux-user-init_guest_space-Clean-up-control-flow-a-.patch - 0008-linux-user-init_guest_space-Don-t-try-to-align-if-we.patch - 0009-linux-user-init_guest_space-Add-a-comment-about-sear.patch - 0010-linux-user-init_guest_space-Try-to-make-ARM-space-co.patch) + 0001-fix-program-invocation-name.patch) sha256sums=('SKIP' - '9953a8debd9456adb4f5968817fa89da4d4542e44980a5533ccf86371d819845' - 'a977e9295daa14a9c73258cf16399eb5af66382217f8a4e69951ec044131a7ce' - 'dba2cfeb24841d45936091319957ee6f65e481da3c761791d410d3b8e6799998' - '75b3bda6752c4bf17488489f898767b6772b10ecc5d1f0a5bc1bd831e99a31e3' - '731895a8ed6f6d322bb60764b01cf09e0ea762d7d53fc01e91c2d2aecfdc8844' - '69b37040f52ef86b86c7c2952eb3f85f3c67d7adf289c43fdac8c71827c6e5b9' - '76f88850b0f52450eecb80029ffe16db6f418cec3b58231aca354cc20bbfb16a' - '76944d84990cc76e47c381849c683a346c5234bcebbe4c24334d0fd8368482db' - '7845867348fd380def28c7fe023e54cee8ff88cd6754aae3ab3472149cfbde51' - '1953e7cac58c23526d007d8559410e0042d4a7c1b8cbd5f4c0543f7f876436dd') + '85a1554cd9ce73f8f7eb8e9dd3cdb884466b4cfed7d28ede62246b46bea932cb') validpgpkeys=('CEACC9E15534EBABB82D3FA03353C9CEF108B584') case $CARCH in @@ -44,8 +26,7 @@ esac pkgver() { cd "${srcdir}/${_gitname}" - - printf "%s.r%s.%s" "$(cat VERSION)" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" + git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g' } prepare() { @@ -55,12 +36,7 @@ prepare() { cd "${srcdir}/${_gitname}" sed -i 's/vte-2\.90/vte-2.91/g' configure - # https://bugs.launchpad.net/qemu/+bug/1740219 - # https://lists.nongnu.org/archive/html/qemu-devel/2017-12/msg05237.html - local patchfile - for patchfile in ../????-linux-user-*.patch; do - patch -p1 < "$patchfile" - done + patch -Np1 -i "$srcdir"/0001-fix-program-invocation-name.patch # update git submodules scripts/git-submodule.sh update ui/keycodemapdb dtc diff --git a/pcr/qemu-user-static-git/out b/pcr/qemu-user-static-git/out deleted file mode 100644 index b53c479cc..000000000 --- a/pcr/qemu-user-static-git/out +++ /dev/null @@ -1,81 +0,0 @@ -ID State Output E-Level Times(r/u/s) Command [run=0/1] -114 finished /tmp/ts-out.jKXd3b 0 0.00/0.00/0.00 echo /home/andi/parabola/tree/abslibre/libre/qtcreator -115 finished /tmp/ts-out.bLshXK 0 2.07/0.50/0.14 [114]&& script --return --quiet --command sudo /usr/bin/librechroot -A x86_64 -n default-x86_64 update /dev/null -116 finished /tmp/ts-out.4clmJN 0 3477.55/6939.77/472.28 [115]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-x86_64 /dev/null -117 finished /tmp/ts-out.LesP6K 0 46.29/19.98/4.79 [116]&& script --return --quiet --command sudo /usr/bin/librechroot -A i686 -n default-i686 update /dev/null -118 finished /tmp/ts-out.FsJBTB 0 3549.12/7215.64/361.63 [117]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-i686 /dev/null -119 finished /tmp/ts-out.1966dR 0 92.37/60.61/6.76 [118]&& script --return --quiet --command sudo /usr/bin/librechroot -A armv7h -n default-armv7h update /dev/null -120 finished /tmp/ts-out.xSySZl 1 121.93/16.85/2.16 [119]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-armv7h /dev/null -121 skipped (no output) [120]&& librestage -122 finished /tmp/ts-out.KQQ5SR 0 0.01/0.00/0.00 echo /home/andi/parabola/tree/abslibre/libre/khotkeys -123 finished /tmp/ts-out.nS62vV 0 2.23/0.34/0.09 [122]&& script --return --quiet --command sudo /usr/bin/librechroot -A x86_64 -n default-x86_64 update /dev/null -124 finished /tmp/ts-out.iUm6cj 0 128.67/166.64/22.83 [123]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-x86_64 /dev/null -125 finished /tmp/ts-out.RnwqqV 0 3.43/0.44/0.17 [124]&& script --return --quiet --command sudo /usr/bin/librechroot -A i686 -n default-i686 update /dev/null -126 finished /tmp/ts-out.fRfmqC 1 145.69/3.35/1.28 [125]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-i686 /dev/null -127 skipped (no output) [126]&& script --return --quiet --command sudo /usr/bin/librechroot -A armv7h -n default-armv7h update /dev/null -128 skipped (no output) [127]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-armv7h /dev/null -129 skipped (no output) [128]&& librestage -130 finished /tmp/ts-out.qRKrxc 0 0.00/0.00/0.00 echo /home/andi/parabola/tree/abslibre/libre/kinfocenter -131 finished /tmp/ts-out.cYMQmc 0 2.05/0.48/0.08 [130]&& script --return --quiet --command sudo /usr/bin/librechroot -A x86_64 -n default-x86_64 update /dev/null -132 finished /tmp/ts-out.62n1qk 0 89.65/136.29/18.21 [131]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-x86_64 /dev/null -133 finished /tmp/ts-out.CtuGTQ 0 1.92/0.36/0.08 [132]&& script --return --quiet --command sudo /usr/bin/librechroot -A i686 -n default-i686 update /dev/null -134 finished /tmp/ts-out.SERXL1 1 26.15/4.06/0.65 [133]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-i686 /dev/null -135 skipped (no output) [134]&& script --return --quiet --command sudo /usr/bin/librechroot -A armv7h -n default-armv7h update /dev/null -136 skipped (no output) [135]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-armv7h /dev/null -137 skipped (no output) [136]&& librestage -138 finished /tmp/ts-out.ZnBjor 0 0.00/0.00/0.00 echo /home/andi/parabola/tree/abslibre/libre/kio-extras -139 finished /tmp/ts-out.8E8wer 0 2.03/0.44/0.11 [138]&& script --return --quiet --command sudo /usr/bin/librechroot -A x86_64 -n default-x86_64 update /dev/null -140 finished /tmp/ts-out.uBqekA 0 149.69/239.85/30.41 [139]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-x86_64 /dev/null -141 finished /tmp/ts-out.YWHWJx 0 1.99/0.36/0.09 [140]&& script --return --quiet --command sudo /usr/bin/librechroot -A i686 -n default-i686 update /dev/null -142 finished /tmp/ts-out.RNe9ZD 1 68.01/6.23/0.77 [141]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-i686 /dev/null -143 skipped (no output) [142]&& script --return --quiet --command sudo /usr/bin/librechroot -A armv7h -n default-armv7h update /dev/null -144 skipped (no output) [143]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-armv7h /dev/null -145 skipped (no output) [144]&& librestage -146 finished /tmp/ts-out.Qzqk7l 0 0.00/0.00/0.00 echo /home/andi/parabola/tree/abslibre/libre/kio -147 finished /tmp/ts-out.zcsBam 0 2.05/0.46/0.09 [146]&& script --return --quiet --command sudo /usr/bin/librechroot -A x86_64 -n default-x86_64 update /dev/null -148 finished /tmp/ts-out.WqzjOy 2 11.73/9.36/1.55 [147]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-x86_64 /dev/null -149 skipped (no output) [148]&& script --return --quiet --command sudo /usr/bin/librechroot -A i686 -n default-i686 update /dev/null -150 skipped (no output) [149]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-i686 /dev/null -151 skipped (no output) [150]&& script --return --quiet --command sudo /usr/bin/librechroot -A armv7h -n default-armv7h update /dev/null -152 skipped (no output) [151]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-armv7h /dev/null -153 skipped (no output) [152]&& librestage -154 finished /tmp/ts-out.qPBy1S 0 0.00/0.00/0.00 echo /home/andi/parabola/tree/abslibre/libre/ark -155 finished /tmp/ts-out.hq0gZS 0 2.01/0.46/0.10 [154]&& script --return --quiet --command sudo /usr/bin/librechroot -A x86_64 -n default-x86_64 update /dev/null -156 finished /tmp/ts-out.QWdn0Y 0 85.41/168.05/18.15 [155]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-x86_64 /dev/null -157 finished /tmp/ts-out.R2kOmY 0 1.93/0.35/0.10 [156]&& script --return --quiet --command sudo /usr/bin/librechroot -A i686 -n default-i686 update /dev/null -158 finished /tmp/ts-out.ByXyGZ 1 11.01/7.78/1.82 [157]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-i686 /dev/null -159 skipped (no output) [158]&& script --return --quiet --command sudo /usr/bin/librechroot -A armv7h -n default-armv7h update /dev/null -160 skipped (no output) [159]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-armv7h /dev/null -161 skipped (no output) [160]&& librestage -162 finished /tmp/ts-out.ZAcxSz 0 0.00/0.00/0.00 echo /home/andi/parabola/tree/abslibre/libre/konqueror -163 finished /tmp/ts-out.24ch0z 0 2.01/0.44/0.11 [162]&& script --return --quiet --command sudo /usr/bin/librechroot -A x86_64 -n default-x86_64 update /dev/null -164 finished /tmp/ts-out.nY510G 2 19.05/15.45/3.71 [163]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-x86_64 /dev/null -165 skipped (no output) [164]&& script --return --quiet --command sudo /usr/bin/librechroot -A i686 -n default-i686 update /dev/null -166 skipped (no output) [165]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-i686 /dev/null -167 skipped (no output) [166]&& script --return --quiet --command sudo /usr/bin/librechroot -A armv7h -n default-armv7h update /dev/null -168 skipped (no output) [167]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-armv7h /dev/null -169 skipped (no output) [168]&& librestage -170 finished /tmp/ts-out.DFQFUN 0 0.00/0.00/0.00 echo /home/andi/parabola/tree/abslibre/libre/okular -171 finished /tmp/ts-out.GYxJIN 0 2.02/0.45/0.11 [170]&& script --return --quiet --command sudo /usr/bin/librechroot -A x86_64 -n default-x86_64 update /dev/null -172 finished /tmp/ts-out.fRbbXX 0 217.58/461.79/47.29 [171]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-x86_64 /dev/null -173 finished /tmp/ts-out.xV2Q2q 0 1.92/0.36/0.09 [172]&& script --return --quiet --command sudo /usr/bin/librechroot -A i686 -n default-i686 update /dev/null -174 finished /tmp/ts-out.rFR91u 1 105.93/8.18/1.11 [173]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-i686 /dev/null -175 skipped (no output) [174]&& script --return --quiet --command sudo /usr/bin/librechroot -A armv7h -n default-armv7h update /dev/null -176 skipped (no output) [175]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-armv7h /dev/null -177 skipped (no output) [176]&& librestage -178 finished /tmp/ts-out.vvrtXa 0 0.00/0.00/0.00 echo /home/andi/parabola/tree/abslibre/libre/linux-libre-armv7 -179 finished /tmp/ts-out.weaBTb 0 2.74/1.20/0.12 [178]&& script --return --quiet --command sudo /usr/bin/librechroot -A armv7h -n default-armv7h update /dev/null -180 finished /tmp/ts-out.8A2Bm1 1 41.80/31.36/3.75 [179]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-armv7h /dev/null -181 skipped (no output) [180]&& librestage -182 finished /tmp/ts-out.pnAfO4 0 0.00/0.00/0.00 echo /home/andi/parabola/tree/abslibre/pcr/qemu-git -183 finished /tmp/ts-out.MO6WN4 0 2.29/0.45/0.09 [182]&& script --return --quiet --command sudo /usr/bin/librechroot -A x86_64 -n default-x86_64 update /dev/null -184 finished /tmp/ts-out.TJcZHx 0 2323.03/6351.91/490.83 [183]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-x86_64 /dev/null -185 finished /tmp/ts-out.jbHsL1 0 3.66/0.45/0.18 [184]&& script --return --quiet --command sudo /usr/bin/librechroot -A i686 -n default-i686 update /dev/null -186 finished /tmp/ts-out.E56QbQ 1 58.06/16.16/3.95 [185]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-i686 /dev/null -187 skipped (no output) [186]&& librestage -188 finished /tmp/ts-out.yj25w6 0 0.02/0.00/0.00 echo /home/andi/parabola/tree/abslibre/pcr/qemu-user-static-git -189 finished /tmp/ts-out.O6yyo5 0 2.44/0.50/0.16 [188]&& script --return --quiet --command sudo /usr/bin/librechroot -A x86_64 -n default-x86_64 update /dev/null -190 finished /tmp/ts-out.DbDqGL 2 14.80/5.27/3.26 [189]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-x86_64 /dev/null -191 skipped (no output) [190]&& script --return --quiet --command sudo /usr/bin/librechroot -A i686 -n default-i686 update /dev/null -192 skipped (no output) [191]&& script --return --quiet --command sudo /usr/bin/libremakepkg -n default-i686 /dev/null -193 skipped (no output) [192]&& librestage |