Skip to content

Commit 449cda4

Browse files
committed
Limit memory usage when running qemu-img convert
This patch is limiting the memory address space to 1 GiB when invoking qemu-img convert. The qemu-img command can be exploited so we better play on the safe side (See: bug #1449062). Change-Id: I2088f74b32d1392310c569cfaa7fd368cb737421 Closes-Bug: #1657808
1 parent 7680625 commit 449cda4

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

ironic_python_agent/shell/write_image.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ log "Erasing existing GPT and MBR data structures from ${DEVICE}"
3939
sgdisk -Z $DEVICE
4040

4141
log "Imaging $IMAGEFILE to $DEVICE"
42+
43+
# limit the memory usage for qemu-img to 1 GiB
44+
ulimit -v 1048576
4245
qemu-img convert -t directsync -O host_device $IMAGEFILE $DEVICE
4346
sync
4447

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
Limits the memory usage of ``qemu-img convert`` command to 1 GiB to
5+
avoid it from causing the host machine to fail due not enough ram.

0 commit comments

Comments
 (0)