Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1529334pxa; Thu, 20 Aug 2020 13:46:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkiy8qHPjeVWxQS0UWJ3EYkEOWachvivOaWHH+LEUUARrzAF3lCXr/uqNX7kLn9f5aYr6b X-Received: by 2002:a05:6402:2033:: with SMTP id ay19mr341054edb.361.1597956372347; Thu, 20 Aug 2020 13:46:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597956372; cv=none; d=google.com; s=arc-20160816; b=vBUbxVAKAGPoSvy4AkDK08xS6cGdRE+TQHMzW+VuA/f+1a5oekN5TS6EIj2IvvBp1K X7i0+BqiiDM1tSTceJOAG/DsuFvsosakv3vdSzKElot4RYa6qbjJB/eEbXNAiPLfXh87 mg03bS//CfbN57za9reX0OnFA6w1g2R6wLi1oxRBr+zPSQm9lbGx0FnY9X9oq5e6FkAX kxaiFJ5qAcoQnrAyHDP6unEs4vPmgFDCUpN5ktxjohj5xxtBz8nWrIy8W8cBsnI6CgbR W4cdM55CKgjNrPBOpL+VKVbZYzqOr0MKhUdwFb9Tpw1YqZN3kRRLSg09Yh37Owo+b13n 950Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Ewf+8/r8T+ocxKAIGX5h4PS/z3AFtkho8eATC5y+uhk=; b=jG+esrrlI3gd2sL/jF5SMaJ6VvGqfaTMyXQFyDA5MpR3sIS6KLm5U22LjFMH/c9ObN tbwxBA4NoIWtAeM55NNbLC38LwwV7mYUa6EIrDsi1FlUFszcNjxSPj2ZIt5JG8l14+dm JzPPVBFOP4bEHsVQtXsg5dpLcbxZXGQdV9duMN7WHVaBPx1QNWfiLK1IZuS0XjUD5xS3 huGcM67ry0Cd9Gd1KJxMZlWtWnLHthttIQpchNsj8o4dwXzeNa9nJHxgPPcFsEZsCaxN eudZauMOW6QQsPdkQlaHBOpecoMudxf2p2dRUbR4NKkyDpHpUw6n7CMt+DwVzcfdObA0 8z8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kylehuey.com header.s=google header.b=Obfep8GD; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zh8si2255825ejb.475.2020.08.20.13.45.28; Thu, 20 Aug 2020 13:46:12 -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=@kylehuey.com header.s=google header.b=Obfep8GD; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730547AbgHTR1I (ORCPT + 99 others); Thu, 20 Aug 2020 13:27:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730473AbgHTR1D (ORCPT ); Thu, 20 Aug 2020 13:27:03 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5008FC061387 for ; Thu, 20 Aug 2020 10:27:02 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id f24so3456291ejx.6 for ; Thu, 20 Aug 2020 10:27:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kylehuey.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ewf+8/r8T+ocxKAIGX5h4PS/z3AFtkho8eATC5y+uhk=; b=Obfep8GDwJOj8YMmWlFSdQIaFfUZJNxuZ5wnp6NBFTdGC1SWtA7KpTHvf8PBpiWPAn JqBBAh1AwFctNZhfCq+fpMqkU79ayvttXSKA9YKcYkbispcHyReyR43IT1odLe623ZdL WxHmxQ95LGYxJkWiSyFsTSKr347gPRgj0DMF5OmyTL74Sl/Ug0zxcC4voImal8izbf+V WXCvCHG2db4v6DoE1dkkXT8UFoIy63ZFuOhfHawK8hOlKM9m43nkhJd59QFhM7a8N2yO OWF6GLQHwH5KMB1q5GdRLrsxztCQUjBdlwhB+IWWjLze8q0LHgLzQDsEztxo62B438eZ Dtdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ewf+8/r8T+ocxKAIGX5h4PS/z3AFtkho8eATC5y+uhk=; b=cm9Ck8ZzfAhjIAUUiyQiuCu5GFJkvFvQj1FXpIv/ISM55RnKB7zJYTVQB9CnUq/uSY 5cKM1uSdnsfEE3VJ6XgdlyGGXITsu/MAbN3Ny6xz5zVj09OBBziO/kVYnF7JvnC3nSnX srYspwTtpmM5nxb4YLdYzBajc7W72RjZs7DBBGx7gzt7bICukJIy3DVQZeiVrkuDtCNj pD/yTjJBkQJZXukDAQch9rAF/2RtATfr4BdvLpuMfjcofzndunuA6iT7aSORgnDEQLKY 5GFL41DqpVvhjWnTOrBdMw18a4klT99TkYSk1PkhadF5YtxVnzBTVOL0/x36uTBy1ztA ldkA== X-Gm-Message-State: AOAM532UhvUbKsAwR68W0b8Na0wa1jWuqFluHJMvfVTq8Ypm9yzSBsmH wmaoCmdeibFdlpjEozbYgP6uiXWxxJAkqXJBZNHFdA== X-Received: by 2002:a17:906:d187:: with SMTP id c7mr4456457ejz.196.1597944421480; Thu, 20 Aug 2020 10:27:01 -0700 (PDT) MIME-Version: 1.0 References: <87blj6ifo8.fsf@nanos.tec.linutronix.de> In-Reply-To: <87blj6ifo8.fsf@nanos.tec.linutronix.de> From: Kyle Huey Date: Thu, 20 Aug 2020 10:26:47 -0700 Message-ID: Subject: Re: [REGRESSION] x86/entry: Tracer no longer has opportunity to change the syscall number at entry via orig_ax To: Thomas Gleixner Cc: Kees Cook , "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 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 On Wed, Aug 19, 2020 at 12:44 PM Thomas Gleixner wrote: > > On Wed, Aug 19 2020 at 10:14, Kyle Huey wrote: > > tl;dr: after 27d6b4d14f5c3ab21c4aef87dd04055a2d7adf14 ptracer > > modifications to orig_ax in a syscall entry trace stop are not honored > > and this breaks our code. > > My fault and I have no idead why none of the silly test cases > noticed. Fix below. That'll do it, thanks. - Kyle > Thanks, > > tglx > --- > diff --git a/kernel/entry/common.c b/kernel/entry/common.c > index 9852e0d62d95..fcae019158ca 100644 > --- a/kernel/entry/common.c > +++ b/kernel/entry/common.c > @@ -65,7 +65,8 @@ static long syscall_trace_enter(struct pt_regs *regs, long syscall, > > syscall_enter_audit(regs, syscall); > > - return ret ? : syscall; > + /* The above might have changed the syscall number */ > + return ret ? : syscall_get_nr(current, regs); > } > > noinstr long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall)