aboutsummaryrefslogtreecommitdiff
path: root/linux-user/fd-trans.c
AgeCommit message (Collapse)AuthorFilesLines
2021-07-12fd-trans: Fix race condition on reallocation of the translation table.Owen Anderson1-0/+1
The mapping from file-descriptors to translator functions is not guarded on realloc which may cause invalid function pointers to be read from a previously deallocated mapping. Signed-off-by: Owen Anderson <oanderso@google.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20210701221255.107976-1-oanderso@google.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-11-17linux-user,netlink: add IFLA_BRPORT_MRP_RING_OPEN, IFLA_BRPORT_MRP_IN_OPENLaurent Vivier1-0/+11
Fix "-d unimp" trace results: Unknown QEMU_IFLA_BRPORT type 35 Unknown QEMU_IFLA_BRPORT type 36 Also process IFLA_EXT_MASK to fix: Unknown target QEMU_IFLA type: 29 Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20201117111905.843925-1-laurent@vivier.eu>
2020-11-17linux-user,netlink: fix message translation with ip commandLaurent Vivier1-4/+3
With iproute2-5.8.0, the route, link and addr show commands fail: root@sid:~# ip addr show RTNETLINK answers: Unknown error 352321537 Dump terminated root@sid:~# ip link show RTNETLINK answers: Unknown error 352321537 Dump terminated root@sid:~# ip route show RTNETLINK answers: Unknown error 352321537 Dump terminated This patch correctly decodes the GETROUTE and GETLINK commands and adds the RTA_TABLE message. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20201116163622.791442-1-laurent@vivier.eu>
2020-07-13linux-user: add netlink RTM_SETLINK commandLaurent Vivier1-0/+1
This command is needed to be able to boot systemd in a container. $ sudo systemd-nspawn -D /chroot/armhf/sid/ -b Spawning container sid on /chroot/armhf/sid. Press ^] three times within 1s to kill container. systemd 245.6-2 running in system mode. Detected virtualization systemd-nspawn. Detected architecture arm. Welcome to Debian GNU/Linux bullseye/sid! Set hostname to <virt-arm>. Failed to enqueue loopback interface start request: Operation not supported Caught <SEGV>, dumped core as pid 3. Exiting PID 1... Container sid failed with error code 255. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20200709072332.890440-2-laurent@vivier.eu>
2020-07-13linux-user: add new netlink typesLaurent Vivier1-0/+4
Only implement IFLA_PERM_ADDRESS to fix the following error: Unknown host QEMU_IFLA type: 54 The couple of other ones, IFLA_PROP_LIST and IFLA_ALT_IFNAME, have been introduced to be used with RTM_NEWLINKPROP, RTM_DELLINKPROP and RTM_GETLINKPROP that are not implemented by QEMU. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20200709072332.890440-1-laurent@vivier.eu>
2020-02-19linux-user: Use `qemu_log' for non-strace loggingJosh Kunz1-20/+35
Since most calls to `gemu_log` are actually logging unimplemented features, this change replaces most non-strace calls to `gemu_log` with calls to `qemu_log_mask(LOG_UNIMP, ...)`. This allows the user to easily log to a file, and to mask out these log messages if they desire. Note: This change is slightly backwards incompatible, since now these "unimplemented" log messages will not be logged by default. Signed-off-by: Josh Kunz <jkz@google.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20200204025416.111409-2-jkz@google.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-10-21Fix unsigned integer underflow in fd-trans.cShu-Chun Weng1-11/+40
In any of these `*_for_each_*` functions, the last entry in the buffer (so the "remaining length in the buffer" `len` is equal to the length of the entry `nlmsg_len`/`nla_len`/etc) has size that is not a multiple of the alignment, the aligned lengths `*_ALIGN(*_len)` will be greater than `len`. Since `len` is unsigned (`size_t`), it underflows and the loop will read pass the buffer. This may manifest as random EINVAL or EOPNOTSUPP error on IO or network system calls. Signed-off-by: Shu-Chun Weng <scw@google.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20191018001920.178283-1-scw@google.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-07-02linux-user: move QEMU_IFLA_BR_MULTI_BOOLOPT to the good functionLaurent Vivier1-6/+6
QEMU_IFLA_BR_MULTI_BOOLOPT has been added to the wrong function host_to_target_slave_data_bridge_nlattr(). Move it to host_to_target_data_bridge_nlattr(). This fixes following error: Unknown QEMU_IFLA_BR type 46 Fixes: 61b463fbf6cb ("linux-user: add new netlink types") Message-Id: <20190626150855.27446-1-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-03-07linux-user: add new netlink typesLaurent Vivier1-0/+9
Add QEMU_IFLA_BR_VLAN_STATS_PER_PORT (from linux v4.20), QEMU_IFLA_BR_MULTI_BOOLOPT (from linux v5.0). The first new entry fixes the following error: Unknown QEMU_IFLA_BR type 45 Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20190306200925.17605-1-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-02-07linux-user: add new netlink typesLaurent Vivier1-0/+8
Add QEMU_IFLA_MIN_MTU, QEMU_IFLA_MAX_MTU (from linux v4.19) QEMU_IFLA_BRPORT_ISOLATED (from linux v4.18) and QEMU_IFLA_BRPORT_BACKUP_PORT (from linux v4.19). These new types fix this error flow with sudo: ... Unknown host QEMU_IFLA type: 50 Unknown host QEMU_IFLA type: 51 Unknown QEMU_IFLA_BRPORT type 33 ... Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20190206193211.6683-1-laurent@vivier.eu>
2018-09-25linux-user: move TargetFdTrans functions to their own fileLaurent Vivier1-0/+1409
This will ease to move out syscall functions from syscall.c Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20180823222215.13781-1-laurent@vivier.eu>