Received: by 10.213.65.68 with SMTP id h4csp643826imn; Fri, 6 Apr 2018 06:40:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Bx9iHgRz0IZyRkFxp1h6t4/+5T3W0WaHgJNhcBSyH+QZcQo2GesMJRzlrXLGqVGx2KDRE X-Received: by 2002:a17:902:8c88:: with SMTP id t8-v6mr27068690plo.329.1523022004289; Fri, 06 Apr 2018 06:40:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523022004; cv=none; d=google.com; s=arc-20160816; b=kiaNt1aaqqD2C9u7EhFsOFi9IrsX4c3vdz4OGwvJnbTH0YYLYLZZKTkJ1/LDNzLpBR r1pBeot+ujGfeHt/SKlukp3pv8raKThQShvtepbkGAkB5ojHQINWBa4NUN4iLcfqO3cA T510nbdQKWYrWfINsPNd1gRnWgHMR8Ip+jgumI/UgK8AWh6En9P6cYqDeBsMdY5hrIhV s7UicT1E8ZzQT/bZaNVIgatbwBEJGr/3mM1axt2Obo7iyAI4fzR/7ppzXxFIkYVeV/UO BEGx+tqNPUu6yAohzlF7Rkiaj2UuMPkg6OiWF5HVxTUE06J5qu/63vGGfoeTGejyO2TZ 0R3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=AWgawokpVpjLXUrXwn7aU/0CIEz3VHeHb75ilvyFlwg=; b=og8ArnhzL1sA1lYg/k2DBOH6Xxo6JNDoQBPe1qAoZjaqJyhZ2GnX0x+GRt/X4YwzPM Xexx23AjhBIkslFLKAf+5QBwEFJquxzReKysgXby/U2KSrCp+plMidV5kox5cW6GCXqD vkdkCmWjAkf5cbf4BIxbnE7UG4wQU10eOvfTZp5qsIQznai9Of7odhNOlGimz8MKLLxj Hn2bR4/I9fR6SFIjUnFaTS9Gd0Nm/keegwEkvgR0gxy8nvejN933zAWbZmQXnL37DPN8 gdloPjlzU+yJ5W0+vsk0jDKO2k0NAfo1qlAPRGUZu60iiVG0l4ih2hf3JbFyNQCNH+Yg SwPg== ARC-Authentication-Results: i=1; mx.google.com; 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 f2-v6si8360255plo.434.2018.04.06.06.39.50; Fri, 06 Apr 2018 06:40:04 -0700 (PDT) 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; 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 S932447AbeDFNi1 (ORCPT + 99 others); Fri, 6 Apr 2018 09:38:27 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33314 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932436AbeDFNiW (ORCPT ); Fri, 6 Apr 2018 09:38:22 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 292C1890; Fri, 6 Apr 2018 13:38:22 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steffen Klassert Subject: [PATCH 4.14 27/67] xfrm: Refuse to insert 32 bit userspace socket policies on 64 bit systems Date: Fri, 6 Apr 2018 15:23:57 +0200 Message-Id: <20180406084344.948813357@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180406084341.225558262@linuxfoundation.org> References: <20180406084341.225558262@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Steffen Klassert commit 19d7df69fdb2636856dc8919de72fc1bf8f79598 upstream. We don't have a compat layer for xfrm, so userspace and kernel structures have different sizes in this case. This results in a broken configuration, so refuse to configure socket policies when trying to insert from 32 bit userspace as we do it already with policies inserted via netlink. Reported-and-tested-by: syzbot+e1a1577ca8bcb47b769a@syzkaller.appspotmail.com Signed-off-by: Steffen Klassert Signed-off-by: Greg Kroah-Hartman --- net/xfrm/xfrm_state.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -2050,6 +2050,11 @@ int xfrm_user_policy(struct sock *sk, in struct xfrm_mgr *km; struct xfrm_policy *pol = NULL; +#ifdef CONFIG_COMPAT + if (in_compat_syscall()) + return -EOPNOTSUPP; +#endif + if (!optval && !optlen) { xfrm_sk_policy_insert(sk, XFRM_POLICY_IN, NULL); xfrm_sk_policy_insert(sk, XFRM_POLICY_OUT, NULL);