Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13777350pxu; Mon, 4 Jan 2021 04:20:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxO94oF8Db/IZBila98JbIpk35KCGH0Z3rPMOS4vMvtn7LMk/USvvMnO957p22DbpLuTV0s X-Received: by 2002:a17:906:a192:: with SMTP id s18mr63614009ejy.249.1609762832558; Mon, 04 Jan 2021 04:20:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609762832; cv=none; d=google.com; s=arc-20160816; b=03JSXy5JeS3Px09H8fbYW4O1zXCzuVwX0iPQhEq01GMak3sBcnvFZyBGSOBtrVHcDu v8LZwNwbmZMX1jhAmFcxKTqOsx9CnB5JnM8hMYBnzSHy+oRcTs1ehmY5Sdt7X9M6EkYk MmNM00unqPuDXPIXTFIeaF0UHdHpqkjm0CNj8o3TCtlXCXoRqQrhZ8WwJZQS4tyTLZHk cHbSbMzRsPE82KJ9ReCph5srZKzW0c/Vk9HNwR0MXhsnJhDS59KHRoufPZU+G4Xvz0kl DvuNzNnOHMqgfEdMne1QDVZgcwEVQAG1V0HVC2mMQwI+U3wkqJEvzJKtRgzaYLBvaGlf bxlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:message-id:date:thread-index :thread-topic:subject:to:from; bh=LtcYh2qspzrRfF1dUCDInSZfpDlnr99b6tU16ag3vRI=; b=0zLvox+OJYet81i6XOvBiHxIczqJCprNbtpFS9iQr5HYauSSKVWeM/biRzSXCcRGUD AVwa5XzEc91SJbopAvwA1XMfnaAmqQ7f2bWBOopPADQ2rXQ4a1nkAvj8b+dSMeagA7jl FoTxGQbTDz9NeQKYTxNGG5+GRHph5krYJZrLiCOsMkJtOGrmspfFoyT3EDwUwwFEcacU EJ1Fq3OIsO+xOYgN+yvw4Ay6oPFXMB4HouG3TazqO++2YIgsWENQzZxmNzFMvNmsHOIl Vw4At32mpXO5cO7zKJLkVHRftl5vzgtsaQUEkf9VvcheWzsIMSNnN6O6XYVdWB8n+XWu WEaQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cz27si29691569edb.371.2021.01.04.04.20.09; Mon, 04 Jan 2021 04:20:32 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726520AbhADMSf convert rfc822-to-8bit (ORCPT + 99 others); Mon, 4 Jan 2021 07:18:35 -0500 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:23205 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726236AbhADMSf (ORCPT ); Mon, 4 Jan 2021 07:18:35 -0500 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-161-e-HVRhClO9mndLuADFhIAA-1; Mon, 04 Jan 2021 12:16:56 +0000 X-MC-Unique: e-HVRhClO9mndLuADFhIAA-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 4 Jan 2021 12:16:56 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Mon, 4 Jan 2021 12:16:56 +0000 From: David Laight To: Al Viro , Christoph Hellwig , "linux-kernel@vger.kernel.org" Subject: in_compat_syscall() on x86 Thread-Topic: in_compat_syscall() on x86 Thread-Index: Adbikf8I52+Fp/HYSH2MXxqk00t/Og== Date: Mon, 4 Jan 2021 12:16:56 +0000 Message-ID: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On x86 in_compat_syscall() is defined as: in_ia32_syscall() || in_x32_syscall() Now in_ia32_syscall() is a simple check of the TS_COMPAT flag. However in_x32_syscall() is a horrid beast that has to indirect through to the original %eax value (ie the syscall number) and check for a bit there. So on a kernel with x32 support (probably most distro kernels) the in_compat_syscall() check is rather more expensive than one might expect. It would be muck better if both checks could be done together. I think this would require the syscall entry code to set a value in both the 64bit and x32 entry paths. (Can a process make both 64bit and x32 system calls?) To do this sensible (probably) requires a byte be allocated to hold the syscall type - rather than using flag bits in the 'status' field. Apart from the syscall entry, the exec code seems to change the syscall type to that of the binary being executed. I didn't spot anything else that changes the fields. But I failed to find the full list of allocated bits for the 'status' field. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)