Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp713274pxa; Wed, 19 Aug 2020 12:45:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzlvfnY9IbVf5cl2VE1UdX5yWcEA0rTV1y5qdsZBTSd+7XoE2+fQw6LA7EMPoP6faw7Bor X-Received: by 2002:a05:6402:206a:: with SMTP id bd10mr25636425edb.321.1597866344595; Wed, 19 Aug 2020 12:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597866344; cv=none; d=google.com; s=arc-20160816; b=NqPyBQTmKXtmR7YEBXE8crSMYz+0GFQ4rN7+rrmlLJX9qIV/TXHvNSc+PEPz9GGY6J J7cgsBJl+irjl4gCiutdMSi0wI0WONhsXrQRxT4nr3gAI/nINDaChu5BTKlO52hydtzd Q5Ny0XSCILKZbYv7DTAE3GXsf3iLP/5NBAI7+NBsYFk+ZDD/gyeY34nzlqi5KDMSbqBo EqlXjzGA6RzZ/hloA5oTm1b7ymzDgGKeHofaap/kNAoHqTVL9XbPHWPaginaDKL0EfiG szPoahLomwdQTeol4NTqgdFQN5AtsaIW5IuXS0mvLInMK4zYNKvhZE9NzjupGtoDLmHW XSXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=AINU1esGzcrRIOW7eRcehsH4H2erF0S2S1Nr8oelaiM=; b=WGJnNrGF7+8oS31XffUwPleSqc8VtKtgHrrCOLYzHpw1xKRhN9J09eYIoAQa5bMXGR oXrOOwLF77Td/StLq19nwst+gYzOfsZVez2zL7h8bbnAb7k/L2dCU8tqipToNJNCPM8e MQ7TgUuIEn7gBBsCkZe94ZlNTGnn4VbhqRllas2g0DISvwtLW59RCmlnV43LIqISAe+H uduNAyTqErKUOJV2PrwaGBwaWGCR6Dbup1Il50J4qJgJwFqJhqM5evTvEEF0oJYSL4VQ 2jXXsrfLBCGHj/U3wCshsXBVIO5ry6QX3PbTFx7Jc6UnJT4YBs8JX4dRE+CbLqPNhsFQ bCBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=zgRpru0v; dkim=neutral (no key) header.i=@linutronix.de header.b=DK2436jf; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l18si15566054edq.425.2020.08.19.12.45.20; Wed, 19 Aug 2020 12:45:44 -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=@linutronix.de header.s=2020 header.b=zgRpru0v; dkim=neutral (no key) header.i=@linutronix.de header.b=DK2436jf; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726729AbgHSToo (ORCPT + 99 others); Wed, 19 Aug 2020 15:44:44 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:41642 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725997AbgHSTom (ORCPT ); Wed, 19 Aug 2020 15:44:42 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1597866280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AINU1esGzcrRIOW7eRcehsH4H2erF0S2S1Nr8oelaiM=; b=zgRpru0vafpXj5BMCd7J2XXIbj9JmCHA/x/xf8v1SLaFIcORODsOUP+Hah5ni1URQYvnmD H36wCkZSZsZumqjBN+RI5FpOR0yVbO79TkM4TcPI0XBuCCOTZzM6tSze1FI2BJhqq8XUBx pfW7Y1qxZZo4MwdWfuU5FHnLvhqv3aaNogcBRoRpEz5B7w6ofbGkHShG2HznNlSkakl3Uj T0TsS31u8SDSnp2WAaf1f8xiIHVKBCqzGo92izKj/za64AtUeKKiN5AX+bcHZgIJ6u0zGX AMQ6XwWOJBYIIb1813u5dEfv/yntcQcaKRDCLRCk1FJnDm+BXSumGgnMGvmyog== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1597866280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AINU1esGzcrRIOW7eRcehsH4H2erF0S2S1Nr8oelaiM=; b=DK2436jfqzsF8GCaoE1iVXsDyO84/rePl1qZE9MDMxjw4bG0NcbW6vsHPt/66S2tMAtN9p 8uT28wC//hyxNeDA== To: Kyle Huey , Kees Cook Cc: 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 Subject: Re: [REGRESSION] x86/entry: Tracer no longer has opportunity to change the syscall number at entry via orig_ax In-Reply-To: References: Date: Wed, 19 Aug 2020 21:44:39 +0200 Message-ID: <87blj6ifo8.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain 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 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. 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)