Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5767494ybc; Wed, 27 Nov 2019 09:08:00 -0800 (PST) X-Google-Smtp-Source: APXvYqw1xs6V2ODAix9L/2U2sVB4CqSyS0a74iM+CsgoI/GeBAb3Y10wkDAqglbDemRIqiP+l0Ye X-Received: by 2002:a05:651c:20a:: with SMTP id y10mr31515734ljn.76.1574874480412; Wed, 27 Nov 2019 09:08:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574874480; cv=none; d=google.com; s=arc-20160816; b=psBcfpjyfgxYEGfxvAOi/5VIovtcTwAf3RLwhC/V8SCEOgtLGr6kpTI9ALf4k59KHd OXiW5xKn/O4CNnSkoftifcKt6Y8V2HJ1eK8POJU2ZDawMtY2a+xdkr8nLcLudt+xSHct yeAPzbKVlq8OXrjQ27GYVDE4GxufVpK5KwJXUY5ZJrqygrnP05l99UcmbmqQoJoxo1vM hI7L1PRtt655vDKOJ50xGqsn7UhyowXRHAsIgx0F5Kbb98UyYCfflOdsKxEGnuCfqc5C 8bsOJwu++R2U7ofSYoyC1vs+wuokFTAjwMZ8dlS/mPTT7L4/qIpR3rcQ9hiL5qMCrhlY /Rkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:user-agent:in-reply-to:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PFznFDlZHRH6jRkPfupU/SWMKG2b5n/tHVJYWZ7aun8=; b=SPqe96XcNyeeMFv4eDRszsp2/HP2bgLVN0jUNzFcvqXxmq6O3XGlh0inSi8KIxNJ6L NCOCE8Y/+DWTd5MuFrPwFKlzvtLn97KwVWpLr9y6mSVr5N4JYmWsPANNESxvposL3v4g O03SNz1vwKZlfjSyrnznHFNh1lKnrY9Gs8jDrnmgZ0oFAdHkt3qDq+sLQbRmUWM4Jt/Z j+OIRALnLlY0AP4QVhV9TbcEDjInwzTcKJulJ2gJrQD0vR9sow/ctuq42Ayji0AIr6Uv eOPnijax24cybLtNmhLuIQCgp084N3NXP68RwHCgUrEsCQWbYS96g8jHa6IxWpqYFg9v tlcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="iXf/BFVW"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p22si4272864ljp.128.2019.11.27.09.07.30; Wed, 27 Nov 2019 09:08:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="iXf/BFVW"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727176AbfK0RCr (ORCPT + 99 others); Wed, 27 Nov 2019 12:02:47 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:27659 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726984AbfK0RCr (ORCPT ); Wed, 27 Nov 2019 12:02:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574874166; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PFznFDlZHRH6jRkPfupU/SWMKG2b5n/tHVJYWZ7aun8=; b=iXf/BFVW6/MXIIqck8MXGoL690M3sZdGrwHiAhkZleptYQEAkajSZioUZgKIDUiQ8BpWqB RmFN5cjgwaEt0jK6DUrCoxBrl/ClWonOeg3Tjrq+3ptrx4qh4SOyArHH91nWnOCm82P5H3 qoStCUDt0Y6d38OKV1oJXDlaTf5MM48= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-400-so-q2ANANmuDtfaY4tta0Q-1; Wed, 27 Nov 2019 12:02:43 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 38EBA8017D9; Wed, 27 Nov 2019 17:02:41 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.44]) by smtp.corp.redhat.com (Postfix) with SMTP id 841AB5C219; Wed, 27 Nov 2019 17:02:36 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 27 Nov 2019 18:02:40 +0100 (CET) Date: Wed, 27 Nov 2019 18:02:35 +0100 From: Oleg Nesterov To: Linus Torvalds Cc: Andrew Morton , Andy Lutomirski , Borislav Petkov , Ingo Molnar , Jan Kratochvil , Pedro Alves , Peter Anvin , Thomas Gleixner , Linux Kernel Mailing List , the arch/x86 maintainers Subject: Re: [PATCH] ptrace/x86: introduce TS_COMPAT_RESTART to fix get_nr_restart_syscall() Message-ID: <20191127170234.GA26180@redhat.com> References: <20191126110659.GA14042@redhat.com> <20191126110758.GA14051@redhat.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: so-q2ANANmuDtfaY4tta0Q-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/26, Linus Torvalds wrote: > > On Tue, Nov 26, 2019 at 3:08 AM Oleg Nesterov wrote: > > > > Alternatively we could add ->compat_restart into struct restart_block, > > logically this is the same thing. > > That sounds like the better model to me. That's what the restart_block > is about: it's supposed to contain the restart information. I knew ;) OK, I won't argue, I'll send V2. > I'd much rather see the system call number added into the restart > block (or just the "compat bit" - but we have that X32 case too, so > why not put it all there). apart from x86, who else can use it? after the quick grep I think nobody, even arm64 and mips which have compat nr_restart's do not need it. restart_block.arch_restart_block_infp makes more sense, but that would be even more painful, I do not want to add asm/restart_block.h or HAVE_ARCH_RESTART_INFO, or use CONFIG_IA32_EMULATION. OK, lets add the new restart_block.nr_restart_syscall field, then we need =09void set_restart_block_fn(restart, fn) =09{ =09=09restart->nr_restart_syscall =3D arch_get_nr_restart_syscall() =09=09restart->fn =3D fn; =09} but somehow I do not see a good place for =09#ifndef arch_get_nr_restart_syscall() =09#define arch_get_nr_restart_syscall()=090 =09#endif Can you suggest a simple solution? Hmm. Or may be HAVE_ARCH_RESTART is better after all? Say, just =09--- a/include/linux/restart_block.h =09+++ b/include/linux/restart_block.h =09@@ -24,6 +24,9 @@ enum timespec_type { =09 */ =09 struct restart_block { =09=09long (*fn)(struct restart_block *); =09+#ifdef=09CONFIG_HAVE_ARCH_RESTART_XXX =09+=09int=09nr_restart_syscall; =09+#endif =09=09union { =09=09=09/* For futex_wait and futex_wait_requeue_pi */ =09=09=09struct { =09@@ -55,6 +58,15 @@ struct restart_block { =09=09}; =09 }; =09=20 =09+static inline void set_restart_block_fn(restart, fn) =09+{ =09+#ifdef=09CONFIG_HAVE_ARCH_RESTART_XXX =09+=09extern int arch_get_nr_restart_syscall(); =09+=09restart->nr_restart_syscall =3D arch_get_nr_restart_syscall(); =09+#endif =09+=09restart->fn =3D fn; =09+} =09+ =09 extern long do_no_restart_syscall(struct restart_block *parm); =09=20 =09 #endif /* __LINUX_RESTART_BLOCK_H */ ? Oleg.