Received: by 10.213.65.68 with SMTP id h4csp715512imn; Fri, 6 Apr 2018 07:44:55 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/kjuLW2/0qhkmUjyy8RXHFANzYef2+8gMpLSLjz9h8N/wnDPfYwPA1L01NYpl1lJEm5jfH X-Received: by 10.101.82.69 with SMTP id q5mr18034039pgp.358.1523025895544; Fri, 06 Apr 2018 07:44:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523025895; cv=none; d=google.com; s=arc-20160816; b=iWImUAm5zzc+4ZgCiR54n9PTwZgW0j2tHXl18WZW5pvly5JzZ30ZQHZZvzp/3ylFHG JHEgj312cH1t9ysKm0rpuKEMy89t5JbHHSnBa5q5Gl2dn7lIX+8xprR7E4suby2yqIZB Bt88VTpilOFp8Xt9Ep/eJGKNsHHiC1OOOCstBzrj4u/w4PyA/PasN1NgbsmPNtbisfWB 0kFYSEs9FnsJi3aQvr9u71U7l5NOpqeWIYrxjcNkbDFnsN6bKuzVI52PqJrFT/pcNK4x H//XS5Os989m1i6J0VvmmjttBBj5Sv+l/7DPzajBxZkg6zVoccyQVPjib/slA9fBMtbv qykw== 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=RZlTVomttObMDN6k4CYBsEkJBCM/V5MEZiSlqckygAg=; b=YHYMQMkz3mhd0cMjrUP7BiZ9HW5cnWZQhYx8yqr4zC4oQZP5LVcoU3rJb/CaEXSoFy /uP7SDTL5/MOl6/UwGtesdav9420muWQi/NCnVLDtM+E4DrBlGA4mMul2RRfmuvZSyiQ F/jYVYqXMf5MWRS9W5Zx3JSEmUJ0Odo4aoMqO/Q4w+bRwuml1CxF0bipPJA1uX7qZ8KO J4NtIR8wcnhiVZxsaeQmbzfFnShW2YBjS9L4WGTW6CIgF7amR2P5nQi98gHgjNNfHWHZ 8oj8se0MVWZiiYHSosO5YCNhIsAaFFgOY3ODa4vteLUpnkO0P/X0c8CVLqZs/fsRYa+g 6usA== 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 v1si7162574pgc.137.2018.04.06.07.44.41; Fri, 06 Apr 2018 07:44:55 -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 S1755153AbeDFOnj (ORCPT + 99 others); Fri, 6 Apr 2018 10:43:39 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58224 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755791AbeDFNeO (ORCPT ); Fri, 6 Apr 2018 09:34:14 -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 28737D37; Fri, 6 Apr 2018 13:34:14 +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.9 043/102] xfrm: Refuse to insert 32 bit userspace socket policies on 64 bit systems Date: Fri, 6 Apr 2018 15:23:24 +0200 Message-Id: <20180406084337.671553443@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180406084331.507038179@linuxfoundation.org> References: <20180406084331.507038179@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.9-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 @@ -1883,6 +1883,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);