[lxc-devel] [lxd/master] seccomp: check the return value of pwrite()
brauner on Github
lxc-bot at linuxcontainers.org
Sun Aug 9 06:56:53 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 478 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200808/0e475fdc/attachment.bin>
-------------- next part --------------
From 77544a6133846fe5e7da54e8f7ef89201c75cbb1 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sun, 9 Aug 2020 08:55:57 +0200
Subject: [PATCH] seccomp: check the return value of pwrite()
Link: https://launchpadlibrarian.net/492514639/buildlog_snap_ubuntu_bionic_amd64_lxd-latest-edge_BUILDING.txt.gz
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
lxd/seccomp/seccomp.go | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/lxd/seccomp/seccomp.go b/lxd/seccomp/seccomp.go
index 7c87c07e94..459728cd05 100644
--- a/lxd/seccomp/seccomp.go
+++ b/lxd/seccomp/seccomp.go
@@ -361,9 +361,8 @@ static int handle_bpf_syscall(int notify_fd, int mem_fd, struct seccomp_notify_p
bpf_prog_fd = bpf(cmd, &new_attr, sizeof(new_attr));
if (bpf_prog_fd < 0) {
int saved_errno = errno;
- if (log_buf)
- pwrite(mem_fd, log_buf, attr.log_size, attr.log_buf);
- errno = saved_errno;
+ if (log_buf && pwrite(mem_fd, log_buf, attr.log_size, attr.log_buf) < 0)
+ errno = saved_errno;
return -errno;
}
More information about the lxc-devel
mailing list