From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D81D356750 for ; Sun, 11 Oct 2026 13:15:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791724525; cv=none; b=JFdNh3NhRd1f260KWu7mSkMYk3IlWDt5KNmEgt/u4OR+1bojba1tEC/KxbnAvoL9NUdZYPomDHLT0KLZYePI84koMAsi1fKsS0NmsKuTJQrs9/y+rpFYujJnmg8wI22NQ3ZBpzSKpMWKoboKr0jgrgsb1qPsqjZQcosrH4sRXSg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791724525; c=relaxed/simple; bh=4LTWqZOsQQVaJZ+YiPBER72YgxMoK7hq/JgYQ5D5H4c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IbPtX91gkOKwStJlMYvOkjh/03sOFiUdNng8M31OQgG9dDIVXy37Fduv6NeE2bgQvZf00LPdryfbFikKSxqZqLcnGfz75tyzmutuT5WC3BchazK/L4fqcXmRB3m1aVnxTSgpen4phGQ4Txogieh2PseGIxJZ0PhclcL58ygHzX4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bC3tfJXT; arc=none smtp.client-ip=209.85.216.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bC3tfJXT" Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-38e42560ebcso398188a91.1 for ; Sun, 11 Oct 2026 06:15:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791724524; x=1792329324; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=mJ9iC+O+vPqb3WC9SF1MqS5h0PqRsFdPKt4vGtej/xE=; b=bC3tfJXTNUCpeht5kHb9DzPkkMEg6ji+4UPzCBDNvHslM/Vlc5Wz9GCDjhGq45eKWu WHyRKjxVocMgvgcBWeXOjEwBtza4CYzNtFvBlu/SRnhUFGytB0GaeUb152fkp83iiAw9 +J4cg8g0UyeIgl2jps+5BEE+tKsXOV9l57pcRVhcFvlXYMkcibXiZxo+yxGN47ajIAWU z6Y3+1se7QjvY51veCg65xhCocsdrthNoMRqaah2PH+462eGdDnv3Ta9Jf0NDW/2jWi/ shYd6pNfwrUG5q5dMNStSy3fcAK9B5bfu7e4rF164G3SQwN2hWNF8iAmOM4RzgKpW8tG OW9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791724524; x=1792329324; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=mJ9iC+O+vPqb3WC9SF1MqS5h0PqRsFdPKt4vGtej/xE=; b=fX7kdn/whp2Y0iZdTAAac2MDq1FH24gOKQisEnFqEXS/umMi8S5EvWk2BvFZZw78IA TRvxmwizDDcw3oXP7e8N+cjMtjiT++8tpo0WrxGEfQuSm5vZJ+072iQNrm/DaUFUkSqM p5ZxQvEtTTlOw1dO9UglAUuuJvDpMdVZmDwnWmdEuUbmili/zrVFcjmqBA8YaZW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AnK 6Ygufj+WJ0i5ByA+aE9fPC+IjvQw6apOBzpp/64wgy2IMmIW32KVJ8jekQ/9jdELiisGzfpmZ X-Received: by 2002:a17:90a:bc8:b0:3a8:545a:9e87 with SMTP id 98e67ed59e1d1-3ab3a747e4dmr3791690a91.15.1791724523682; Sun, 11 Oct 2026 06:15:23 -0700 (PDT) Received: from desktophank.localdomain (111-242-217-19.dynamic-ip.hinet.net. [111.242.217.19]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cd3da05caaesm3168968a12.32.2026.10.11.06.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Oct 2026 06:15:22 -0700 (PDT) From: Ting-Han Hou To: Danish Khateeb Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Andy Lutomirski , "H . Peter Anvin" , Jinjie Ruan , linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/entry: Fail invalid syscall numbers other than -1 with -ENOSYS again Date: Sun, 11 Oct 2026 21:15:16 +0800 Message-ID: <20261011131516.104193-1-ue081723@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260929173345.257226-1-danishkhateeb03@gmail.com> References: <20260929173345.257226-1-danishkhateeb03@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Tue, Sep 29, 2026 at 12:33:45PM -0500, Danish Khateeb wrote: > x86/entry: Fail invalid syscall numbers other than -1 with -ENOSYS again I tested this on top of current mainline a5ebb76233b7 (v7.3-rc6-386-ga5ebb76233b7): x86_64 defconfig + kvm_guest.config, booted in QEMU/KVM (-cpu host), with the x86 selftests built from the same tree. selftests/x86/syscall_numbering_64: without the patch: [FAIL] A total of 37800 system calls had incorrect behavior (12600 each in the "modifying the default return", "clobbering the top 32 bits" and "sign-extending the syscall number" ptrace passes, e.g. "x32 syscall 0:-64 returned -9999, but it should have returned -ENOSYS") with the patch: [OK] All system calls succeeded or failed as expected It also passes with CONFIG_X86_X32_ABI=y ("x32 is supported"). The selftest does not cover the syscall_32.c hunk, so I also used a small tracer that sets the return register to -9999 at the syscall-entry stop of int $0x80, from both a 32-bit and a 64-bit process. Without the patch, numbers 1000, 0x7fffffff, -2 and -1000 all return -9999. With the patch they return -ENOSYS. -1 returns -9999 in both cases, as expected. ptrace_syscall_{32,64}, syscall_nt_{32,64}, syscall_arg_fault_{32,64}, single_step_syscall_{32,64}, check_initial_reg_state_{32,64}, sysret_rip_64, sigreturn_64 and test_syscall_vdso_32 pass with and without the patch. No warnings in dmesg on the patched kernels. I did not test a native 32-bit kernel. The kernel test robot report for this is https://lore.kernel.org/all/202609210251.4f7bf339-lkp@intel.com/ , which asked for: Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202609210251.4f7bf339-lkp@intel.com I used an AI assistant (Claude Code) to help build and run these tests and to read through the change; I checked the results myself. Tested-by: Ting-Han Hou Reviewed-by: Ting-Han Hou