From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B17E9C433E3 for ; Thu, 16 Jul 2020 20:55:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8821D20578 for ; Thu, 16 Jul 2020 20:55:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="BUv2M4VR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726221AbgGPUzP (ORCPT ); Thu, 16 Jul 2020 16:55:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbgGPUzO (ORCPT ); Thu, 16 Jul 2020 16:55:14 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ECC8C08C5CE for ; Thu, 16 Jul 2020 13:55:13 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id n5so5459695pgf.7 for ; Thu, 16 Jul 2020 13:55:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=5MTI6j+IP80rlb/aM1c91JmfYfE5Osj9CRG4Mb8h3u8=; b=BUv2M4VRSD2wen45IsSL7yNTJnozpg/gwPGZodjItCPRDJfb7N4bKQjiX7XixbYm8P cIsboo5bKpOkxk3XtZVey2uiuX1eRBu5WIt92S/1k6oMZppoMS2xjZ2lYtLeFnGf5F42 4VmBFpQ2GAs4br3hw2RsfpoSwHxlXKla8vxwM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=5MTI6j+IP80rlb/aM1c91JmfYfE5Osj9CRG4Mb8h3u8=; b=fEFR+pUFKoQ9bwXLzjk3oURITsUOvc7z+Gtz7EiVUsgbSRImUuk2QsL8ZGtq2HthVN trOF5jMx6nEtO+SVHlnzWdRUifp1fy9ZYrxdRrYryPfRA/oq3gSUaVg3nBMZ6mhrnuHS xNNC2KnVRcIq2ZGGVXjYUshvC4NDKhzoEXiOfWPNSMW/2kcTLKp00gUOsLZeWZ89EPlt orGlmfXkrkDkSIPwMvuQjkxCs8IpDiPDTIMlqhjFWxCs8GbVAcEAuGOuR1bmmd66oyHr HTAw36LnsvfD2m+qBqxcSj0VW6qLREXvGg2AbrvNnhzptMVJQIV3Igmx4LhsHejnTUit ouzg== X-Gm-Message-State: AOAM532FU+iLAgzfoHO6yzWuQe0PseryISyzsR/7PCUxPGsH3o4C0IbT FGdpoyhQiOnIoCizZNruBMC+7quOCH8= X-Google-Smtp-Source: ABdhPJwAy3pY3PKmw7KMXldIFkljrR5dKIYZZ376c+NTl4R4CSIRSOXzPuSZuhNstL3QzpzBisSHrA== X-Received: by 2002:a63:3ec4:: with SMTP id l187mr5653642pga.371.1594932913054; Thu, 16 Jul 2020 13:55:13 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id f15sm5823160pgr.36.2020.07.16.13.55.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 13:55:12 -0700 (PDT) Date: Thu, 16 Jul 2020 13:55:11 -0700 From: Kees Cook To: Thomas Gleixner Cc: LKML , x86@kernel.org, linux-arch@vger.kernel.org, Will Deacon , Arnd Bergmann , Mark Rutland , Keno Fischer , Paolo Bonzini , kvm@vger.kernel.org Subject: Re: [patch V3 02/13] entry: Provide generic syscall exit function Message-ID: <202007161354.62030182F@keescook> References: <20200716182208.180916541@linutronix.de> <20200716185424.116500611@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200716185424.116500611@linutronix.de> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Thu, Jul 16, 2020 at 08:22:10PM +0200, Thomas Gleixner wrote: > From: Thomas Gleixner > > Like syscall entry all architectures have similar and pointlessly different > code to handle pending work before returning from a syscall to user space. > > 1) One-time syscall exit work: > - rseq syscall exit > - audit > - syscall tracing > - tracehook (single stepping) > > 2) Preparatory work > - Exit to user mode loop (common TIF handling). > - Architecture specific one time work arch_exit_to_user_mode_prepare() > - Address limit and lockdep checks > > 3) Final transition (lockdep, tracing, context tracking, RCU). Invokes > arch_exit_to_user_mode() to handle e.g. speculation mitigations > > Provide a generic version based on the x86 code which has all the RCU and > instrumentation protections right. > > Provide a variant for interrupt return to user mode as well which shares > the above #2 and #3 work items. > > After syscall_exit_to_user_mode() and irqentry_exit_to_user_mode() the > architecture code just has to return to user space. The code after > returning from these functions must not be instrumented. > > Signed-off-by: Thomas Gleixner This looks correct to me. Did you happen to run the seccomp selftests under this series? Reviewed-by: Kees Cook -- Kees Cook