Skip to content

Commit 9cea7da

Browse files
committed
ci: Add QEMU package automation
1 parent 72c0d85 commit 9cea7da

File tree

3 files changed

+128
-0
lines changed

3 files changed

+128
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From 76efeccfd73a76834ac1c75d3c94de1899085714 Mon Sep 17 00:00:00 2001
2+
From: Richard Purdie <[email protected]>
3+
Date: Fri, 8 Jan 2021 17:27:06 +0000
4+
Subject: [PATCH] qemu: Add some user space mmap tweaks to address musl 32 bit
5+
6+
When using qemu-i386 to build qemux86 webkitgtk on musl, it sits in an
7+
infinite loop of mremap calls of ever decreasing/increasing addresses.
8+
9+
I suspect something in the musl memory allocation code loops indefinitely
10+
if it only sees ENOMEM and only exits when it hits EFAULT.
11+
12+
According to the docs, trying to mremap outside the address space
13+
can/should return EFAULT and changing this allows the build to succeed.
14+
15+
A better return value for the other cases of invalid addresses is EINVAL
16+
rather than ENOMEM so adjust the other part of the test to this.
17+
18+
Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg01355.html]
19+
Signed-off-by: Richard Purdie <[email protected]
20+
---
21+
linux-user/mmap.c | 10 +++++++---
22+
1 file changed, 7 insertions(+), 3 deletions(-)
23+
24+
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
25+
index e4bf5d5f3..04d920c11 100644
26+
--- a/linux-user/mmap.c
27+
+++ b/linux-user/mmap.c
28+
@@ -879,12 +879,16 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
29+
int prot;
30+
void *host_addr;
31+
32+
- if (!guest_range_valid_untagged(old_addr, old_size) ||
33+
- ((flags & MREMAP_FIXED) &&
34+
+ if (!guest_range_valid_untagged(old_addr, old_size)) {
35+
+ errno = EFAULT;
36+
+ return -1;
37+
+ }
38+
+
39+
+ if (((flags & MREMAP_FIXED) &&
40+
!guest_range_valid_untagged(new_addr, new_size)) ||
41+
((flags & MREMAP_MAYMOVE) == 0 &&
42+
!guest_range_valid_untagged(old_addr, new_size))) {
43+
- errno = ENOMEM;
44+
+ errno = EINVAL;
45+
return -1;
46+
}
47+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From 1ba58dbd2dce4e6ccaf3be3ad5c9ecc22565313f Mon Sep 17 00:00:00 2001
2+
From: Mark Asselstine <[email protected]>
3+
Date: Tue, 26 Feb 2013 11:43:28 -0500
4+
Subject: [PATCH] apic: fixup fallthrough to PIC
5+
6+
Commit 0e21e12bb311c4c1095d0269dc2ef81196ccb60a [Don't route PIC
7+
interrupts through the local APIC if the local APIC config says so.]
8+
missed a check to ensure the local APIC is enabled. Since if the local
9+
APIC is disabled it doesn't matter what the local APIC config says.
10+
11+
If this check isn't done and the guest has disabled the local APIC the
12+
guest will receive a general protection fault, similar to what is seen
13+
here:
14+
15+
https://lists.gnu.org/archive/html/qemu-devel/2012-12/msg02304.html
16+
17+
The GPF is caused by an attempt to service interrupt 0xffffffff. This
18+
comes about since cpu_get_pic_interrupt() calls apic_accept_pic_intr()
19+
(with the local APIC disabled apic_get_interrupt() returns -1).
20+
apic_accept_pic_intr() returns 0 and thus the interrupt number which
21+
is returned from cpu_get_pic_interrupt(), and which is attempted to be
22+
serviced, is -1.
23+
24+
Signed-off-by: Mark Asselstine <[email protected]>
25+
Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2013-04/msg00878.html]
26+
Signed-off-by: He Zhe <[email protected]>
27+
---
28+
hw/intc/apic.c | 2 +-
29+
1 file changed, 1 insertion(+), 1 deletion(-)
30+
31+
diff --git a/hw/intc/apic.c b/hw/intc/apic.c
32+
index 4186c57b3..43cd805a9 100644
33+
--- a/hw/intc/apic.c
34+
+++ b/hw/intc/apic.c
35+
@@ -607,7 +607,7 @@ int apic_accept_pic_intr(DeviceState *dev)
36+
APICCommonState *s = APIC(dev);
37+
uint32_t lvt0;
38+
39+
- if (!s)
40+
+ if (!s || !(s->spurious_vec & APIC_SV_ENABLE))
41+
return -1;
42+
43+
lvt0 = s->lvt[APIC_LVT_LINT0];

.github/workflows/qemu.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: QEMU
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version"
8+
default: "20250317"
9+
10+
jobs:
11+
qemu:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out repo
15+
uses: actions/checkout@v4
16+
- name: Build
17+
run: |
18+
sudo sed -i 's,Types: deb,Types: deb deb-src,' /etc/apt/sources.list.d/ubuntu.sources
19+
sudo apt-get update
20+
sudo apt-get install -y devscripts
21+
mkdir build
22+
cd build
23+
sudo apt-get build-dep -y qemu
24+
apt-get source qemu
25+
cd qemu-*
26+
for file in ../../.github/patches/qemu/*.patch; do
27+
patch -p1 < $file
28+
done
29+
export DEBFULLNAME="Ole André Vadla Ravnås"
30+
export DEBEMAIL="[email protected]"
31+
dch --local frida "Apply patches needed for Frida's use-cases."
32+
dpkg-buildpackage -uc -us -b
33+
- name: Release
34+
uses: softprops/action-gh-release@v2
35+
with:
36+
tag_name: ${{ github.event.inputs.version }}
37+
body: "Roll packages."
38+
files: build/*.deb

0 commit comments

Comments
 (0)