Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3780754ybi; Tue, 18 Jun 2019 06:28:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwotRqqFmSUOo8k90A2ARXSg0QHmtLITEkKSn4vyEuc8NNst6qOEdjHyV0ZmUnmmhzB4JnI X-Received: by 2002:a17:902:8d95:: with SMTP id v21mr92145452plo.225.1560864483131; Tue, 18 Jun 2019 06:28:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560864483; cv=none; d=google.com; s=arc-20160816; b=kvxjuRMXQR9zfPH2eNIR7HeJ6A2DDvRc4KsDVNxuvpJyzlmQAZ8fdg9YbbGHHt4C76 yihr0mlAS80qVbFiKf69zz1n8JgoTEWvAidlnVvM4mwI4FGYVx/MBON6BvDwbmks5h9/ hnRzVCWeODmVFl9/TJeXVJDP1YBl08/q606iDToVNl2FtDvrss2Se3B3UX5QGLCOV2VE ZNxcHSVhYLRWBKaDbqP/7gsQ5ZxzSCMzG/lTRrkd/P74pGMkcWP8K5N6eT3QHfWoyeiU sJEbVzhGwmBeIJ32HTigSy0CO+hMEOTThlfu2xoARy62KjpP636cvCWHwtWyyhZrkmbD BxOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=doEY3VVdL/2830Z3Ho2zRTWZ+7T+TAiqj+Z3LtvAz2k=; b=bzpoJAiJl4YthU0zXbcaht1RGumOZ/eZlJxvuC1aneGHnB+7eiZIGXO+Qsp1/Ygy+h svXayZMyAwXNe8/haByq8iA/QYB+Gh4ZMjL2Rykwgh6wOLwigY39oPwTq+RyACH3bEg3 p6UsqrSKeAVIsW+fIdXwdD3U85iiACp3IjNAZcCKnGAW727aQQT1sQ9AWlvw0XSXKZQM n9jNaRqNBiUm6eTTOAIsdUej6XJUeHFFKr2ZurjhsyLtlQmKjne7o/gnLXkdH1umrUBK TBzKn0LBwY3pXq+TbxMi/tC94EB1eZxoEikBRubw7LxtVEVWduSvLwzCafWIjy4d4y9l eWxQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 12si173424pgo.535.2019.06.18.06.27.45; Tue, 18 Jun 2019 06:28:03 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728572AbfFRN1l (ORCPT + 99 others); Tue, 18 Jun 2019 09:27:41 -0400 Received: from relay.sw.ru ([185.231.240.75]:49592 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725919AbfFRN1l (ORCPT ); Tue, 18 Jun 2019 09:27:41 -0400 Received: from [172.16.25.12] by relay.sw.ru with esmtp (Exim 4.92) (envelope-from ) id 1hdE98-0001lw-VL; Tue, 18 Jun 2019 16:27:35 +0300 Subject: Re: [PATCH] ubsan: mark ubsan_type_mismatch_common inline To: Arnd Bergmann , Peter Zijlstra Cc: Andrew Morton , Josh Poimboeuf , Linux Kernel Mailing List , "# 3.4.x" References: <20190617123109.667090-1-arnd@arndb.de> <20190617140210.GB3436@hirez.programming.kicks-ass.net> From: Andrey Ryabinin Message-ID: Date: Tue, 18 Jun 2019 16:27:45 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/18/19 3:56 PM, Arnd Bergmann wrote: > On Mon, Jun 17, 2019 at 4:02 PM Peter Zijlstra wrote: >> >> On Mon, Jun 17, 2019 at 02:31:09PM +0200, Arnd Bergmann wrote: >>> objtool points out a condition that it does not like: >>> >>> lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch()+0x4a: call to stackleak_track_stack() with UACCESS enabled >>> lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch_v1()+0x4a: call to stackleak_track_stack() with UACCESS enabled >>> >>> I guess this is related to the call ubsan_type_mismatch_common() >>> not being inline before it calls user_access_restore(), though >>> I don't fully understand why that is a problem. >> >> The rules are that when AC is set, one is not allowed to CALL schedule, >> because scheduling does not save/restore AC. Preemption, through the >> exceptions is fine, because the exceptions do save/restore AC. >> >> And while most functions do not appear to call into schedule, function >> trace ensures that every single call does in fact call into schedule. >> Therefore any CALL (with AC set) is invalid. > > I see that stackleak_track_stack is already marked 'notrace', > since we must ensure we don't recurse when calling into it from > any of the function trace logic. > > Does that mean we could just mark it as another safe call? > > --- a/tools/objtool/check.c > +++ b/tools/objtool/check.c > @@ -486,6 +486,7 @@ static const char *uaccess_safe_builtin[] = { > "__ubsan_handle_type_mismatch", > "__ubsan_handle_type_mismatch_v1", > /* misc */ > + "stackleak_track_stack", > "csum_partial_copy_generic", > "__memcpy_mcsafe", > "ftrace_likely_update", /* CONFIG_TRACE_BRANCH_PROFILING */ > > >> Maybe we should disable stackleak when building ubsan instead? We >> already disable stack-protector when building ubsan. > > I couldn't find out how that is done. > I guess this: ccflags-y += $(DISABLE_STACKLEAK_PLUGIN)