From patchwork Wed May 16 15:34:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 10404233 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CED53602C2 for ; Wed, 16 May 2018 15:34:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD03F28446 for ; Wed, 16 May 2018 15:34:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1BAC284C3; Wed, 16 May 2018 15:34:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97E7D28455 for ; Wed, 16 May 2018 15:34:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E062C6B0339; Wed, 16 May 2018 11:34:39 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DB46F6B033A; Wed, 16 May 2018 11:34:39 -0400 (EDT) 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 CCBEE6B033B; Wed, 16 May 2018 11:34:39 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr0-f199.google.com (mail-wr0-f199.google.com [209.85.128.199]) by kanga.kvack.org (Postfix) with ESMTP id 6C0A76B0339 for ; Wed, 16 May 2018 11:34:39 -0400 (EDT) Received: by mail-wr0-f199.google.com with SMTP id 44-v6so908167wrt.9 for ; Wed, 16 May 2018 08:34:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id; bh=8pa/d6KslmQ9EJPFpJmfQ4Q+lfwORP/zfrtpj0cb2aY=; b=XtCcsTMLHUlvqJ8tsFL7QGDyCNfRODrihtsiirm179pcMirznfdBUqjCNRKhsyyV+A 7wHw60/EhbdVtDoJ9dSVnkoz/jE5bXQCPXbhuDokakjIC7OlPgDe/cCoTwmjlNUrAOlv NWIgffjVMuo4pLFO7KVr54OlBbkFLyE/5eaMLbX/rHbcrpD06Ne2gFAT/r8d+GipaB3A NT/SwiSxu6N3C0OIjCA7Yh3D6UbFiHO6+qG3fdKjGn9SoKqSdamm0dmQTHzW/vUNDOKX wCXUnqVazEB3yfzguAKGVP402akVO4MRMWDWJz9h04yGQjJxNsdSDqDvaNMva1nO7/Gt m8zw== X-Gm-Message-State: ALKqPwcG/Z+mZqV+65+TeQMxVIvMelh/kPUll03Tylgxf54gKaj+h4ft uHhboo6di6eYYZChPVu1QDsgaGy72hBUZ50i3LWixwnNWZxGFiDWZHeelXlyT94ZxfBPrSI2ZmU BUshpE8dyc9ktmh33ab1dJhghU3wBCH3+OnGywpx4Jvwvtk3sbfPXOz3i8T3pU1w6Ya/TLo4992 UswDqqnhBNModqQqrJV2rmfbq1HTNIBs3M0UG9yOX346eRtAci7CW+pt0KxoKkLRJZOrL2twuuT PwYYc3vF2GA1lKc1YlIgxddlppqlQHDOHLwV0TZ0S32xirFG642gx8EDH3XtKV81VmKA/HJkYED mBjzFdqUlJWKLwK1wYxnPgmpU6P3hRwis5Qysj4TF+yqNJ2taKReVPVYkIMPnJD+hbqsb+3n3cf P X-Received: by 2002:adf:bbce:: with SMTP id z14-v6mr1301576wrg.183.1526484878889; Wed, 16 May 2018 08:34:38 -0700 (PDT) X-Received: by 2002:adf:bbce:: with SMTP id z14-v6mr1301548wrg.183.1526484878156; Wed, 16 May 2018 08:34:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526484878; cv=none; d=google.com; s=arc-20160816; b=iwabgjf4PXvF6Qj1ZdJZBtIQWTkc4ulP//rMegHqtNhAvOWaY20z76IhxMdmPea2UL 961H+z0Kcl1AtTMV97UnIrImE5jRnZ64TUKVo/3LtfY+vZ/By6tndbnOpi4yXp6sFCN7 I9IWYoW+3fGCMM3872dp9ZlFwB6swQHqUE7htb7vRO2pcayk3gl+bHFTEK/ozOeD81vM VSqm+iP2VOj4jLETsji6dEb+sWzkNQd0M87gaBWben3YgnE6RZKULxbEOJVoAieidYXw 2Jd2o1LMENeFfhcEybKFoX9DXdjCN5o/XWQ9vIuZewOPMkRVO9DsUrgKjVYstGO8Z84U eBcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=8pa/d6KslmQ9EJPFpJmfQ4Q+lfwORP/zfrtpj0cb2aY=; b=yKMaPw/XnIYxMH58IcKetzsEXje8ldn96XmEOuoSnk5a1XuFNuoAAMBJMYnRljy84j c1dLELlhi0esE/qyVCxNuMVZi9F369u9FzUr+o0oTfBB5mTT2+wSf+YemOEjRESF04rZ oS2lapCmsp/Tk9FwYkLXKH4LOrWzS3yfR93OE2f28qwxsCz09zWOEQEEYpwvv4zdCJXd RYse7nIHh66qmzEVAtaQtutMC2OgfsmqqiX5JC5zEDbLxAvKZi9Vr1hW0UV7uNoUVCXo 1XfvEi9z7fE6GcWewdOWXYRZ/vCzrjLqi1w0PQtCprLnsepfjjKGCybu0rIYzZcaDNHl uSZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=DiGWR61x; spf=pass (google.com: domain of glider@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=glider@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id h10-v6sor1418898wrf.61.2018.05.16.08.34.37 for (Google Transport Security); Wed, 16 May 2018 08:34:38 -0700 (PDT) Received-SPF: pass (google.com: domain of glider@google.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=DiGWR61x; spf=pass (google.com: domain of glider@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=glider@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=8pa/d6KslmQ9EJPFpJmfQ4Q+lfwORP/zfrtpj0cb2aY=; b=DiGWR61x2IwuSO+5GtgLj3lDmYOOQzTESMAu0V1eKyzOXPud5zuS92fjSk75QGgJWN aXg+kY/X7LA7kuL2zST+83hj+w1YrBZTmCUhAU+o0xaVBrDNBhQUcoF2M1fEUHEeu/sh HNLwr9Kpl85+1Elvc21MFuc98BLbwfTXwvnb2+8MuFrAtf/ec4viW41wpqL/crnOgrXy UCdFHNGx11VnADyeR5hgogrIeqJDCb5Btxtd5LeNj6GmcH58fpk9rRmVuVs1s5lrQb7t 06oxRp/mXwRb6id1uknN7Tgx37gQHIQ2oOH5bo7CKkhZCvrRicTIw+bM6urtvGQk+p2l nDFg== X-Google-Smtp-Source: AB8JxZp7Ikt5iNXjRZkPWg7z+KvQnaOael131pnxZmu3WMd7Gl10A5s+vFaoknXYXWXWMF9IBvGbFw== X-Received: by 2002:adf:9e49:: with SMTP id v9-v6mr1341947wre.210.1526484877334; Wed, 16 May 2018 08:34:37 -0700 (PDT) Received: from glider0.muc.corp.google.com ([2a00:79e0:15:10:e0c7:92b9:c022:f69b]) by smtp.gmail.com with ESMTPSA id q194-v6sm5126855wmd.26.2018.05.16.08.34.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 May 2018 08:34:36 -0700 (PDT) From: Alexander Potapenko To: akpm@linux-foundation.org, dvyukov@google.com, aryabinin@virtuozzo.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] lib/stackdepot.c: use a non-instrumented version of memcpy() Date: Wed, 16 May 2018 17:34:34 +0200 Message-Id: <20180516153434.24479-1-glider@google.com> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog 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: X-Virus-Scanned: ClamAV using ClamSMTP stackdepot used to call memcpy(), which compiler tools normally instrument, therefore every lookup used to unnecessarily call instrumented code. This is somewhat ok in the case of KASAN, but under KMSAN a lot of time was spent in the instrumentation. (A similar change has been previously committed for memcmp()) Signed-off-by: Alexander Potapenko Cc: Andrey Ryabinin Cc: Dmitry Vyukov --- lib/stackdepot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/stackdepot.c b/lib/stackdepot.c index e513459a5601..d48c744fa750 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c @@ -140,7 +140,7 @@ static struct stack_record *depot_alloc_stack(unsigned long *entries, int size, stack->handle.slabindex = depot_index; stack->handle.offset = depot_offset >> STACK_ALLOC_ALIGN; stack->handle.valid = 1; - memcpy(stack->entries, entries, size * sizeof(unsigned long)); + __memcpy(stack->entries, entries, size * sizeof(unsigned long)); depot_offset += required_size; return stack;