Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4263827ybb; Mon, 23 Mar 2020 17:15:21 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu4A4TUHMyhg8MVBOL829gsAHGKdQceUE1eMVcSkOSrhcxtmTCA72UJ/oHgPWdaNYkKBIMr X-Received: by 2002:aca:cdd1:: with SMTP id d200mr1432938oig.153.1585008921345; Mon, 23 Mar 2020 17:15:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585008921; cv=none; d=google.com; s=arc-20160816; b=tqieDb8xVtJ8aw4N/vVKYvQAdyy/VZTckXcWppSnRFvexleZO64PTPMqxe6ZUut7Gc IaHHJXKNvRv6lZxpnUELlhci8/MgECBSwhXAfyl/CwBFkwWq2lbwUqWhwf59RZ9FOmp/ so8mRGQ3uly6L/XuBBuilB7D2YBAVyS6ERxk+/aTumfUnvgydpXOnZWgzH/YQFRMKuNP 5kxEgXr1k+A3S9TO5oAy3q7pGHy5NnBYQ9pglr0MedsbH1jobNQ2H4Pwl+qhUdciDmfz bcirGo5aKjeS+2HbPTOGrdpvWL0w2pqSiLg6b8cnXVdY//5sVWDB+aCx3kqfB+qLF10t P7pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=5zop4gGexKIVuUBB/XuZx8+PSEnhloPSs1GUWTBRoug=; b=j/if5lfUB2hm26kT4ee1g7MVtMCqszJvq2FPZ/t06DqKzZZGHhZqx63hEhSv0Oq2wL xX0qyKtHrn3ODWBaDDSzZiR9w1pgKP+7E5eXQ8GbqIF01gAj3uIf0lE5TH1nICaXqSKD StZzT43bN+gX580fuqR0dmCaz7GnK+StxI/ouxj1PkZrLd4cOc8GQrgRy/Fn1RxWBFrM CDmKRRfj4jtphdwkMMMuym87RbYtnDog3hDpRZ1WYTf3jzypKaIPmyhGQk3pPl+rox5h KVdNhN9J6CItz6U6eeWzRc23kDnyeyDQGv1b28Lo808G9UgpWvjfddg9qblU+HLS6y0x wdfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Jf4pz+xx; 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 g22si8550262otn.291.2020.03.23.17.15.07; Mon, 23 Mar 2020 17:15:21 -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=Jf4pz+xx; 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 S1727452AbgCXANr (ORCPT + 99 others); Mon, 23 Mar 2020 20:13:47 -0400 Received: from mail-pg1-f202.google.com ([209.85.215.202]:43524 "EHLO mail-pg1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727421AbgCXANr (ORCPT ); Mon, 23 Mar 2020 20:13:47 -0400 Received: by mail-pg1-f202.google.com with SMTP id v11so12175220pgs.10 for ; Mon, 23 Mar 2020 17:13:45 -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=5zop4gGexKIVuUBB/XuZx8+PSEnhloPSs1GUWTBRoug=; b=Jf4pz+xxWi1KLV5c9bDhFE8MrJh2Z8f07O3zUs2S+qlfcK2qJtUoYANW2BzQQaoT8L IRTh8WIS1U0hVw30sN77abfdN2QIxNYkE46rMnTB6cmzUzo9eYxmipwUvo3NefssikD9 UZ8rxuOKe6gWEBeIoGWxhJWfPgHUO3d2wq6FIuMfyiZXiRQ/t6nvN6CNCAV1R+kL4mXo hjrhcL8mL0+D+GgO5Vp6RLcQ3RsArsOwwBbLbga8FNvMteKjYyH/Im+ruWp0X34xa3+X mGD0Nq1uEhXYgvEEumDLNHBlmF6NtGZGTZojYYNjsQIp0CbiPoQ6bYrnXbqrUi76vPH0 A9oQ== 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=5zop4gGexKIVuUBB/XuZx8+PSEnhloPSs1GUWTBRoug=; b=GMKLfQf2LriFBzUvWntLDcc7M+zriotDHuJAdbruK0XSDVe2mdFWVqjLqlhuFb9nY8 EO4bnS2IUgGMFyMV0PiuZ4qVwxoTeOWYDtQMeH+CAGWfOpxN9ZTzjh7cmCEKajcp81zL MqOgbRN14dsoLg1SLWAcoLsG2zYZrYK1eWGsERwuBvTxc0Uv58v0tY9SDDeMD7TuDap6 2d277t3mFkSXzy0XUuj+gG9zsECZxD9HmBAIArSTnPfFXrPIU/lslX52Czzh+rBp6ENM jeGuOmCaHpEPU4PXg9OdAUipJuYV/8YCgmsLsapMe7vjXA7RhUKgnyBqdycpuXn+Fd+L InHg== X-Gm-Message-State: ANhLgQ3HWzcUEGd9DXh/HlM9jyhOlcJXYPg8+WxvQ6R+lAXYXOsRCUMP 7XXmQReRtP7dXShPvGKRNHDwUCKkj2sSJWVYUdY= X-Received: by 2002:a63:c44b:: with SMTP id m11mr9425702pgg.313.1585008824657; Mon, 23 Mar 2020 17:13:44 -0700 (PDT) Date: Mon, 23 Mar 2020 17:13:20 -0700 In-Reply-To: <20200323212538.GN2452@worktop.programming.kicks-ass.net> Message-Id: <20200324001321.39562-1-ndesaulniers@google.com> Mime-Version: 1.0 References: <20200323212538.GN2452@worktop.programming.kicks-ass.net> X-Mailer: git-send-email 2.25.1.696.g5e7596f4ac-goog Subject: [PATCH] objtool: Documentation: document UACCESS warnings From: Nick Desaulniers To: jpoimboe@redhat.com, peterz@infradead.org Cc: Nick Desaulniers , Mauro Carvalho Chehab , Jonathan Corbet , Wolfram Sang , Kamalesh Babulal , Raphael Gault , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com 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 Compiling with Clang and CONFIG_KASAN=y was exposing a few warnings: call to memset() with UACCESS enabled Document how to fix these for future travelers. Link: https://github.com/ClangBuiltLinux/linux/issues/876 Suggested-by: Peter Zijlstra Signed-off-by: Nick Desaulniers --- .../Documentation/stack-validation.txt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/objtool/Documentation/stack-validation.txt b/tools/objtool/Documentation/stack-validation.txt index de094670050b..156fee13ba02 100644 --- a/tools/objtool/Documentation/stack-validation.txt +++ b/tools/objtool/Documentation/stack-validation.txt @@ -289,6 +289,26 @@ they mean, and suggestions for how to fix them. might be corrupt due to a gcc bug. For more details, see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70646 +9. file.o: warning: objtool: funcA() call to funcB() with UACCESS enabled + + This means that an unexpected call to a non-whitelisted function exists + outside of arch-specific guards. + X86: SMAP (stac/clac): __uaccess_begin()/__uaccess_end() + ARM: PAN: uaccess_enable()/uaccess_enable() + + These functions should called to denote a minimal critical section around + access to __user variables. See also: https://lwn.net/Articles/517475/ + + The intention of the warning is to prevent calls to funcB() from eventually + calling schedule(), potentially leaking the AC flags state, and not + restoring them correctly. + + To fix, either: + 1) add the correct guards before and after calls to low level functions like + __get_user_size()/__put_user_size(). + 2) add funcB to uaccess_safe_builtin whitelist in tools/objtool/check.c, if + funcB obviously does not call schedule(). + If the error doesn't seem to make sense, it could be a bug in objtool. Feel free to ask the objtool maintainer for help. -- 2.25.1.696.g5e7596f4ac-goog