The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7750

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Link: https://launchpadlibrarian.net/492514639/buildlog_snap_ubuntu_bionic_amd64_lxd-latest-edge_BUILDING.txt.gz
Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
From 77544a6133846fe5e7da54e8f7ef89201c75cbb1 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brau...@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.brau...@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;
                }
 
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to