Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp939058pxx; Thu, 29 Oct 2020 19:28:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwT3Av1LQHTOSIipDmHDJMiYjk12x8EG9T69hN7I6KrRzti1TnAz8p3QO9reR9lDAzfoWO4 X-Received: by 2002:a17:906:2cc5:: with SMTP id r5mr342342ejr.328.1604024910899; Thu, 29 Oct 2020 19:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604024910; cv=none; d=google.com; s=arc-20160816; b=sTtIfk5Ja4MjH8ETqO13EfBWWHlUBIG4UU2UMYVDXzYupxjbD797z3HRbJYXSdsCco L37YC+NJJzj6RoXZ5Z/NXCFtApyKW4jMZ+PA9yIXoCiWWt2GZdGM97ntrixiGhJLL6O2 RxitsVO4p7LnlbpE0n1XGketu+byvh8SX/5KmCUVw+2/jIVvNyKjlzMD42bJlb7KA17V W8cn2D+mS2ZotEotYMVC5oE0thWsQ5ZCjzm9ws1eGt6cV4vZeDMrEarYqkLtBJ7JX2iB OrzD7GXPwNGbOsc30OoBg17IZcYG5WTlrG30eO9OJtr9YdMDpO/A+A2yupChta12IqRf QHFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Cffn0GfYN+WIFr13ZpJjw/0tqOhXXXnigKty10nABv0=; b=O/7LFmrSwkyH5t0Fzkim3HkRIyno1A5zoITBc2FYSVZ2CWG+lLPYNVSbIhUpvbzyR1 em3LIY066wc170MBXmAMilqoApbGJDBXolWnFucFX/3jigOr3OjlTWPjX00rwJXObbm6 nCdIGo2e9EEhht8Gz9j+LD+94qHWhD6RFLSTHnRUZSwOlfye3AP5bjdbFVcWvoi7QZ/0 ZkVr0ithcWB5Aue70S5ltPf2jtvHMoQ44CeoWRIupGL8ePvWswE7mElsxCY+aD8lTww4 iV8uN6tMysqKFlJmQUtQYGZO01tDMgsGssYUqnzLVq2KjQbL4zyEl4ceNlgd/Cpka7EJ jfSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=YaXQ0fVY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w21si177360edx.274.2020.10.29.19.28.08; Thu, 29 Oct 2020 19:28:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=YaXQ0fVY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=arista.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726196AbgJ3C0I (ORCPT + 99 others); Thu, 29 Oct 2020 22:26:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726100AbgJ3C0G (ORCPT ); Thu, 29 Oct 2020 22:26:06 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5238BC0613CF for ; Thu, 29 Oct 2020 19:26:05 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id k125so1624157wmf.0 for ; Thu, 29 Oct 2020 19:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cffn0GfYN+WIFr13ZpJjw/0tqOhXXXnigKty10nABv0=; b=YaXQ0fVYKz4iwdSGVlHjlXUO8QIdNqsj9lzso9QZ91FBIM/LqXErDk035fXTD7OXVz xDrp56nksbdQkIe6B9HZZ6axhv2aGJzCk5uA3EXUYC1v7zzI5gA+ich4/PcNyQ/qLqz4 hLueSqJkthTlJsAFVferUQxgqG0RKl/e7kMy0VhjAGOjbCO5IE8g4T6+wXGFguishGxQ 0bUkT65bfVLzfxo/i5fblwPelC7rSCbMWHLnqu5KWvzCgo2GoqNMBDAeKQCP/Fc0EKxd VjVaa8aSXsJQBc6QumIFM93AP0NFDaFJJ6ejqKOMMjJwaKrc772OLqZj8NTheQEfqzTk AAQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cffn0GfYN+WIFr13ZpJjw/0tqOhXXXnigKty10nABv0=; b=ZgnxwBKXTkTOTlQgS11BXYnoUPT1LAuTv8+O5E3oMRtmhUK2dEQOOnFTU4/rKdpFkg 8HVrp/boDvPkX+0bXH+u5fz6k5z1B20WWbzIT1eRDCVuYnX1CZtMkrl2z5BmpaJlxOLg MDyrW3eLjLnvS5U9rBbQAlKSeA4kOV1HLeVjiVyorsl6ucysXdcl9Vkp59j+nDHIMihA MCC3lL4FpWt5YTwPSnsjJ7T97m71LV4J8Yt33z8DyTkRxeytMbEFt115y+42yTko5qmF O1jPTOduWjPL1KMiN07NjRoiZzNncNxZo54efmL4Gn+0+KJ1fjj2KjJ7Zv2RpPy1wM7L pvLA== X-Gm-Message-State: AOAM533G5QuC2uOghO67R5PbF6fLimhoEi7VrnVOxEkNH6rr/Wj5sV99 56/qzCmAhkzSVjPAuUvdPLc802wMLzlNfsbN X-Received: by 2002:a1c:398a:: with SMTP id g132mr2394304wma.51.1604024763775; Thu, 29 Oct 2020 19:26:03 -0700 (PDT) Received: from localhost.localdomain ([2a02:8084:e84:2480:228:f8ff:fe6f:83a8]) by smtp.gmail.com with ESMTPSA id i14sm2757170wml.24.2020.10.29.19.26.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 19:26:03 -0700 (PDT) From: Dmitry Safonov To: linux-kernel@vger.kernel.org Cc: Dmitry Safonov <0x7f454c46@gmail.com>, Dmitry Safonov , Steffen Klassert , "David S. Miller" , Jakub Kicinski , Herbert Xu , Hillf Danton , netdev@vger.kernel.org, syzbot+a7e701c8385bd8543074@syzkaller.appspotmail.com Subject: [PATCH 1/3] xfrm/compat: Translate by copying XFRMA_UNSPEC attribute Date: Fri, 30 Oct 2020 02:25:58 +0000 Message-Id: <20201030022600.724932-2-dima@arista.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030022600.724932-1-dima@arista.com> References: <20201030022600.724932-1-dima@arista.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org xfrm_xlate32() translates 64-bit message provided by kernel to be sent for 32-bit listener (acknowledge or monitor). Translator code doesn't expect XFRMA_UNSPEC attribute as it doesn't know its payload. Kernel never attaches such attribute, but a user can. I've searched if any opensource does it and the answer is no. Nothing on github and google finds only tfcproject that has such code commented-out. What will happen if a user sends a netlink message with XFRMA_UNSPEC attribute? Ipsec code ignores this attribute. But if there is a monitor-process or 32-bit user requested ack - kernel will try to translate such message and will hit WARN_ONCE() in xfrm_xlate64_attr(). Deal with XFRMA_UNSPEC by copying the attribute payload with xfrm_nla_cpy(). In result, the default switch-case in xfrm_xlate64_attr() becomes an unused code. Leave those 3 lines in case a new xfrm attribute will be added. Reported-by: syzbot+a7e701c8385bd8543074@syzkaller.appspotmail.com Signed-off-by: Dmitry Safonov --- net/xfrm/xfrm_compat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/xfrm/xfrm_compat.c b/net/xfrm/xfrm_compat.c index e28f0c9ecd6a..17edbf935e35 100644 --- a/net/xfrm/xfrm_compat.c +++ b/net/xfrm/xfrm_compat.c @@ -234,6 +234,7 @@ static int xfrm_xlate64_attr(struct sk_buff *dst, const struct nlattr *src) case XFRMA_PAD: /* Ignore */ return 0; + case XFRMA_UNSPEC: case XFRMA_ALG_AUTH: case XFRMA_ALG_CRYPT: case XFRMA_ALG_COMP: -- 2.28.0