Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp640045pxk; Fri, 11 Sep 2020 17:12:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtsIxo5ozI87L3gyCNYekPs7R6W8Na9eobftg+N0XHZy+/QFXvP88Lbxf3gcXRmClHblYB X-Received: by 2002:a17:906:fa8a:: with SMTP id lt10mr4229104ejb.307.1599869559480; Fri, 11 Sep 2020 17:12:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599869559; cv=none; d=google.com; s=arc-20160816; b=wxu2pCxrjA9wRWB4QZAf9mvFiv35sG/1i5Pm33YW4geAyDYWhko2Od621m5uDtQq2h +eL+h4bOzCWvJr15ybBeQiFVes/n2OAJeKbDMx7JL+2jHmqyNzp1FmabvtNk/zT9sqxc sQ1TAuxDJ3R6nHWB7pCJmsbhGSG7l2v2roDhb8piU9SxUeejfaiJPtyy48qvI8Bz3url C2KChbdo6qCuavyXwND11DrmGYF+UPYQ1nci2J7sAurTrSMCSv91IJfnnjsiiViOIZQj YfkB7ywAlRPNxkHUJ1DiJAVp9WZAs1a8HPIC+NH4QBVrrTGDwPvNODW9AxalquRdLd+q XePQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ptEAU1Xnng1x4phMWyVZ560k80eHq758Hzhoynkaycc=; b=JIlCbyzPbM/1+zREYwgnH3d1mgaxg+ONJ0IOxTXlT/ksRGOPY7v2WZcgpgT0tX4vcW 8baq1bk1kDt2wjUtccavkEl0sK/6M5/eLdNjjB/bltdwxisjIHsms6ASQhP9sdj0hgEY aKzQVGbMNVyt0zP9JAgyHkMMhslQSorwwvF99AdZe/cRi5199k8kPvw595rY5QbDuh7Y CDZgVlc14nUBAFKCxqSDcPUDErU/SFcyTz11QpcMohZPnAlFST0cGgvthVqLQa2qBcyc oIpNeIOrAPS6TRrTdIPaxh2FzSHUf2SLlelfLVqbYfjgWHxPOxhS2xVW0CKFCEA8c0Z6 OoEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=X9GwGioE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 18si2807296edv.184.2020.09.11.17.11.59; Fri, 11 Sep 2020 17:12:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=X9GwGioE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725890AbgILALC (ORCPT + 99 others); Fri, 11 Sep 2020 20:11:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725864AbgILAK5 (ORCPT ); Fri, 11 Sep 2020 20:10:57 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F607C061573 for ; Fri, 11 Sep 2020 17:10:56 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id md22so3254172pjb.0 for ; Fri, 11 Sep 2020 17:10:56 -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=ptEAU1Xnng1x4phMWyVZ560k80eHq758Hzhoynkaycc=; b=X9GwGioE/sKlB0N60NGjN7QVepFxUFBUgG8XStPDYy6zg1BVuEqovR/eJ6oHvaTG/6 iaHvt0uhANQpifz3K87589CfbzpkWkab4jtrLcxwJ4YXZngIB4byQpCfgPUtJz6wcWio 6cE79xeS3xd/Wr+C5QTZg6Oc33JTJ4EaRmDWk= 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=ptEAU1Xnng1x4phMWyVZ560k80eHq758Hzhoynkaycc=; b=JhnC0A/YrA5pDH5Z1Fo2QlmOF13tNWrr5c5+H1xSClri8kgTzr1Y3iMUYQrmchVDy+ OzGy0kJgYdlhaDXX8c4V1PhFB0u1KIdUTGff+LYJ6UJENzxObQi/wGXrbHfdt0B3Njpk VWAN5Zz0+z5pzg6oVPox4oMaJpmBSeCBqtWR5/8X/d7XWRj+0UVIoFCMgmBGreP6Dind bWNcUVFwTjzPhSc8zGziwi5M++PlmAGzBbQMg+xSECWcOPmu7m07vtjCi62Aw0nGeQ2W GP0+EDhjklGOZmlgPICf8qJzaHIOocWt/qGYa5gIggRSWIoH6ZuUp6AW5BYK6l/GV5Fw CCZQ== X-Gm-Message-State: AOAM530jh7YDFo+4sLkoQS8Ar/k4J5CUVKtraPMXVi+yvhtTj/6k8P1y +xrau+OF2dNT0abGzS2IeRYG8g== X-Received: by 2002:a17:90a:46cd:: with SMTP id x13mr4417827pjg.101.1599869454586; Fri, 11 Sep 2020 17:10:54 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id b15sm3155923pft.84.2020.09.11.17.10.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2020 17:10:53 -0700 (PDT) Date: Fri, 11 Sep 2020 17:10:52 -0700 From: Kees Cook To: Michael Ellerman Cc: Thomas Gleixner , Robert O'Callahan , LKML , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , linux-arch@vger.kernel.org, Will Deacon , Arnd Bergmann , Mark Rutland , Keno Fischer , Paolo Bonzini , kvm list , Gabriel Krisman Bertazi , Sean Christopherson , Kyle Huey Subject: Re: [REGRESSION] x86/entry: Tracer no longer has opportunity to change the syscall number at entry via orig_ax Message-ID: <202009111609.61E7875B3@keescook> References: <87blj6ifo8.fsf@nanos.tec.linutronix.de> <87a6xzrr89.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87a6xzrr89.fsf@mpe.ellerman.id.au> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 09, 2020 at 11:53:42PM +1000, Michael Ellerman wrote: > I can observe the difference between v5.8 and mainline, using the > raw_syscall trace event and running the seccomp_bpf selftest which turns > a getpid (39) into a getppid (110). > > With v5.8 we see getppid on entry and exit: > > seccomp_bpf-1307 [000] .... 22974.874393: sys_enter: NR 110 (7ffff22c46e0, 40a350, 4, fffffffffffff7ab, 7fa6ee0d4010, 0) > seccomp_bpf-1307 [000] .N.. 22974.874401: sys_exit: NR 110 = 1304 > > Whereas on mainline we see an enter for getpid and an exit for getppid: > > seccomp_bpf-1030 [000] .... 21.806766: sys_enter: NR 39 (7ffe2f6d1ad0, 40a350, 7ffe2f6d1ad0, 0, 0, 407299) > seccomp_bpf-1030 [000] .... 21.806767: sys_exit: NR 110 = 1027 For my own notes, this is how I reproduced it: # ./perf-$VER record -e raw_syscalls:sys_enter -e raw_syscalls:sys_exit & # ./seccomp_bpf # fg ctrl-c # ./perf-$VER script | grep seccomp_bpf | awk '{print $7}' | sort | uniq -c > $VER.log *repeat* # diff -u old.log new.log ... (Is there an easier way to get those results?) I will go see if I can figure out the best way to correct this. -- Kees Cook