Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3408189pxj; Sun, 20 Jun 2021 20:19:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnYOSxrpedmlRjHng1/VoKAXFAXp+H4ymhJX1DWTbcLk0L3Ep6ZMsoAi8GLY/uiz4cdfPl X-Received: by 2002:a92:d2ce:: with SMTP id w14mr10903960ilg.217.1624245572012; Sun, 20 Jun 2021 20:19:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624245572; cv=none; d=google.com; s=arc-20160816; b=G2nvxJyInIxPpxjsx391/tU65MObHaUvcN0rUqsUic9PELL0zaHTbBaurGQOGedJfE pYJBLp8wtrxrfnoGImrf5VgvSRKOEEERf4nB5mqYC4XBUSGQuFeLV5IYmM+fOZKftFZX sYm6BXW0nIF5SiHamr31n+RKDEgm/L0MITXlr0lwd3qf4FG27srC4MbyHcI2J156mfGo rhLkwEMKkDTnXPcPT0FB36vR2CGqveKpjOPxec2Dzb3AHcT9PkYaY12Vkjp4o42OZzkZ nb7MIFMqoXXgk5GJoj30pohpqwbZ1JCTTnl/INUKHvsGDY5dhrm68JI6v7J0hdbu7FDA MJwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature; bh=bEMA3Fn9G78MJjOLATMzSr4FKpTvjeDpYpynuiBu+GA=; b=MtUlxgywhkc5Ty3bsNDfYF7LSO4IDzu2Z1beEtADuJ1yzo8TVQ+L5NKXzw0tv+IRi6 WqDNckwXEpG/uqVJMG5GIPH63OA51mcZHAgK7TPot8oex/Mpdm28ukFs4XPwBq28Ketm HAzjqBzvNdSOSRMx9tZC39crT9tdJbtoaH15kJlJSwgdyUdnYjyyi20y0HDraOMxBUj/ 52RONiKEi6LXl/3IsosHNYAC2XD81kAGWkNZaYF+1VgEHmW9HP2+xSyjucXG6WknWwIs /LzWxqzWbG6OhHyqW+hQ9n+aytJZL/txF8hR3mgVg9OyPBWxFLteoUHNonrNZeDKjgV8 sUcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="PS/fyHWz"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o1si4546779ils.95.2021.06.20.20.19.19; Sun, 20 Jun 2021 20:19:31 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="PS/fyHWz"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230028AbhFUDVF (ORCPT + 99 others); Sun, 20 Jun 2021 23:21:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229901AbhFUDVE (ORCPT ); Sun, 20 Jun 2021 23:21:04 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D968C061756; Sun, 20 Jun 2021 20:18:50 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id a127so2006751pfa.10; Sun, 20 Jun 2021 20:18:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=bEMA3Fn9G78MJjOLATMzSr4FKpTvjeDpYpynuiBu+GA=; b=PS/fyHWzLBT1/zodXO4xLg84QbHysEnQVTc3dv5WCMuUobaxp6DjQ540et46Alwz6U u5YqcrE7lDRnJDFFQPDZk7+B8Vp6hDXnRyrXGUEzQCp1goLnuT+ys9Sh1vxhaWDW+82z 330ohDW3yPJiBQ11QXqp5A6seYVO0rSKK2CDCvGenxUPtIXmmEMTAZ4NX+F2BqEiMXl+ 3wlBvZuws+TG9TSYLdoxGBWWzLchUp7NE0mel+oO0ADhlz8jwZaLOdJR2f/f+y9lFwKI 4HlFdk/pYc2z70DywQwdpOj9mhF0lCT0S7Wk1VCVmTf9MJ2RruOrFzv6tR46qq4HxZ8f I9hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=bEMA3Fn9G78MJjOLATMzSr4FKpTvjeDpYpynuiBu+GA=; b=PH/neJql68A/7ZJ0Bdrc8erSkxKgUXVa8kP6d3RqJXRQtdx1WpB0v7E6lsZ8KaTHBB WURGn2G44I1oW5CfcCjdKsrinSz6BFN0/sMizWI6KC7XuH76SXQ6MQIWjlBzQrVMfchJ hBLvZfAq6c5TXyZVKdBow43yqVZDWRreuIkjULlerLF5bQcTfac0XuLv74iqBbeLwiwa M0o1UNR7QkT/fZ2BsukYvy6BeqgOA1s3ajDtSYOhhJcgmYKK0s5Q3EIYsKz06Ld4ftp7 g/M6VeEwicxx3TLoJaaSn1jLahV8CJ/rOwl5E9mBNaxZsSMtgisE2R7x8FGK4CGve/lP MtRA== X-Gm-Message-State: AOAM532ah2fzN3pwjJK1jI8U/pHJCRMREZP2801DGUly8PfxPr3eH2NS IfB+Y+mJWUGgmrZnwV+rsjQ= X-Received: by 2002:a62:1e82:0:b029:2f9:aad3:b368 with SMTP id e124-20020a621e820000b02902f9aad3b368mr17509192pfe.79.1624245529816; Sun, 20 Jun 2021 20:18:49 -0700 (PDT) Received: from [10.1.1.25] (222-152-189-137-fibre.sparkbb.co.nz. [222.152.189.137]) by smtp.gmail.com with ESMTPSA id x13sm13379004pjh.30.2021.06.20.20.18.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Jun 2021 20:18:49 -0700 (PDT) Subject: Re: [PATCH 1/2] alpha/ptrace: Record and handle the absence of switch_stack To: Linus Torvalds References: <87sg1p30a1.fsf@disp2133> <87pmwsytb3.fsf@disp2133> <87sg1lwhvm.fsf@disp2133> <6e47eff8-d0a4-8390-1222-e975bfbf3a65@gmail.com> <924ec53c-2fd9-2e1c-bbb1-3fda49809be4@gmail.com> <87eed4v2dc.fsf@disp2133> <5929e116-fa61-b211-342a-c706dcb834ca@gmail.com> <87fsxjorgs.fsf@disp2133> <87zgvqor7d.fsf_-_@disp2133> <87mtrpg47k.fsf@disp2133> <87pmwlek8d.fsf_-_@disp2133> <87k0mtek4n.fsf_-_@disp2133> <393c37de-5edf-effc-3d06-d7e63f34a317@gmail.com> Cc: "Eric W. Biederman" , linux-arch , Jens Axboe , Oleg Nesterov , Al Viro , Linux Kernel Mailing List , Richard Henderson , Ivan Kokshaysky , Matt Turner , alpha , Geert Uytterhoeven , linux-m68k , Arnd Bergmann , Ley Foon Tan , Tejun Heo , Kees Cook From: Michael Schmitz Message-ID: <60c0fe00-b966-6385-d348-f6dd45277113@gmail.com> Date: Mon, 21 Jun 2021 15:18:35 +1200 User-Agent: Mozilla/5.0 (X11; Linux ppc; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Linus, Am 21.06.2021 um 14:17 schrieb Linus Torvalds: > On Sun, Jun 20, 2021 at 7:01 PM Michael Schmitz wrote: >> >> instrumenting get_reg on m68k and using a similar patch to yours to warn >> when unsaved registers are accessed on the switch stack, I get a hit >> from getegid and getegid32, just by running a simple ptrace on ls. >> >> Going to wack those two moles now ... > > I don't see what's going on. Those system calls don't use the register > state, afaik. What's the call chain, exactly? This is what I get from WARN_ONCE: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 1177 at arch/m68k/kernel/ptrace.c:91 get_reg+0x90/0xb8 Modules linked in: CPU: 0 PID: 1177 Comm: strace Not tainted 5.13.0-rc1-atari-fpuemu-exitfix+ #1146 Stack from 014b7f04: 014b7f04 00336401 00336401 000278f0 0032c015 0000005b 00000005 0002795a 0032c015 0000005b 0000338c 00000009 00000000 00000000 ffffffe4 00000005 00000003 00000014 00000003 00000014 efc2b90c 0000338c 0032c015 0000005b 00000009 00000000 efc2b908 00912540 efc2b908 000034cc 00912540 00000005 00000000 efc2b908 00000003 00912540 8000110c c010b0a4 efc2b90c 0002d1d8 00912540 00000003 00000014 efc2b908 0000049a 00000014 efc2b908 800acaa8 Call Trace: [<000278f0>] __warn+0x9e/0xb4 [<0002795a>] warn_slowpath_fmt+0x54/0x62 [<0000338c>] get_reg+0x90/0xb8 [<0000338c>] get_reg+0x90/0xb8 [<000034cc>] arch_ptrace+0x7e/0x250 [<0002d1d8>] sys_ptrace+0x232/0x2f8 [<00002ab6>] syscall+0x8/0xc [<0000c00b>] lower+0x7/0x20 ---[ end trace ee4be53b94695793 ]--- Syscall numbers are actually 90 and 192 - sys_old_mmap and sys_mmap2 on m68k. Used the calculator on my Ubuntu desktop, that appears to be a little confused about hex to decimal conversions. I hope that makes more sense? Cheers, Michael > > Linus >