From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55466CA9EB7 for ; Tue, 22 Oct 2019 17:22:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1CEC720679 for ; Tue, 22 Oct 2019 17:22:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LfgNq1NN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1CEC720679 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9CADC6B000E; Tue, 22 Oct 2019 13:22:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 97B2E6B026B; Tue, 22 Oct 2019 13:22:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8695E6B026C; Tue, 22 Oct 2019 13:22:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0205.hostedemail.com [216.40.44.205]) by kanga.kvack.org (Postfix) with ESMTP id 5FDE36B000E for ; Tue, 22 Oct 2019 13:22:28 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id EF14F180AD802 for ; Tue, 22 Oct 2019 17:22:27 +0000 (UTC) X-FDA: 76072089534.11.grip19_89de7f34bc40b X-HE-Tag: grip19_89de7f34bc40b X-Filterd-Recvd-Size: 6464 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Tue, 22 Oct 2019 17:22:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571764946; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DYe7sXZbkW6x0+4z45DRiC8jJviu2jpg3kuxyxWl3ng=; b=LfgNq1NNYo1Yq3sqhVQtyLO/g4RyiefSm5oJUzzYpqv5NlV0cjr5r8jtDcSw4052EaLMCA pjtS7i1Ah6lnB0vi1/M2pIB4WZVqGUvFiufir1bSroroCJMKTJPT5j9pOWDTgSvJm9HAj7 K3S86o/SXOXtQ3zifSbCNNxEadk48fk= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-7-d9LuCzR8MX2j4tQs09xpZA-1; Tue, 22 Oct 2019 13:22:22 -0400 Received: by mail-qk1-f200.google.com with SMTP id w67so9540209qkb.4 for ; Tue, 22 Oct 2019 10:22:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:organization:user-agent:mime-version :content-transfer-encoding; bh=aPRxFMkNB6srnlFX1YYoFjkf1pH9LbIq1Eh01At/K7g=; b=KyCNYpwWZlp41Xkm/7oNs9w8KjurBo71m68MJTrzhtQHfHTz0NHgQ+SaMq3Cl3RF3z 6W2W0wDw7m46Re3dMoznljjM8sjhg+JwVexiLKjtznK9P444FND1ainXO0O0NTSXDlSD S0sBExpEm2GUaAwCoqQPcGLJuxrIFUIc+jtjaZTzTPPTUk4nJAy3iDXoRa8p7dMe1pcL k4UkUQXvqWPvgCpmVroCviUeFnz0pdquiSiRobMDjxe4EE02YI/EU3nlKf72CKPPPChy qh0MMmFP0Fi2/AfyFLMfZnAjkC46gix+MuXlZaleThFLpD5XDPCSCFMq9Lat/QS8APsv hOew== X-Gm-Message-State: APjAAAUI1rhyw7mzlDvktVLN186e3YG+VTPokTe3FYZ+bCu9ysgPF+P6 MY4Or9mOr/odKFulCm8WO6Y2IsFtm5p9vZMXEqAXts7NR1BOpWWtSkGlx21YkKHUSV/ea0AI3r6 g0HQG9dxj6DE= X-Received: by 2002:a05:6214:2a4:: with SMTP id m4mr63213qvv.165.1571764942123; Tue, 22 Oct 2019 10:22:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5uvybGj0e1kNUfWhUC24F1OoT5sVrZih1f+cM/euoSjPZxd6/saXn/ubK0+Vz/yya6hB0mw== X-Received: by 2002:a05:6214:2a4:: with SMTP id m4mr63188qvv.165.1571764941783; Tue, 22 Oct 2019 10:22:21 -0700 (PDT) Received: from dhcp-10-20-1-11.bss.redhat.com ([144.121.20.162]) by smtp.gmail.com with ESMTPSA id 81sm12662041qkd.73.2019.10.22.10.22.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 10:22:21 -0700 (PDT) Message-ID: Subject: Re: [RFC] kasan: include the hashed pointer for an object's location From: Lyude Paul To: Dmitry Vyukov Cc: Linux-MM , kasan-dev , Sean Paul , Daniel Vetter , Andrey Ryabinin , Alexander Potapenko , LKML Date: Tue, 22 Oct 2019 13:22:19 -0400 In-Reply-To: References: <20191022021810.3216-1-lyude@redhat.com> Organization: Red Hat User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 X-MC-Unique: d9LuCzR8MX2j4tQs09xpZA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, 2019-10-22 at 04:27 +0200, Dmitry Vyukov wrote: > On Tue, Oct 22, 2019 at 4:19 AM Lyude Paul wrote: > > The vast majority of the kernel that needs to print out pointers as a > > way to keep track of a specific object in the kernel for debugging > > purposes does so using hashed pointers, since these are "good enough". > > Ironically, the one place we don't do this is within kasan. While > > simply printing a hashed version of where an out of bounds memory acces= s > > occurred isn't too useful, printing out the hashed address of the objec= t > > in question usually is since that's the format most of the kernel is > > likely to be using in debugging output. > >=20 > > Of course this isn't perfect though-having the object's originating > > address doesn't help users at all that need to do things like printing > > the address of a struct which is embedded within another struct, but > > it's certainly better then not printing any hashed addresses. And users > > which need to handle less trivial cases like that can simply fall back > > to careful usage of %px. > >=20 > > Signed-off-by: Lyude Paul > > Cc: Sean Paul > > Cc: Daniel Vetter > > Cc: Andrey Ryabinin > > Cc: Alexander Potapenko > > Cc: Dmitry Vyukov > > Cc: kasan-dev@googlegroups.com > > --- > > mm/kasan/report.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > >=20 > > diff --git a/mm/kasan/report.c b/mm/kasan/report.c > > index 621782100eaa..0a5663fee1f7 100644 > > --- a/mm/kasan/report.c > > +++ b/mm/kasan/report.c > > @@ -128,8 +128,9 @@ static void describe_object_addr(struct kmem_cache > > *cache, void *object, > > int rel_bytes; > >=20 > > pr_err("The buggy address belongs to the object at %px\n" > > - " which belongs to the cache %s of size %d\n", > > - object, cache->name, cache->object_size); > > + " (aka %p) which belongs to the cache\n" > > + " %s of size %d\n", > > + object, object, cache->name, cache->object_size); >=20 > Hi Lyude, >=20 > This only prints hashed address for heap objects, but > print_address_description() has 4 different code paths for different > types of addresses (heap, global, stack, page). Plus there is a case > for address without shadow. > Should we print the hashed address at least for all cases in > print_address_description()? Yep-this is probably a good idea. Will send a respin in a little bit >=20 >=20 > > if (!addr) > > return; > > -- > > 2.21.0 > >=20 --=20 Cheers, =09Lyude Paul