Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp8432090ybc; Fri, 29 Nov 2019 10:23:58 -0800 (PST) X-Google-Smtp-Source: APXvYqys9KjgP80czGMzH8Stw07d0k/Y/xVFDx0bF1lpu2iUSr81xSgikjJ0FoPygaUqAfPNSEQR X-Received: by 2002:a17:906:a989:: with SMTP id jr9mr60604286ejb.160.1575051838201; Fri, 29 Nov 2019 10:23:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575051838; cv=none; d=google.com; s=arc-20160816; b=JW/aanKc+wtWMrYPQEFV7Z19FfRi8BjPNBlTfyIbaurlWAUYDsR2f6Bgkd8BRHxb0t 2UbuXUwYk5c3FWu5Lk/52GzU7cW/daL9UJ64w5B8O+92JGn3A5iOLTx8ZSaCNb2jTTCo /CdPPFrzFlCrOWl/YQOwg/BMeghn+OaawcWMzPIPePBk6iOxjNVP6CV5ML2zSXRaxJ6O nmKc38ue1Z6EsRwiGVj/I+N+fGV233q/9xtV/DfITcswdKd1iOghhdBYh3JyYHPpA7WO F4xhtMbGhEuQcfuNYxtBLVFIz9m3L4hF1GQLsmN6gh3+wRN1/eEFFpIhuhgpTwWK38uf 2WAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=urZfuzsCbzoczupKQe+p+P3/97PDZQ+qT28ZuADLov8=; b=o2eAxfa5w6cfNFWp3d3l3XrjEq81mfQFXPu9+BhFiio4mN1Bh1v7qDc2nJAuYJ5IUq zoVq5L635NwC5YJmnkcUl3VBmEi4jbOhasT6WQVhGo/LheteANY7eUV3U4Q9lBBXfikg LHmJL4SLmHAXD/ja0WpOn3EJeB/uSFFjclQ7b4/oxQJCELlmX5nMvM3CEXFDVA2P1OPX +86NpC77Aluoz7wd4sA9NdSEml0pMkbdEOnQ66VrisZMSV6bvFUmWTXusTQa2g18Deb2 //bFrN0CMQj7TGR8bI6bOBMyHwtZ4GqnDgg6FMwIzoElOTNmjEiHRE/k6a5hmX7rNetg 9Y7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=LTNVu137; 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 h36si16736934eda.206.2019.11.29.10.23.33; Fri, 29 Nov 2019 10:23:58 -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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=LTNVu137; 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 S1727107AbfK2SUD (ORCPT + 99 others); Fri, 29 Nov 2019 13:20:03 -0500 Received: from mail-ot1-f66.google.com ([209.85.210.66]:39756 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726985AbfK2SUD (ORCPT ); Fri, 29 Nov 2019 13:20:03 -0500 Received: by mail-ot1-f66.google.com with SMTP id 77so4309981oty.6 for ; Fri, 29 Nov 2019 10:20:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=urZfuzsCbzoczupKQe+p+P3/97PDZQ+qT28ZuADLov8=; b=LTNVu1373ngJ+alF4Bv5H5tJCyLBv1vtDp5N8j58OukvwSImXQypoNFj4NxCRjgP2A m2jy9yqyEYh89uldLvLptppmClOQ0n6Uz0TEG1Wq2gEMmqdhcR4Ob146N7Q30m2BdFa9 wqDpWAcBJkX/g9Ad1hhw2nYOyEUYXfyMagSikKjIbmdfoMo2zQ+P2n2Zb7FRAe2qfFJb EDU/XXZflZcb5XEOeXbVicR4wq/qoI+eMeL93b73wiBdlVqUGo4mn/XQ92oS6u3CRfoy ymh46fk8Gkk/XuTcyT/ersdbKgP34RoJHAfIl1IwoxtFGGjj+gfILywqPMtQ0QXYAbPL RMQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=urZfuzsCbzoczupKQe+p+P3/97PDZQ+qT28ZuADLov8=; b=DmS8Newb4YVAvZzcy9iD7AkH066xQWjNV2huBfznajPunZfykbjuKyrvqn++oUgo2h iAiWsaOU9HjOJgyJItUYUZ8LI/vTPpweOF9kspB9uRgB/C1fgdIySImqg1ogY9pzlgH7 lJsIRhrh4zIOHS6zBPtYIB/5j71fNLUgsqt1kvGWBU8i2KLs6lXzPtwcGM+xYoGO3KQ1 aerGl8vOHxQPuY4tyJTA6qyGzB4lFlRIp+ZAEhvktkv+vXBjZP6c8W3zDFvMIngwpJA+ T8Rl2eQKtGKpagoOHUtYJ6Lo2ZSKeqgxXnLjxR6axNW5MhKrAFqCmtYmO5101h2u3c3s p2RA== X-Gm-Message-State: APjAAAVRA3y4fLiTSyRI+4mIF3KgITlXXWqp+UIp9HF04fSi27SCWyYm w1tSrOKGTQzwjUZxIQK5EMzdVg== X-Received: by 2002:a05:6830:1e7c:: with SMTP id m28mr3274846otr.131.1575051601917; Fri, 29 Nov 2019 10:20:01 -0800 (PST) Received: from ?IPv6:2600:1702:1be0:ec0:d960:3a5:a5de:158a? ([2600:1702:1be0:ec0:d960:3a5:a5de:158a]) by smtp.gmail.com with ESMTPSA id l73sm3963160oib.0.2019.11.29.10.20.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Nov 2019 10:20:01 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] ptrace/x86: introduce TS_COMPAT_RESTART to fix get_nr_restart_syscall() Date: Fri, 29 Nov 2019 10:19:59 -0800 Message-Id: References: <20191129173213.GB3992@redhat.com> Cc: Linus Torvalds , Kees Cook , Andrew Morton , Andy Lutomirski , Borislav Petkov , Ingo Molnar , Jan Kratochvil , Pedro Alves , Peter Anvin , Thomas Gleixner , Linux Kernel Mailing List , the arch/x86 maintainers In-Reply-To: <20191129173213.GB3992@redhat.com> To: Oleg Nesterov X-Mailer: iPhone Mail (17A878) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Nov 29, 2019, at 9:32 AM, Oleg Nesterov wrote: >=20 > =EF=BB=BFOn 11/28, Andy Lutomirski wrote: >>=20 >> I think this doesn=E2=80=99t work for x32. >=20 > Why? get_nr_restart_syscall() can still rely on the "orig_ax & __X32_SYSCA= LL_BIT" > check, debugger should restore regs->orig_ax correctly. Right. Although relying on this is IMO a ridiculous bit of ABI. >=20 >> Let=E2=80=99s either save the result of syscall_get_arch() >=20 > We can save the result of syscall_get_arch(), but it doesn't distinguish > x32/x86_64 tasks, so it doesn't really differ from TS_COMPAT. Duh. Never mind. >=20 >> or just actually calculate and save the restart_syscall nr here. >=20 > sure, we we can do this. I like this the best unless we can renumber the syscalls. >=20 >> Before we commit to this, Kees, do you think we can manage to just renumb= er >> restart_syscall()? That=E2=80=99s a much better solution if we can pull i= t off. >=20 > Agreed. >=20 > Oleg. >=20