Message ID | 20191018094304.37056-3-glider@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=Fj1U=YL=kvack.org=owner-linux-mm@kernel.org> 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 0428713B1 for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 18 Oct 2019 09:43:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C547120820 for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 18 Oct 2019 09:43:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Gjvxkoo5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C547120820 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 A9FFE8E001D; Fri, 18 Oct 2019 05:43:21 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A50638E0003; Fri, 18 Oct 2019 05:43:21 -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 940678E001D; Fri, 18 Oct 2019 05:43:21 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0185.hostedemail.com [216.40.44.185]) by kanga.kvack.org (Postfix) with ESMTP id 745038E0003 for <linux-mm@kvack.org>; Fri, 18 Oct 2019 05:43:21 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 1A4868120 for <linux-mm@kvack.org>; Fri, 18 Oct 2019 09:43:21 +0000 (UTC) X-FDA: 76056417402.02.plot79_748340a29c42a X-Spam-Summary: 2,0,0,16eef29cc3a1ffdd,d41d8cd98f00b204,3n4mpxqykcoikpmhivksskpi.gsqpmryb-qqozego.svk@flex--glider.bounces.google.com,:glider@google.com:vegard.nossum@oracle.com:dvyukov@google.com:,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1277:1313:1314:1345:1359:1437:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:3138:3139:3140:3141:3142:3152:3352:3867:3871:4321:5007:6120:6261:6653:7901:8660:9969:10004:10400:11232:11658:11914:12043:12297:12438:12555:12895:12986:13069:13148:13230:13255:13311:13357:13846:14096:14097:14181:14394:14659:14721:21080:21365:21444:21451:21627:30054:30064:30090,0,RBL:209.85.221.74:@flex--glider.bounces.google.com:.lbl8.mailshell.net-62.18.175.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: plot79_748340a29c42a X-Filterd-Recvd-Size: 3622 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) by imf06.hostedemail.com (Postfix) with ESMTP for <linux-mm@kvack.org>; Fri, 18 Oct 2019 09:43:20 +0000 (UTC) Received: by mail-wr1-f74.google.com with SMTP id j7so2361948wrx.14 for <linux-mm@kvack.org>; Fri, 18 Oct 2019 02:43:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=b4sChJXo02GMyut/YFGQ6mxS+lMlTs8aNndVBMC32OI=; b=Gjvxkoo59MdlloiTM6XPIn3mnv04l/FqNhlHZ8i4inrEDMkNRxx4yuh043zxFxE8Yl 9a6K49Gz7+hg33BzipaYe5ttRLaZaqJcJ2/76tRKLa/Hd6rwCq3AqsGmrCtW3Rpvxae/ FZffIDvDgHSrnLv6DrNdwIHSLR7gCsapoU7jUplcY6T/cSRtaNMYIILsl3m0GfPWhlrB 5J6PIS7CNp4/kl63dRqJ5icb37Rn6mrckoHBkcybNTqKs6xBbDJezc1a6O1xWEkT1Zha ZKzDh0oZlZYOlBoNki5tbquoZC+LpA72rTeGFAJsqkzaCOrZ0XbeaFFXlIh+IleSqGAy uWlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=b4sChJXo02GMyut/YFGQ6mxS+lMlTs8aNndVBMC32OI=; b=ieSx/d8tB95d3z1l3FdSAcjtH/mnWAGSLGgOemV9Dw7EySQWmmMRmC8QjFYhdAObIW tgFvywtXwE4m9vUVRqeci4LVHWflmjECRelV3wWpeftDIkbliIM2A7KNI5bmtEGHMw6P pu2Lt6/Bs57fYKHcPXk8NRW9M5pDV/hD0R2ScIiJQq6H6N7K1ym2+9RIuvg96rqPG4wP RDAQcBed6pjhAT6tu26vgLVX8jMqZDT6LN3QZkhpT2UqZyNKArUWwzQ7nztCGGEeQ7Ga TwEm9N7ao+yfUU+gRvFAji4J240dgO44exQVQ9Mo6xTeLKIy/cP1YBQZDNIV3NFYwTPV ni1A== X-Gm-Message-State: APjAAAWcc0owUe8jXSeSYix0mT4AAGsOWbmv+tOXkzpE052Lr0dJhtr/ she2+oskhm5Fc5J8nvlI3zC5q4IbxN0= X-Google-Smtp-Source: APXvYqwfuIm6Jky5B+mMFheFgCgSu6sIwMNikNBnQmcmJmk7kz449WuoYJk9wyi5g1p3huyFvshmB+Rk/Po= X-Received: by 2002:a5d:6785:: with SMTP id v5mr4178057wru.174.1571391799447; Fri, 18 Oct 2019 02:43:19 -0700 (PDT) Date: Fri, 18 Oct 2019 11:42:40 +0200 In-Reply-To: <20191018094304.37056-1-glider@google.com> Message-Id: <20191018094304.37056-3-glider@google.com> Mime-Version: 1.0 References: <20191018094304.37056-1-glider@google.com> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog Subject: [PATCH RFC v1 02/26] stackdepot: prevent Clang from optimizing away stackdepot_memcmp() From: glider@google.com To: Alexander Potapenko <glider@google.com> Cc: Vegard Nossum <vegard.nossum@oracle.com>, Dmitry Vyukov <dvyukov@google.com>, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" 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: <linux-mm.kvack.org> |
Series |
Add KernelMemorySanitizer infrastructure
|
expand
|
diff --git a/lib/stackdepot.c b/lib/stackdepot.c index 0d00d2ac0c4b..785839298e08 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c @@ -163,6 +163,11 @@ int stackdepot_memcmp(const unsigned long *u1, const unsigned long *u2, unsigned int n) { for ( ; n-- ; u1++, u2++) { + /* + * Prevent Clang from replacing this function with a bcmp() + * call. + */ + barrier(); if (*u1 != *u2) return 1; }
Clang may replace stackdepot_memcmp() with a call to instrumented bcmp(), which is exactly what we wanted to avoid creating stackdepot_memcmp(). Add a compiler barrier() to prevent optimizations. Signed-off-by: Alexander Potapenko <glider@google.com> To: Alexander Potapenko <glider@google.com> Cc: Vegard Nossum <vegard.nossum@oracle.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: linux-mm@kvack.org --- Change-Id: I4495b617b15c0ab003a61c1f0d54d0026fa8b144 --- lib/stackdepot.c | 5 +++++ 1 file changed, 5 insertions(+)