Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp86099img; Thu, 21 Mar 2019 14:45:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1YcZvPWRtEbxx6Anu62fsCnr0dC+KBrY4T3GM65U6EFwYLu/MT0AQca+xcC4nHMRlPnm+ X-Received: by 2002:aa7:91d7:: with SMTP id z23mr5665219pfa.137.1553204720677; Thu, 21 Mar 2019 14:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553204720; cv=none; d=google.com; s=arc-20160816; b=q6tJOdWHGdNmq+WoPVWbXqa2VxHpjkLQbCVYowhWz9lGTIgnPskaxGfVrsibGu+Y18 R2prH45WyPVpo49CcOLKFoSq7B5JbE8RyZT7pLPZ4SYkEkAWO6MpiP00/6UPL2GfWIM2 XgKKbZEjsINSvsH/bNOX2mJuCkQacgU/LaK33DvhQtNFcf2fnXYQJawIjYJygV9K2vf9 KXn6auBPNYDTi3lT+tqJA8slMkby0rppU1yesZX5uZXakPDogNVnLQq3OLHXqjWocllD ieBjGsacZB1dQluNAZpSWhnSydr7A8GtQ3CamJk8AAtCYTFZnWY4UsdnFsO8UYmfBDMq F7Zg== 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:dkim-signature; bh=i7m++E+Xib+uDsp7WuM+xF5x1nfGX9p80KlO1ZOhiz8=; b=PeybpG6RY0lrZUcxztEf1V5bmKXGcSm5l3iDMwlVZi/+snBNe5MlQypqCwWvsuxKKZ Jnwgcs11nsb2vm4nRcwtaIE+UBLcEoOMW2leezuRQ0Bj2u5OMHr0PZaTJXAegLoHseUP bn3RYrFa7R/a2yw7xJvGEcN1aM0rm2xj+N3NXnBQfj7C4erln7+aPS6aeYu13ctqi6cR 7YDJ114jucpJX5S3BU9zdLVEt25X+5oVmwwMeXNvECMtn2rBNZ6rjA1kbd0s8uOa4VUv wDtJMHloiVBOo1TXLraUFNMV2ySTJ39P1yjTdXIiDZ3CunDzv4h9/29RX0S4A2OM+EbS rB7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qZRSNs7d; 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 d4si5436717pla.112.2019.03.21.14.45.05; Thu, 21 Mar 2019 14:45:20 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qZRSNs7d; 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 S1726904AbfCUVoE (ORCPT + 99 others); Thu, 21 Mar 2019 17:44:04 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:34146 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbfCUVoE (ORCPT ); Thu, 21 Mar 2019 17:44:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=i7m++E+Xib+uDsp7WuM+xF5x1nfGX9p80KlO1ZOhiz8=; b=qZRSNs7dCUzn/FgvE+RBp5GcE PyFCIgy9sr+dhqNHb55IbM6O7+1jai0tmbHue06hJi1edHn1UxaaRKm4DFMYlL8CpYyYeysf5KeUn B4vUDi80+/c0e370T4+Ulq24ijI2SUc4O+ZJDXmVnL60LUBPr+8tKW4pgkUbMv2pF1nHIBgDJkeel +x2ngxtknSWuHspHItqADpzmtfxqjHz6LByUJd4+/TRSpI5BKRQHS3eHFhQ/rPj1nL3/+wjOUUG3S e7i8rOk++iorCbY3nYIjGRlsHLrYTPoOtmvHjWT7xQXsJpOa3PUK8lw23o+BU6XEzyeijCOp9NV+u jxcQYknxQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1h75Tm-0002fY-4W; Thu, 21 Mar 2019 21:44:02 +0000 Date: Thu, 21 Mar 2019 14:44:01 -0700 From: Matthew Wilcox To: Martin Blumenstingl Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, akpm@linux-foundation.org, mhocko@suse.com, rppt@linux.ibm.com, linux-amlogic@lists.infradead.org, liang.yang@amlogic.com, linux@armlinux.org.uk, linux-mtd@lists.infradead.org Subject: Re: 32-bit Amlogic (ARM) SoC: kernel BUG in kfree() Message-ID: <20190321214401.GC19508@bombadil.infradead.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 21, 2019 at 09:17:34PM +0100, Martin Blumenstingl wrote: > Hello, > > I am experiencing the following crash: > ------------[ cut here ]------------ > kernel BUG at mm/slub.c:3950! if (unlikely(!PageSlab(page))) { BUG_ON(!PageCompound(page)); You called kfree() on the address of a page which wasn't allocated by slab. > I have traced this crash to the kfree() in meson_nfc_read_buf(). > my observation is as follows: > - meson_nfc_read_buf() is called 7 times without any crash, the > kzalloc() call returns 0xe9e6c600 (virtual address) / 0x29e6c600 > (physical address) > - the eight time meson_nfc_read_buf() is called kzalloc() call returns > 0xee39a38b (virtual address) / 0x2e39a38b (physical address) and the > final kfree() crashes > - changing the size in the kzalloc() call from PER_INFO_BYTE (= 8) to > PAGE_SIZE works around that crash I suspect you're doing something which corrupts memory. Overrunning the end of your allocation or something similar. Have you tried KASAN or even the various slab debugging (eg redzones)?