From patchwork Tue Nov 10 22:20:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11895643 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E56611391 for ; Tue, 10 Nov 2020 22:20:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A1BFE20781 for ; Tue, 10 Nov 2020 22:20:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="lCftT4m0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A1BFE20781 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8F60B6B0074; Tue, 10 Nov 2020 17:20:38 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8A32F6B0075; Tue, 10 Nov 2020 17:20:38 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 741636B0078; Tue, 10 Nov 2020 17:20:38 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0074.hostedemail.com [216.40.44.74]) by kanga.kvack.org (Postfix) with ESMTP id 468376B0074 for ; Tue, 10 Nov 2020 17:20:38 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E8F49181AEF10 for ; Tue, 10 Nov 2020 22:20:37 +0000 (UTC) X-FDA: 77469928914.20.glass87_0803cc6272f8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id C1092180C07AB for ; Tue, 10 Nov 2020 22:20:37 +0000 (UTC) X-Spam-Summary: 1,0,0,8f93ee6c3ce31163,d41d8cd98f00b204,3nbkrxwokcakjwm0n7tw4upxxpun.lxvurw36-vvt4jlt.x0p@flex--andreyknvl.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:966:967:973:988:989:1260:1277:1313:1314:1345:1359:1431:1437:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2525:2559:2563:2682:2685:2693:2859:2902:2911:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3152:3352:3865:3866:3868:3872:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4385:4425:5007:6261:6653:6742:8603:9025:9969:10004:10400:11026:11473:11658:11914:12043:12296:12297:12438:12555:12679:12895:13069:13311:13357:14096:14097:14181:14394:14659:14721:21080:21365:21444:21451:21627:21939:21990:30012:30054,0,RBL:209.85.128.74:@flex--andreyknvl.bounces.google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100;04yg3me6jf744se6wk8iskyn68tfyopq6hf6kbeywnn7pnhnp8o6scggzd4jsim.uiwj4aijtbxoxhssdbji5qakbfwuky3c33eyfeqapkcj6trp5pr8da1qb7t4yju.n-lbl8.mailshell. net-223. X-HE-Tag: glass87_0803cc6272f8 X-Filterd-Recvd-Size: 4734 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Tue, 10 Nov 2020 22:20:37 +0000 (UTC) Received: by mail-wm1-f74.google.com with SMTP id k128so1861488wme.7 for ; Tue, 10 Nov 2020 14:20:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=gNopVjIT8PLD1roCXuMREiwLLvujReoC9+pcOjj05mE=; b=lCftT4m06a6889qXGQTef3H4ubHV8kKj9dGlz5f67eoPKWdz/PHnNnYEjABMQLk8d9 KObCel4cnvyGAfTLT3glV7CaPrDc0oVmARZammV+1pVoZ/2jSlMDKbk5t8ghqy2BrnAQ 6wiA3BXXhqVlgixBVMEYRnob8fIiyC/M+a6xp4u0aNMUCSSJaunS7d4ecvp+s9fgBTTl ILcUALwdqyXB6pkQZeuRw2BZ9ehON8RQWBZCFPbVG5/Tjjcf9C/MjxhSUXZvdV4Wx2sm tXxLD2ziia9ZukMCBDzC8zBSj5kuUeYjuML+1LS3YfaqORZ/tW8RY/g6NyBPCfrCuo0E RgsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=gNopVjIT8PLD1roCXuMREiwLLvujReoC9+pcOjj05mE=; b=MTkRkFW4sdE8vrdYBFfjamGvZLjtkvBvyFyl81NAdmqFRxyjSLButmkMj0ek3KrE3P muw+nEReKs3XwQfetA7z+XkHvFA93+UKFyuBzAvt09xGIr41DzV4xqy5cPNNO5BSRtgQ TSFzirLXoFalrxMVRkvzka7EJMbNjpQock47R0+weMVO+7ErG2Ir5WCqGxcmOvWOyIV8 NmFWEsIVL+0utolZlbLaZLkyE9IoKXRaBexMnmXiJ2VbM7ncsONadYTC7qrC9mBoS6mU iy+Yc1qsK/XFb++kaXVlyW6Tu1nf84Vn03JG5/Brp/W1wfT5mOsMAnd1NppiWEfmVQIP BtVQ== X-Gm-Message-State: AOAM532XyCffx54UMK2+rDPpjhYtgNDsbh8IFMEX4NcmEbSshEkC5BM8 inm//pqhwdMdcQwG1Ndk965yd61beMv7NuRL X-Google-Smtp-Source: ABdhPJywHqOrMb83vobFQz6uQH+1U+IiE7bFzlSvWOmiu58rv8s7DM6ShUb7PXTFUABDWl/FwVrflkCpjtBdifZz X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a1c:3803:: with SMTP id f3mr304885wma.14.1605046836014; Tue, 10 Nov 2020 14:20:36 -0800 (PST) Date: Tue, 10 Nov 2020 23:20:07 +0100 In-Reply-To: Message-Id: <5302e6d48429465259bd0868a7dc357290a2e8a5.1605046662.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8-goog Subject: [PATCH v2 03/20] kasan: introduce set_alloc_info From: Andrey Konovalov To: Dmitry Vyukov , Alexander Potapenko , Marco Elver Cc: Catalin Marinas , Will Deacon , Vincenzo Frascino , Evgenii Stepanov , Andrey Ryabinin , Branislav Rankov , Kevin Brodsky , Andrew Morton , kasan-dev@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov 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: Add set_alloc_info() helper and move kasan_set_track() into it. This will simplify the code for one of the upcoming changes. No functional changes. Signed-off-by: Andrey Konovalov Reviewed-by: Dmitry Vyukov Link: https://linux-review.googlesource.com/id/I0316193cbb4ecc9b87b7c2eee0dd79f8ec908c1a Reviewed-by: Marco Elver --- mm/kasan/common.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/kasan/common.c b/mm/kasan/common.c index 8fd04415d8f4..a880e5a547ed 100644 --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -318,6 +318,11 @@ bool kasan_slab_free(struct kmem_cache *cache, void *object, unsigned long ip) return __kasan_slab_free(cache, object, ip, true); } +static void set_alloc_info(struct kmem_cache *cache, void *object, gfp_t flags) +{ + kasan_set_track(&kasan_get_alloc_meta(cache, object)->alloc_track, flags); +} + static void *__kasan_kmalloc(struct kmem_cache *cache, const void *object, size_t size, gfp_t flags, bool keep_tag) { @@ -345,7 +350,7 @@ static void *__kasan_kmalloc(struct kmem_cache *cache, const void *object, KASAN_KMALLOC_REDZONE); if (cache->flags & SLAB_KASAN) - kasan_set_track(&kasan_get_alloc_meta(cache, object)->alloc_track, flags); + set_alloc_info(cache, (void *)object, flags); return set_tag(object, tag); }