Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5786295ybc; Wed, 27 Nov 2019 09:23:31 -0800 (PST) X-Google-Smtp-Source: APXvYqxYb21zemmvGVsqA5Vn9+s9Dnd+3DKRHTAAqJ3EMnnofA5c20Iaq439QgMfB4p5AQ7VJ3Ol X-Received: by 2002:a17:906:a40e:: with SMTP id l14mr50172318ejz.168.1574875411424; Wed, 27 Nov 2019 09:23:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574875411; cv=none; d=google.com; s=arc-20160816; b=GxWXwwghCBQV5Vziu1SLdu2MWYM0DScQiUI2GljlX6SOH7g8hAab3k72V3ktXy1xMd ex/RliVLTtNN+XHA23iFHeIhG1g3ILWQs+ETxxgDr6npGNRaQsaDNh1s1TcX2wTGo/ib h7KMKADphwYs8CHyv8cq/YUzGOh0KV5EdaU9FX8NmigBpZHa60JrKcq7xW8MPTJKYXrE RqxAOby9VfAbgdO4dQm4A9xZfd8/vYbBbPaeIduPY6dy3RzxCcJPztIR9T4iSn5hSiNs EBaq5nEVG+D2JhHI3RmpdSgq7TAzHW7pixEvxGfwzqoDSIN3W+lf7pxRlVLLKWCwqtF9 lQuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=OG0kCK/PTuRhE0FsWS7wj1K9F3vBSU78DhujocScFeU=; b=DCkOzWzp/xkQNisHW1F0mgzwgVS1U2Mwsn6nuXpUS2qPxu0XAd7u8hmkdRTtzDE6qW VzMP61/I6p1mZj3+kPk/dJ6TRP/ddBQBOpFTCcEPAZVoqRNIVP4y/b7TFEmhXeb6uC/1 oabm8HoiEL8zlwnBfAHEbY0i74vn4t85awCPXwPaPB3ip8oQcZ3j/OU1AdJbCyvFpyf9 wtm/BtEzzCDVp4thNTsHSWLIhUo/HwH04nIfIPsAWMt5pDmCBGMjsfKD+daLckGuByF3 kS+7kHZc/7R01Vnfew4EbSxKPh1RN3UPBzRZqnCbQ5zKHNAZbRZGdbGjSGZsKhch8fKX LJwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=P5mGSxx9; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a26si3094420ejs.91.2019.11.27.09.23.07; Wed, 27 Nov 2019 09:23:31 -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=@linux-foundation.org header.s=google header.b=P5mGSxx9; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727040AbfK0RWF (ORCPT + 99 others); Wed, 27 Nov 2019 12:22:05 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:42229 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726655AbfK0RWF (ORCPT ); Wed, 27 Nov 2019 12:22:05 -0500 Received: by mail-lf1-f67.google.com with SMTP id y19so17785805lfl.9 for ; Wed, 27 Nov 2019 09:22:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OG0kCK/PTuRhE0FsWS7wj1K9F3vBSU78DhujocScFeU=; b=P5mGSxx93jPkWHZmzujmhhyo2qndVm8yDOL1UpEMcDnDBIzi7DkAd89I06zi/X7EvD SN0MIRM3WqUuiWyFx31l4pVe23edeN0qZX3YGcA7dO8hQkm36NJbP8A0OwjyNcOv9oPI bHPqb94eIoqdzKjv/3oYPFlF5qp7O9yKUXpxk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OG0kCK/PTuRhE0FsWS7wj1K9F3vBSU78DhujocScFeU=; b=hWx6boREFWMeKCMI7vj+DnvMqked+WPZMp/7UmO2VYE8BG+9CUezTgYVxnjQbjnyRI 2rwEB66Zee7go6sZVwdrSMdjwxDenCp8/1RlJ90syIO+8Ny1fxYLSGglqsrWDtFcDHbf lxfvYSjAE3GkYXYDgEFOJu0KVkHeIrZ/bIRNvENSjksw/fMWSIeUfNGUBXiw7lyRiVWe v/MJj/Dl2WUDDYEAKTnhI4OQVaOy6T6kCUjpR8kf9vl1KSGzP90IEBDLFRb9WaaMdNC8 p7SA/2azc3x2m9vfm2fUvsmuN0MrgjBGLickXtGrHSYqXHSDEFZVegxi1cw/K35yN3g0 vYyw== X-Gm-Message-State: APjAAAWF+ZIAv+cPq9xxLAT+Xu8lCgcCE4dunfcd67kEjXPU+3DhyQS+ Iuxlee5xbwCeRGIAPw4G1Vk0+XrR984= X-Received: by 2002:a19:5f05:: with SMTP id t5mr6587377lfb.149.1574875322548; Wed, 27 Nov 2019 09:22:02 -0800 (PST) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com. [209.85.167.45]) by smtp.gmail.com with ESMTPSA id f3sm7469788lfl.58.2019.11.27.09.22.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Nov 2019 09:22:01 -0800 (PST) Received: by mail-lf1-f45.google.com with SMTP id l14so17786742lfh.10 for ; Wed, 27 Nov 2019 09:22:01 -0800 (PST) X-Received: by 2002:ac2:5597:: with SMTP id v23mr26331499lfg.79.1574875320772; Wed, 27 Nov 2019 09:22:00 -0800 (PST) MIME-Version: 1.0 References: <20191126110659.GA14042@redhat.com> <20191126110758.GA14051@redhat.com> <20191127170234.GA26180@redhat.com> In-Reply-To: <20191127170234.GA26180@redhat.com> From: Linus Torvalds Date: Wed, 27 Nov 2019 09:21:44 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] ptrace/x86: introduce TS_COMPAT_RESTART to fix get_nr_restart_syscall() To: Oleg Nesterov 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" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 27, 2019 at 9:02 AM Oleg Nesterov wrote: > > OK, lets add the new restart_block.nr_restart_syscall field, then we need > > void set_restart_block_fn(restart, fn) > { > restart->nr_restart_syscall = arch_get_nr_restart_syscall() > restart->fn = fn; > } No, I'd suggest just adding an arch-specific "unsigned long" to the restart data (and not force the naming to something like the system call number - that's just an x86 detail), and then something like this on x86: void arch_set_restart_data(restart) { restart->arch_data = x86_get_restart_syscall(); } #define arch_set_restart_data arch_set_restart_data and then we'd have in generic code something like #ifndef arch_set_restart_data #define arch_set_restart_data(block) do { } while (0) #endif int set_restart_fn(fn) { struct restart_block *restart = ¤t->restart_blockl arch_set_restart_data(restart); restart->fn = fn; return -ERESTART_RESTARTBLOCK; } or something like that, and we'd just convert the existing (there aren't that many) restart->fn = xyz return -ERESTART_RESTARTBLOCK; cases into return set_restart_fn(fn); and for bonus points, we probably should rename the "fn" field, but that might be too much work. It doesn't look *too* painful, because we just don't have all that many restarting system calls But the above is handwaving. And yeah, I never understood why the compat and x32 cases should have different system call numbers in the first place. The seccomp argument is garbage, but probably historical stuff that we can no longer change. Linus