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 55D54C433DF for ; Thu, 16 Jul 2020 20:55:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2945320656 for ; Thu, 16 Jul 2020 20:55:17 +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 S1726296AbgGPUzQ (ORCPT ); Thu, 16 Jul 2020 16:55:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725926AbgGPUzO (ORCPT ); Thu, 16 Jul 2020 16:55:14 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8433DC061755 for ; Thu, 16 Jul 2020 13:55:13 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id d4so5458385pgk.4 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=nLgwnqBhodv9E50mCWFkpKDshze1mBspM6zGOH4VZKHl1eyJDi+25JsJhzh0V847bE yn253d9o5wd22/qpcB1J6LXqKxZc42RbMVpk+PNG32dF921ay7E75dNUlHFjraCBsG+z voCypisDO6le0z3M0n27j/ejFyx2CL3+tbqnlPSGUSspwfcHx1iyfaxcvP22rUa6hedU jY7G7ISDR2gtKue9KHniXnxuAkgElzkQBTgxwrVvEOZW6c4suXRTpg30rXGoytyRJP7e r55FHTfL1PQVSY8JoDcV3a3yXB2yj0lVhD45AsWe98e8PJ76sq9eNYLrdW/NDI5Cc4KI 9vUw== X-Gm-Message-State: AOAM5314v6+yDjo3I+vZgsNRywbZQJbS4W+B1NSRxb7mjQAPPkMWtAPB HIPCOtRYb5ZdCrk57IpjUCbOLw== 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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