Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1411677imm; Thu, 19 Jul 2018 00:52:25 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe2PtpN9YKNBYh7RdD2V4ZsaE1Jr7aY1jSDwOz5FQnXDn/5a+wOlGj1/9dx7kpVlv1cEe4T X-Received: by 2002:a62:c699:: with SMTP id x25-v6mr8704499pfk.16.1531986745424; Thu, 19 Jul 2018 00:52:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531986745; cv=none; d=google.com; s=arc-20160816; b=d6N7MyuA96Eng8Ws6h1JtUKzFey7wIRhyWiaDLYVMboUyN/gkN+vG4BlsOlveFzVAG CtVnLoK6tLQYdzdAR1TpMgUYrAwczC5ozMnJwxOPVzfdHlB5l7pWfSF5vtXTTZRkoEB8 SvFFrqXTNdxQKLqGFNaBzMXRASzoNWFM1BU1RMGwVyGRWwVIbwMC6/ub2PvBqEhBz7HD Jl6dlY3llAGib09gZ2aBx4jiUBFz/ByGQXGI4+8rT/2XIS50x+uvmJIYYhA8iSVjKOvK P975j8CVgxntWZe6Q+maKJZJnlQTtJTElNbzzu8z9qYi5T6RgaIEjYYtApOHAOKXsWZt UVIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=vKWJa7L4b37QUnmQ9c+RuNy6G4Ga3nN4TuOUoh48uYI=; b=mHVyAcy7G9uaPu1PJD7w+mDIFzOngfNDtkxDFRqL7mNxCUoqxo+G5Kmk8DgupBqgKm WHQqYaLJArinOvcMWKFSAkD8NT/b+eaQPnvU4icV6/tuYVtUDLcQGkPo2CmhJJguWQg9 l9Q+UPeGuQVbLVey8afYGMZ4jCcgip8qHW4N1JJ0WQD3EUhJFowPxELgVNQLDmKd2Tbd hvxl2hdqpl6ZWid7yyjG/BSgLdAu5Jd+zjJ4E2J3Y0SOTvgT1denZDQi5poXSoYsSycd E6fB2d5FLhgaRACuz0Ng/QNk4eCk2jAIeoEP2j2AQvXl5mKMy2KaewvzsNka9Kb6mVPH FUVA== 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 q24-v6si4703729pls.46.2018.07.19.00.52.10; Thu, 19 Jul 2018 00:52:25 -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 S1731073AbeGSIdS (ORCPT + 99 others); Thu, 19 Jul 2018 04:33:18 -0400 Received: from a.mx.secunet.com ([62.96.220.36]:42740 "EHLO a.mx.secunet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727528AbeGSIdS (ORCPT ); Thu, 19 Jul 2018 04:33:18 -0400 Received: from localhost (localhost [127.0.0.1]) by a.mx.secunet.com (Postfix) with ESMTP id 9A8A2201AA; Thu, 19 Jul 2018 11:51:10 +0200 (CEST) X-Virus-Scanned: by secunet Received: from a.mx.secunet.com ([127.0.0.1]) by localhost (a.mx.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wJWzdI0ZEDyx; Thu, 19 Jul 2018 11:51:10 +0200 (CEST) Received: from mail-essen-01.secunet.de (mail-essen-01.secunet.de [10.53.40.204]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a.mx.secunet.com (Postfix) with ESMTPS id 4D9BF201A7; Thu, 19 Jul 2018 11:51:10 +0200 (CEST) Received: from gauss2.secunet.de (10.182.7.193) by mail-essen-01.secunet.de (10.53.40.204) with Microsoft SMTP Server id 14.3.399.0; Thu, 19 Jul 2018 09:51:24 +0200 Received: by gauss2.secunet.de (Postfix, from userid 1000) id 1864B3181DA2; Thu, 19 Jul 2018 09:51:25 +0200 (CEST) Date: Thu, 19 Jul 2018 09:51:25 +0200 From: Steffen Klassert To: air icy CC: Herbert Xu , , Subject: Re: UBSAN: Undefined behaviour in ./include/net/xfrm.h Message-ID: <20180719075124.m3evqrlif3ha4ecn@gauss3.secunet.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) X-G-Data-MailSecurity-for-Exchange-State: 0 X-G-Data-MailSecurity-for-Exchange-Error: 0 X-G-Data-MailSecurity-for-Exchange-Sender: 23 X-G-Data-MailSecurity-for-Exchange-Server: d65e63f7-5c15-413f-8f63-c0d707471c93 X-EXCLAIMER-MD-CONFIG: 2c86f778-e09b-4440-8b15-867914633a10 X-G-Data-MailSecurity-for-Exchange-Guid: 684AE89D-9B00-4F9F-9BE9-E85F41C784FB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 22, 2018 at 11:46:44PM +0800, air icy wrote: > Hi, > > static inline bool addr4_match(__be32 a1, __be32 a2, u8 prefixlen) > { > /* C99 6.5.7 (3): u32 << 32 is undefined behaviour */ > if (sizeof(long) == 4 && prefixlen == 0) > return true; > return !((a1 ^ a2) & htonl(~0UL << (32 - prefixlen))); > } > > > $ cat report0 > ================================================================================ > UBSAN: Undefined behaviour in ./include/net/xfrm.h:894:23 > shift exponent -128 is negative Looks like we don't validate the prefixlen of the address family in the xfrm_selector. > This bug can be repro, if you need the repro file, please tell me. Can you send me your reproducer?