From patchwork Fri Oct 18 09:42:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 11197993 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 60A5614ED for ; Fri, 18 Oct 2019 09:44:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 233AC20820 for ; Fri, 18 Oct 2019 09:44:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Ic4WoERO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 233AC20820 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 9B66E8E0029; Fri, 18 Oct 2019 05:43:56 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 93DFB8E0003; Fri, 18 Oct 2019 05:43:56 -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 80BDA8E0029; Fri, 18 Oct 2019 05:43:56 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0216.hostedemail.com [216.40.44.216]) by kanga.kvack.org (Postfix) with ESMTP id 4C01E8E0003 for ; Fri, 18 Oct 2019 05:43:56 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id DDDB482DF883 for ; Fri, 18 Oct 2019 09:43:55 +0000 (UTC) X-FDA: 76056418830.23.bulb25_79966a74cdf17 X-Spam-Summary: 2,0,0,aa52a0b0f57ec901,d41d8cd98f00b204,3wompxqykcacnspklynvvnsl.jvtspu14-ttr2hjr.vyn@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:2559:2562:3138:3139:3140:3141:3142:3152:3353:3865:3867:3868:3870:3874:4250:4321:5007:6120:6261:6653:7901:9969:10004:10400:11026:11232:11473:11657:11658:11914:12043:12114:12296:12297:12438:12555:12895:12986:13069:13255:13311:13357:13846:14181:14394:14659:14721:21080:21365:21444:21451:21627:30054:30064:30070,0,RBL:209.85.222.73:@flex--glider.bounces.google.com:.lbl8.mailshell.net-62.18.0.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:26,LUA_SUMMARY:none X-HE-Tag: bulb25_79966a74cdf17 X-Filterd-Recvd-Size: 4304 Received: from mail-ua1-f73.google.com (mail-ua1-f73.google.com [209.85.222.73]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Oct 2019 09:43:55 +0000 (UTC) Received: by mail-ua1-f73.google.com with SMTP id i7so694581uak.7 for ; Fri, 18 Oct 2019 02:43:55 -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=n3tegVRp4MiUZ3IxpD/O7xdpLdlNBdCMHTjiqcPBuqc=; b=Ic4WoERO5kGMVe/BlgNsGosgqqkC3W8qXq0Og5oZ3pMOaVXBowh3AAkb6vhdVmIuR9 FDWKuV03TO8SdvFELIcvm4YNsdQgvqO8UcaWh+uahcVWX/bwkmwyccGerruYEiomF7Iw 0diCrwl1Qd/MBUc/T/luYHsMnsz4wpndjQgZX1wWQKoOPnaJgbbNnHyWwwQTEgOlD+Jx x8jAbVcaJLj97y+364Gly124W0HwNiGA79RrssgY9pq8rEsLnQpZ+Xn027aqekFGwxjQ R3UuDV2KlPdWuDr0rPjfs5TTspgz+gZA+zLSSEst/J2L0/ur0y2vNgCwc4wW/XSw/Ena oesg== 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=n3tegVRp4MiUZ3IxpD/O7xdpLdlNBdCMHTjiqcPBuqc=; b=aCDabWdZML1bRm+7eFmbf481IxGorjiY/Lmt+AmUa8aLlJcZkaBbtwuEGQlBwcMWWt DcU1mY3lh7CMAMx33tcEjuiX3b27/WVQX6X2AnOBve6qllA2BnyjmfbGc9zQNAcHOGLV h/M0wTJ9yYCxAVohftk3jhUPZpAbZbJW9n5eomdBxf+ZkOlOrlHr8RaA2xODPXRX6+ab tmguYHZyL29Im2kmso02thz3yHnF0FTnLcgvC1/5A0G4JVlxwYt02vK+W2kzPqvYtbpR pPW0sMQJBoHBGWW5xGSPSEVEC8t3bu15OxsX05emj24SqhLKsJVXAn8qmKRNNti6J2mR HLEA== X-Gm-Message-State: APjAAAWH+HxmnAiY/iBmDP5BAmXgi3Zi8bDXU6zAJrbvoE3unyHvFkQV exq++XtFwbgUvQCjv1A/AzfSKmK9USM= X-Google-Smtp-Source: APXvYqw181HlPSre4wn2wQWTT7FG+8QFUj2gKPyK+zT5YySCW4Wg5lPxRT3H2cAVsnsVU7Ay6uHMBCx+g9Q= X-Received: by 2002:a67:8841:: with SMTP id k62mr5006513vsd.101.1571391834605; Fri, 18 Oct 2019 02:43:54 -0700 (PDT) Date: Fri, 18 Oct 2019 11:42:52 +0200 In-Reply-To: <20191018094304.37056-1-glider@google.com> Message-Id: <20191018094304.37056-15-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 14/26] kmsan: make READ_ONCE_TASK_STACK() return initialized values From: glider@google.com To: Alexander Potapenko Cc: Vegard Nossum , Dmitry Vyukov , linux-mm@kvack.org 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: To avoid false positives, assume that reading from the task stack always produces initialized values. Signed-off-by: Alexander Potapenko To: Alexander Potapenko Cc: Vegard Nossum Cc: Dmitry Vyukov Cc: linux-mm@kvack.org --- Change-Id: Ie73e5a41fdc8195699928e65f5cbe0d3d3c9e2fa --- arch/x86/include/asm/unwind.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/unwind.h b/arch/x86/include/asm/unwind.h index 499578f7e6d7..f60c2bd1ddf2 100644 --- a/arch/x86/include/asm/unwind.h +++ b/arch/x86/include/asm/unwind.h @@ -100,9 +100,10 @@ void unwind_module_init(struct module *mod, void *orc_ip, size_t orc_ip_size, #endif /* - * This disables KASAN checking when reading a value from another task's stack, - * since the other task could be running on another CPU and could have poisoned - * the stack in the meantime. + * This disables KASAN/KMSAN checking when reading a value from another task's + * stack, since the other task could be running on another CPU and could have + * poisoned the stack in the meantime. Frame pointers are uninitialized by + * default, so for KMSAN we mark the return value initialized unconditionally. */ #define READ_ONCE_TASK_STACK(task, x) \ ({ \ @@ -111,7 +112,7 @@ void unwind_module_init(struct module *mod, void *orc_ip, size_t orc_ip_size, val = READ_ONCE(x); \ else \ val = READ_ONCE_NOCHECK(x); \ - val; \ + KMSAN_INIT_VALUE(val); \ }) static inline bool task_on_another_cpu(struct task_struct *task)