Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2791713pxj; Mon, 10 May 2021 10:48:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvCqXmeAmi5h3IRQn4HuUPDNGB0VPMZ8rHy/as2r+F/0imP707B6c+p5AkPEL70tog7w75 X-Received: by 2002:a92:d688:: with SMTP id p8mr22175059iln.268.1620668914023; Mon, 10 May 2021 10:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620668914; cv=none; d=google.com; s=arc-20160816; b=AERgy76vKpxR4wFq1bSk/Yi4exABzgmx59cxX9hpLNtshDpIXjQoyNf//0i8QuFbSp oA+iEK/lH5jiKKJz9X7T9Fv+5K88MQiCDXvzFJVCuiDXapWJ2PLYjU0CclS59cM6emGO cGVZdkMCTbNws9sLBNeCYg92DT+6Zi2ScMTdanVeqmktko9H3GGeeFET4ErM4Ak2JNrG ofMqiVaIxCOAnfdtCepP6JjKaZk35GE00ovZk3/jPk4azNZlwizhsbDpFlhK+0bO+/3E UGjM6Gk0tmA/v8PnHE97N9uQ5YvA6rH1z++5xay1qZmDtSCgfLKgQdhsZbLPcFjbYfNm pGgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=ySA6dgUNhjeCqg7PzMzFnUh+og6c9bflJRjpoTNwYY8=; b=TnmAUBl8IytNfqfUMZuoAuH75vr5XTgv8L4F25yf4Ik3h38kVXulbqmJhCv2mZyUwX i05KtxZpi0ykaqo/L7glcxeg+aoFF95/Qq6QPOQYync4DD57g7jWKJuf+PYlYxPPoRfX lGUYBAc90noxYEKFoqU74lGFt8L7/gRxZ6/eFiH0JHSFY7TgK2Yea2CNPFuxC4n/oaxg suAiQnKHMLtPBXeJ5UQ00RFr7kwh2qp0CH55qKozkwN0EUuIX3veZN3CFLJxGHxQpNP0 j8WOadFN8IT595Pc45H89erhWTHz02jmscupVZ7FbQrYfcjebXUTPyewgBgVDwCjjMBQ d9aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2021042801 header.b=gcVhW3db; 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=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s4si18690180ilv.33.2021.05.10.10.48.21; Mon, 10 May 2021 10:48:34 -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=@zytor.com header.s=2021042801 header.b=gcVhW3db; 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=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233093AbhEJRrM (ORCPT + 99 others); Mon, 10 May 2021 13:47:12 -0400 Received: from terminus.zytor.com ([198.137.202.136]:38811 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232943AbhEJRqp (ORCPT ); Mon, 10 May 2021 13:46:45 -0400 Received: from tazenda.hos.anvin.org ([IPv6:2601:646:8602:8be0:7285:c2ff:fefb:fd4]) (authenticated bits=0) by mail.zytor.com (8.16.1/8.15.2) with ESMTPSA id 14AHjGkA2449170 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 10 May 2021 10:45:25 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 14AHjGkA2449170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2021042801; t=1620668726; bh=ySA6dgUNhjeCqg7PzMzFnUh+og6c9bflJRjpoTNwYY8=; h=From:To:Cc:Subject:Date:From; b=gcVhW3dbTMACvWXtQYvIyeTyaEWGjl/4IVMqp5ThKGUlZ1OIm7sprC1kWAuJxli6q 0ZKJZp+D3yVbvN9mCeppKaOHpCAHkVl6pv9qC1KT/uYKqWUyqjSSAsXjjbkv0iw/XR gISesil9GzdQcqreHqJyiwZJ4r9Bd6Gb6mkf4/j8jPBI6xtrGGqJElCsnP9BdJwc4S k0psSqfYkqc+KeIR3XZS1y3QO56jIsm9tYCxTTRRy+tY2/ciDEQWMIT3W6mgDxsRrm bDWTIVibhZmcZLLwijQVc+4QNdsS9w2Z5gErLqV5E0MS3T4Un0dPd6UEarxGrcScOq TBLRVkl8asF8Q== From: "H. Peter Anvin" To: Ingo Molnar , Thomas Gleixner , Andy Lutomirski , Borislav Petkov Cc: "H. Peter Anvin" , Linux Kernel Mailing List Subject: [RFC PATCH 0/6] x86/entry: cleanups and consistent syscall number handling Date: Mon, 10 May 2021 10:45:03 -0700 Message-Id: <20210510174509.3039991-1-hpa@zytor.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "H. Peter Anvin (Intel)" This patchset: 1. Cleans up some duplications between and . 2. Swaps the arguments to do_syscall_64() for consistency *and* speed. 3. Adds the maximum number of flags to MSR_SYSCALL_MASK; the previous is more of a minimum. The more flags that are masked, the less the likelihood of a control leak into the kernel. 4. Consistently treat the system call number as a signed int. This is what syscall_get_nr() already does, and therefore what all architecture-independent code (e.g. seccomp) already expects. 5. Call sys_ni_syscall() for system calls which are out of range but still positive (negative system calls are used by ptrace and seccomp as a "skip system call" marker) just as for system call numbers that correspond to holes in the table. 6. In , factor the PUSH_AND_CLEAR_REGS macro into separate PUSH_REGS and CLEAR_REGS macros which can be used separately if desired. This will be used by the FRED entry code at a later date. --- arch/x86/entry/calling.h | 45 ++++++-------------------- arch/x86/entry/common.c | 71 ++++++++++++++++++++++++++++-------------- arch/x86/entry/entry_64.S | 4 +-- arch/x86/include/asm/syscall.h | 13 ++++---- arch/x86/kernel/cpu/common.c | 12 +++++-- arch/x86/kernel/head_64.S | 6 ++-- 6 files changed, 77 insertions(+), 74 deletions(-)