Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5935638ybi; Wed, 12 Jun 2019 11:00:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxapV2G3H0idCZYYbPKFITWVGrNFQM65vCyufijC7m0mgcvSAKtAvN/O+PvUctWuaw5rktv X-Received: by 2002:a62:2d3:: with SMTP id 202mr13324877pfc.131.1560362422386; Wed, 12 Jun 2019 11:00:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560362422; cv=none; d=google.com; s=arc-20160816; b=mFeN7S2yRRNPXYcFawNMY2PT1HyDR4Q+Yk20rZ11x9OgUSKSp+/kXMR+HMoR9w0jo+ u0xB46nWtuGRFmXPfpS2O84/gAQA9WqGxwk3aOUiU+C9ASLaR9b6eJGppZK4trm9J2Z8 EYRllMGd10lXliTKBXwW/WQfBIt1CrZUW4VnzyZ4OWa9u+cJj7s/kc0REK18wUeJo/Fo C1hLT0jCbeAX1OMy7UDieQ/ahPsMW3C6bPNIEVpXSyPhFMN9APwPTV0Hb7kV6PUr7CH2 e7vbtf5n9KKBruqGMpGzZR0o0w4Rp94tUh8QGu3pkPsBy6cX9G0XsnEOJxsNUS6Mb/8n pXdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=/fXeSKZUU3yYcblyjjUr+PT/LFbKmVa2WZrUUbFVZZ0=; b=uBWLSVKlxHdcs0TTUs97I8Rm0oXQA+wG8arOgG1GfH+Ojl4CoVFYYJ7zcWea5KZ62+ 3k1Xovk3ER3jtl+c+flEVCi9UTx4t088FuYGp0cGmt/T0vChtsmYRdgaO8NfdLva+LqF WREzA1FvVcxxuaTdwoTUnqt9IzZL7QRVJWG/2Xeyzv9GllwuyJlttuIDZkBCn9fR7DhX dne1Ij+Z28kqYFfqEhuplCLTOoPHLzO7ULgPyJ/DII001FCmg/sUmAqjDGrNWlGzjN++ Bb23bjVYvduZyxixB+7eDAPxxtNrAv7a+oo0fbxAWisRLh5T/NbxliaR+hE/TsTQqz47 1qyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RqyGGNem; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 21si406562pgy.283.2019.06.12.11.00.06; Wed, 12 Jun 2019 11:00:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RqyGGNem; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730940AbfFLOMz (ORCPT + 99 others); Wed, 12 Jun 2019 10:12:55 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:46890 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730343AbfFLOMy (ORCPT ); Wed, 12 Jun 2019 10:12:54 -0400 Received: by mail-io1-f67.google.com with SMTP id i10so13034847iol.13 for ; Wed, 12 Jun 2019 07:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/fXeSKZUU3yYcblyjjUr+PT/LFbKmVa2WZrUUbFVZZ0=; b=RqyGGNemS8/TLIB5Dxl8WKbnhdoc9LMeuNFDMIXpzQjCM/HDctfvLF5YywpxKCA/Ig 7yPInDXKSM+OBgqGqsVrQpGGSMEQJnBZzRWTeXWniVKBg7SCoM2gvK6O3d0P8Rg8Knn+ 7kPR7R8/O8zpOPULyC4Ksbu0LYVjAmgEBBVgfE++N7YLTYojHXFhqZ0vW6rhH6pMWPEh znEfqS3UxP9YqmjVyDU0ZSD9qVP5VjHuDoMiJyK4TV0iN4rGvAIFGHXw8tdLPBeeAWW2 UoTRDFKFZJo64q4YbPRkTQD0aMhiZQZ2yxkHKkLHVCVoyrmFLNaqdcqQ0dSaWHA8CBfu d5uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/fXeSKZUU3yYcblyjjUr+PT/LFbKmVa2WZrUUbFVZZ0=; b=NJxg6U+lAMvliauM7M2hwaVHA9bjQKf54EOZ0+IImcf/P6UUzrb5VFZd1k4Kl7l8Ae a3MBnKQdI0Jabd7oWmxqL2BF9L76zKRPE4Kt6xGNIoLHzF52RhqN7Q1woaj47l1scA7e tn1DjNvkgcgJRod6wsR5+SLBrhl0Az09vLVcVtw1mCTSpZDcqI5i6FGPCvmy+XLSDfSV 6cxc92JitZr9XgtFdhUCWiE8P806glrL1/TkIFq44z8dlrmLF2TiWjxAIQP13gh+Evxl cJQHk2vGShfJMZIcGccTFf/MyL2askNLsNAsgOBs6UoA56bAyonKcDyxdFNAwApNGtTU /gCg== X-Gm-Message-State: APjAAAW61JlssORPbjfhglwwSKfnL6eLmjGEI7mj7h6EXhK3WW+Q7t5b TM1BSAO/kbYX+DBnem/UZaZgF7/kLg/yFaEBPKOlKg== X-Received: by 2002:a6b:641a:: with SMTP id t26mr7794304iog.3.1560348773474; Wed, 12 Jun 2019 07:12:53 -0700 (PDT) MIME-Version: 1.0 References: <20190531150828.157832-1-elver@google.com> <20190531150828.157832-3-elver@google.com> In-Reply-To: From: Dmitry Vyukov Date: Wed, 12 Jun 2019 16:12:29 +0200 Message-ID: Subject: Re: [PATCH v3 2/3] x86: Use static_cpu_has in uaccess region to avoid instrumentation To: Marco Elver Cc: Peter Zijlstra , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Mark Rutland , "H. Peter Anvin" , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "the arch/x86 maintainers" , Arnd Bergmann , Josh Poimboeuf , "open list:DOCUMENTATION" , LKML , linux-arch , kasan-dev Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 7, 2019 at 11:44 AM Marco Elver wrote: > > Gentle ping. I would appreciate quick feedback if this approach is reasonable. > > Peter: since you suggested that we should not change objtool, did you > have a particular approach in mind that is maybe different from v2 and > v3? Or is this what you were thinking of? > > Many thanks! > > On Fri, 31 May 2019 at 17:11, Marco Elver wrote: > > > > This patch is a pre-requisite for enabling KASAN bitops instrumentation; > > using static_cpu_has instead of boot_cpu_has avoids instrumentation of > > test_bit inside the uaccess region. With instrumentation, the KASAN > > check would otherwise be flagged by objtool. > > > > For consistency, kernel/signal.c was changed to mirror this change, > > however, is never instrumented with KASAN (currently unsupported under > > x86 32bit). > > > > Signed-off-by: Marco Elver > > Suggested-by: H. Peter Anvin > > --- > > Changes in v3: > > * Use static_cpu_has instead of moving boot_cpu_has outside uaccess > > region. > > > > Changes in v2: > > * Replaces patch: 'tools/objtool: add kasan_check_* to uaccess > > whitelist' > > --- > > arch/x86/ia32/ia32_signal.c | 2 +- > > arch/x86/kernel/signal.c | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c > > index 629d1ee05599..1cee10091b9f 100644 > > --- a/arch/x86/ia32/ia32_signal.c > > +++ b/arch/x86/ia32/ia32_signal.c > > @@ -358,7 +358,7 @@ int ia32_setup_rt_frame(int sig, struct ksignal *ksig, > > put_user_ex(ptr_to_compat(&frame->uc), &frame->puc); > > > > /* Create the ucontext. */ > > - if (boot_cpu_has(X86_FEATURE_XSAVE)) > > + if (static_cpu_has(X86_FEATURE_XSAVE)) Peter Z or A, does it look good to you? Could you please Ack this? > > put_user_ex(UC_FP_XSTATE, &frame->uc.uc_flags); > > else > > put_user_ex(0, &frame->uc.uc_flags); > > diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c > > index 364813cea647..52eb1d551aed 100644 > > --- a/arch/x86/kernel/signal.c > > +++ b/arch/x86/kernel/signal.c > > @@ -391,7 +391,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, > > put_user_ex(&frame->uc, &frame->puc); > > > > /* Create the ucontext. */ > > - if (boot_cpu_has(X86_FEATURE_XSAVE)) > > + if (static_cpu_has(X86_FEATURE_XSAVE)) > > put_user_ex(UC_FP_XSTATE, &frame->uc.uc_flags); > > else > > put_user_ex(0, &frame->uc.uc_flags); > > -- > > 2.22.0.rc1.257.g3120a18244-goog > >