Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6481ybl; Tue, 7 Jan 2020 13:02:12 -0800 (PST) X-Google-Smtp-Source: APXvYqzHeK4OWGgOAiIvgEol6OJaNF9Io2NCGCuxx0aIPKdeQbbB0IEHz2CC1g5Ae7qmcwmIyq2V X-Received: by 2002:aca:1a10:: with SMTP id a16mr312383oia.9.1578430931847; Tue, 07 Jan 2020 13:02:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578430931; cv=none; d=google.com; s=arc-20160816; b=q0wS93+hp0x2mzduENhnNUTcEgbofC3nOH0nTaPC9fNuhQ1g+QQvxw/8ElI4PhGjb4 75RhBtKXPX+fVaBi4nkOMjOPVjYGN/Dqi7KIgZAiqxllj2bdkrwIASFuWyo8EyKmT4R6 pz30Yb7a3OirtRkJYirsey9hugxSFsIPNCLwFv+hZs/47oxZG3V0WDlUwgcxZDrMdjw4 PAar1GamdTW87aVuaYvbvg07emDOkLF/44n/OPcYZCNt0gLT1v6qgAgeO2sWKaTYs0Is IyLeEndrCk7TDda/maIbo/zsvM4kE8TU1BHkV1svVtWMuhTCymiHawwFms0OxeOacnUI NFoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1SCMhvcSJ4gRg4Wk2zHxcGGeaM8FDdBSdkxre/1ymLA=; b=sX2YYacCoJc86vCgspLULv6wjekX4iiI5nNmM5lleH/ckePkcTaDKXit9rQlSe1ZmS 1h8KC1LX0ewQ3p0ZjRedAt76kgYKk9JQtMTlaMWlcvefufjZR2yw9jXG1KS6CBa/fryo gfEfmFJsLiBTeakoA2Bd6lSqD2H/3XPEpgdNUhVn4ciwtEWfJ7qeYzKR6wDH2CBetbGS Pj84YsiNuOZx6CCXhzMzBeZFULv1+j0Fn23ZoZAJFvzdDPgFOQgac2g7laovSiFF8vIc hDHOK9e7eoLdugTZsJ2jXtpo58foRKlub5CxxYUxqCW+38bzI5VAeoZ9fVqjmh+ZQKTj ghKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0tI9kUoZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h203si653884oif.3.2020.01.07.13.01.56; Tue, 07 Jan 2020 13:02:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0tI9kUoZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727501AbgAGU7o (ORCPT + 99 others); Tue, 7 Jan 2020 15:59:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:32902 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728152AbgAGU7j (ORCPT ); Tue, 7 Jan 2020 15:59:39 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C91C62087F; Tue, 7 Jan 2020 20:59:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578430778; bh=9vSRbBEIIv1Hx0RtuwuVqGa9MS4LCKjl+5pqTu4MttI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0tI9kUoZhfN/PawD1iOL4fYM4foYQyU/k1qrCoB7uekIo4B9QTH4rTQrJKM7Nfvli i15t6Di3wt7xeB9K8eM+UUg7gAo5SaNapxeqdtLG8iLq0yxNWFfAUFrqmJR2PQenjb K1S2AW8u4VqbZBYnNXDeLbdU/Hw8lawK9dKrrojY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sargun Dhillon , Tycho Andersen , Christian Brauner , Kees Cook Subject: [PATCH 5.4 093/191] selftests/seccomp: Zero out seccomp_notif Date: Tue, 7 Jan 2020 21:53:33 +0100 Message-Id: <20200107205337.971992034@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205332.984228665@linuxfoundation.org> References: <20200107205332.984228665@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sargun Dhillon commit 88c13f8bd71472fbab5338b01d99122908c77e53 upstream. The seccomp_notif structure should be zeroed out prior to calling the SECCOMP_IOCTL_NOTIF_RECV ioctl. Previously, the kernel did not check whether these structures were zeroed out or not, so these worked. This patch zeroes out the seccomp_notif data structure prior to calling the ioctl. Signed-off-by: Sargun Dhillon Reviewed-by: Tycho Andersen Reviewed-by: Christian Brauner Link: https://lore.kernel.org/r/20191229062451.9467-1-sargun@sargun.me Fixes: 6a21cc50f0c7 ("seccomp: add a return code to trap to userspace") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/seccomp/seccomp_bpf.c | 2 ++ 1 file changed, 2 insertions(+) --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -3267,6 +3267,7 @@ TEST(user_notification_signal) close(sk_pair[1]); + memset(&req, 0, sizeof(req)); EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_RECV, &req), 0); EXPECT_EQ(kill(pid, SIGUSR1), 0); @@ -3285,6 +3286,7 @@ TEST(user_notification_signal) EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_SEND, &resp), -1); EXPECT_EQ(errno, ENOENT); + memset(&req, 0, sizeof(req)); EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_RECV, &req), 0); resp.id = req.id;