Skip to content

Commit f03e578

Browse files
committed
Merge tag 'uml-for-6.17-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux
Pull UML fixes from Johannes Berg: "A few fixes for UML, which I'd meant to send earlier but then forgot. All of them are pretty long-standing issues that are either not really happening (the UAF), in rarely used code (the FD buffer issue), or an issue only for some host configurations (the executable stack): - mark stack not executable to work on more modern systems with selinux - fix use-after-free in a virtio error path - fix stack buffer overflow in external unix socket FD receive function" * tag 'uml-for-6.17-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux: um: Fix FD copy size in os_rcv_fd_msg() um: virtio_uml: Fix use-after-free after put_device in probe um: Don't mark stack executable
2 parents 8b789f2 + df447a3 commit f03e578

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

arch/um/drivers/virtio_uml.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,10 +1250,12 @@ static int virtio_uml_probe(struct platform_device *pdev)
12501250
device_set_wakeup_capable(&vu_dev->vdev.dev, true);
12511251

12521252
rc = register_virtio_device(&vu_dev->vdev);
1253-
if (rc)
1253+
if (rc) {
12541254
put_device(&vu_dev->vdev.dev);
1255+
return rc;
1256+
}
12551257
vu_dev->registered = 1;
1256-
return rc;
1258+
return 0;
12571259

12581260
error_init:
12591261
os_close_file(vu_dev->sock);

arch/um/os-Linux/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ ssize_t os_rcv_fd_msg(int fd, int *fds, unsigned int n_fds,
535535
cmsg->cmsg_type != SCM_RIGHTS)
536536
return n;
537537

538-
memcpy(fds, CMSG_DATA(cmsg), cmsg->cmsg_len);
538+
memcpy(fds, CMSG_DATA(cmsg), cmsg->cmsg_len - CMSG_LEN(0));
539539
return n;
540540
}
541541

arch/um/os-Linux/util.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020

2121
void stack_protections(unsigned long address)
2222
{
23-
if (mprotect((void *) address, UM_THREAD_SIZE,
24-
PROT_READ | PROT_WRITE | PROT_EXEC) < 0)
23+
if (mprotect((void *) address, UM_THREAD_SIZE, PROT_READ | PROT_WRITE) < 0)
2524
panic("protecting stack failed, errno = %d", errno);
2625
}
2726

0 commit comments

Comments
 (0)