Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp7613079ybh; Thu, 8 Aug 2019 19:50:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9RvZx54Hug2ft5n6ijFnBth/68ssRFyPrZLGeeUSeIfEsY8B8fSwJfQbZQMecTHhtZkdY X-Received: by 2002:a63:1f1b:: with SMTP id f27mr15350911pgf.233.1565319002624; Thu, 08 Aug 2019 19:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565319002; cv=none; d=google.com; s=arc-20160816; b=Hm5LcBz8dhoASc6sOaC3We4/0r2FVNT+LlOBKJHkGHErQOPbcPSGvNgTVAxh4rtrdQ iUv22P0kBSH4AYkiHbyJBBOxPtLYkU6pVYyDV2Fy5VS5Hz97ZJwKUrtRFDbVO9Oyw3oz WvHHaz8D0vLxh2KHOKW3kA3B9J2WLltZ3tIsy+R+zr3JZckziuUmslrU5KLU306K4w7B LHUh4NWhoMlarrh7uU7zOrb1NCrX9OwCcTgp32WxEYSpq9nP9ilED4mnz2D8l4dJ5lFO K+6E6VlbZTaGtAuq4I2TLG0yMkOBe8AlF2dLkg+f3Up92cDwTT5D9qzE2T9Y4L+fr/zw 9cJQ== 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=k9ysUCj8sFdxJhtdA1rA7e9UmHUPqdKijogVrakBrS8=; b=DIPYfzAk6Oj8qwBs1PLlKitZfgIWl/bdmt7809/7iK4oMBkNrjZDZobTDXlX29rI6K 1K8ar0fC1jBO2z1j2FUAyrd5JrSh5VWueleBIh2dv7as29XBUA4W8JoEXjWxEbqo1pOW DouHtVZL9APAq3R7Mcak6/Mtxv8+DF5bnLfKkaCksroQwhT5kb5fQcvWOwWEqEfny/7A N3V9m+sTSp0AFgrhGpdCBs8aAKi8GCLk1VYePlIr0WcJnUgt36cDtMyQwRmeFSghssGW kHCBb0XO+xfYyL44mI7zw+0d2XPe35kLr+86jkQQi5AwJ1l5l7RwBPg9JolyDr5O0+jk b8FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=WaAJIxvx; 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 b6si3182182pjz.29.2019.08.08.19.49.38; Thu, 08 Aug 2019 19:50:02 -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=WaAJIxvx; 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 S2404592AbfHICqx (ORCPT + 99 others); Thu, 8 Aug 2019 22:46:53 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:37592 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733140AbfHICqx (ORCPT ); Thu, 8 Aug 2019 22:46:53 -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=k9ysUCj8sFdxJhtdA1rA7e9UmHUPqdKijogVrakBrS8=; b=WaAJIxvxqLMJwq4r0MuB186tS eB35TdZihw8we7T+6rzfXNcdc1BFrSHTsICCgF9IYxPFMXnH51MOTuYcDuzIEQFJTMbpdZHz7kU4l 1gXCVm3zmGNat8g+4gEFOmlEJuABJAdswqsBLhwukirmbwfQV0VJh1UOgKcKX0IHlCnqa9ftb3GN5 anKRc6DAtdHrlXV80dZ8UTLKLtWWw6siF34Vuvs30NBWsAIUoDuZlJjPXL5Z3iyVaI9c8MyiBg6a+ ZzMgnF9fEFZkYUNsrMbPcS0zzVnVA5rZwBUyx3/flkMtA4BlYIqbgSIAqMmX6Ch8YNSw7wcyQUOQo SWWUHUk+A==; Received: from willy by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1hvuvU-0008Bg-Kn; Fri, 09 Aug 2019 02:46:44 +0000 Date: Thu, 8 Aug 2019 19:46:44 -0700 From: Matthew Wilcox To: miles.chen@mediatek.com Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, wsd_upstream@mediatek.com, "Tobin C . Harding" , Kees Cook Subject: Re: [RFC PATCH v2] mm: slub: print kernel addresses in slub debug messages Message-ID: <20190809024644.GL5482@bombadil.infradead.org> References: <20190809010837.24166-1-miles.chen@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190809010837.24166-1-miles.chen@mediatek.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 09, 2019 at 09:08:37AM +0800, miles.chen@mediatek.com wrote: > Possible approaches are: > 1. stop printing kernel addresses > 2. print with %pK, > 3. print with %px. No. The point of obscuring kernel addresses is that if the attacker manages to find a way to get the kernel to spit out some debug messages that we shouldn't leak all this extra information. > 4. do nothing 5. Find something more useful to print. > INFO: Slab 0x(____ptrval____) objects=25 used=10 fp=0x(____ptrval____) ... you don't have any randomness on your platform? > INFO: Object 0x(____ptrval____) @offset=1408 fp=0x(____ptrval____) > Redzone (____ptrval____): bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb > Redzone (____ptrval____): bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb > Redzone (____ptrval____): bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb > Redzone (____ptrval____): bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb > Redzone (____ptrval____): bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb > Redzone (____ptrval____): bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb > Redzone (____ptrval____): bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb > Redzone (____ptrval____): bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb > Object (____ptrval____): 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > Object (____ptrval____): 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > Object (____ptrval____): 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > Object (____ptrval____): 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > Object (____ptrval____): 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > Object (____ptrval____): 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > Object (____ptrval____): 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > Object (____ptrval____): 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5 > Redzone (____ptrval____): bb bb bb bb bb bb bb bb > Padding (____ptrval____): 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a > Padding (____ptrval____): 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a > Padding (____ptrval____): 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a > Padding (____ptrval____): 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a > ... > FIX kmalloc-128: Object at 0x(____ptrval____) not freed But if you have randomness, at least some of these "pointers" are valuable because you can compare them against "pointers" printed by other parts of the kernel. > After this patch: > > INFO: Slab 0xffffffbf00f57000 objects=25 used=23 fp=0xffffffc03d5c3500 > INFO: Object 0xffffffc03d5c3500 @offset=13568 fp=0xffffffc03d5c0800 > Redzone 00000000: bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb > Redzone 00000010: bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb > Redzone 00000020: bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb > Redzone 00000030: bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb > Redzone 00000040: bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb > Redzone 00000050: bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb > Redzone 00000060: bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb > Redzone 00000070: bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb > Object 00000000: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > Object 00000010: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > Object 00000020: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > Object 00000030: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > Object 00000040: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > Object 00000050: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > Object 00000060: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b > Object 00000070: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5 > Redzone 00000000: bb bb bb bb bb bb bb bb > Padding 00000000: 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a > Padding 00000010: 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a > Padding 00000020: 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a > Padding 00000030: 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a > ... > FIX kmalloc-128: Object at 0xffffffc03d5c3500 not freed It looks prettier, but I'm not convinced it's more useful. Unless your platform lacks randomness ...