Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3420321pxj; Sun, 20 Jun 2021 20:46:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqZxWJAbqNiVATCBT+kqoATzHEJdtLA1yPsqsdXuP6GNr55C4ztcV11AHcbaOTjaprbVIf X-Received: by 2002:a05:6402:4395:: with SMTP id o21mr18927117edc.163.1624247163729; Sun, 20 Jun 2021 20:46:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624247163; cv=none; d=google.com; s=arc-20160816; b=UpKUOc68MlUPQp3cDwH/yeXyVaic3WHjvwYo/igGM51HoE2lvqjlMHMUxNI4/GIw9i 5UfEoArmFVTGl7RrfgWCLSXoJYoTKdj8ld+ZIM5uI9EiOWb1Pkmd9EP2E4+BaZdkztg6 l4UZrUB/3wr2x+vMKdhZZ0p5sitXSEkia9l4IJo3j5zbivyzJQ6NSutZy/pNXT6wB0Dt 2amuRVhTJMRxGV9w2BQPRWpwT7RbSHkTRct0iqVEhEIhHr0gWKgzlk279MXvMUTKlEQT FB01U2BV1Cl3+oc4z3bPquLNMVEbY6AGCHRSX0INPpuT+1snMS4L34CaCERrEX7XqRln 4WpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1+HtUJLugMh1gE/Pq8w2A+iKsdZnPrpQbbhzWMAu6G8=; b=cRCuasvZxl9q0x1a0HoTOcMKUyIbB28VHOTe3mswh/BrOzev9Tx1D1zLPiHik+DpHk WBQiqMsmbqe9VVxcnswN4/ndocKkzSuzNF8GABKu64BsUGtvqwz/fUHXEsM5ryqTQHX+ kC3BVXsQ+Z3FSIJKCJx9GUZWTczEGOlcHFjCpuS8sHs19btc29rTuRiYx03n6yCbl+3e Tmvz2MJBiz/wAx4sBIjvCC4y+8qxcEFCOn92eaZLLguh/0zJqD+1cosdiR/TvPXTY+FS CIy21CcPt/L8Xw1iDRcOt6DSLMw4cBFz1SnEwSRh/PzSBTljj4qhMeJQcoAdy4n9G4/L KjgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=CguqVrwf; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j17si14702698edw.429.2021.06.20.20.45.39; Sun, 20 Jun 2021 20:46:03 -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=@linux-foundation.org header.s=google header.b=CguqVrwf; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230047AbhFUDqC (ORCPT + 99 others); Sun, 20 Jun 2021 23:46:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229905AbhFUDqB (ORCPT ); Sun, 20 Jun 2021 23:46:01 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2993C061756 for ; Sun, 20 Jun 2021 20:43:46 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id m21so27716798lfg.13 for ; Sun, 20 Jun 2021 20:43:46 -0700 (PDT) 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=1+HtUJLugMh1gE/Pq8w2A+iKsdZnPrpQbbhzWMAu6G8=; b=CguqVrwfLz3sZcjWNSP9u4srUE9fQXJpZYNDvur7BjH1Wa9iE+6JLPbb6gu1bHRbzP lhuXpf4aJ6FAM06cgPcFG8165A9ru2Rghgmk3cWS8VmtaMrnFl6vfe5YF+lxxVFXRiLZ rAtq4O0Gb8NYZTtOP3OEjIKCqz0zBbzRqM0Fw= 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=1+HtUJLugMh1gE/Pq8w2A+iKsdZnPrpQbbhzWMAu6G8=; b=eothFMAExWEP0t2MXOnrUdCgPqhlXBKMckkF0RK+C532c1BgSL+74JKlkUkNUJRo1w 1A/LOaxPkAmkP09+/SnOHpVTCtwZ1Q9d6zJvlesk+xkzPC4RFkSIddbcAUsWoy/rFFpC 7z+S9D5S5eO835XFFjz1TemLAulu8YwmLqpS2OeJvCh6DEMJEPse97LjJIQpOrWBEtm3 p0ipJ5idVK1lZ6iTDBXwqe7Ah/KSFvM/jJSkWTMoBs+KusQP2KzXbyyA9HQ21Nmu3BGk CnYPWwcdSMksrCxKV5PGan5ZAKauNwWm9F9obnAxhzpPUlkh2imApm2S+elMah/7HdgN eKRQ== X-Gm-Message-State: AOAM53235Fo2lmjUxFHxQRTrIIUdz4IpiheIPV9Kckzugqp8YKZqCYLe pSyt/CSJx/h1ptOiuse8nABCPDW/f7ZoR+Ia X-Received: by 2002:a19:2d1e:: with SMTP id k30mr12338672lfj.245.1624247025102; Sun, 20 Jun 2021 20:43:45 -0700 (PDT) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com. [209.85.167.54]) by smtp.gmail.com with ESMTPSA id r25sm1720868lfg.246.2021.06.20.20.43.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 20 Jun 2021 20:43:45 -0700 (PDT) Received: by mail-lf1-f54.google.com with SMTP id t17so7550782lfq.0 for ; Sun, 20 Jun 2021 20:43:44 -0700 (PDT) X-Received: by 2002:a2e:9ad5:: with SMTP id p21mr20479953ljj.220.1624246658595; Sun, 20 Jun 2021 20:37:38 -0700 (PDT) MIME-Version: 1.0 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> <60c0fe00-b966-6385-d348-f6dd45277113@gmail.com> In-Reply-To: <60c0fe00-b966-6385-d348-f6dd45277113@gmail.com> From: Linus Torvalds Date: Sun, 20 Jun 2021 20:37:22 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] alpha/ptrace: Record and handle the absence of switch_stack To: Michael Schmitz 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 20, 2021 at 8:18 PM Michael Schmitz wrote: > > I hope that makes more sense? So the problem is in your debug patch: you don't set that TIS_SWITCH_STACK in nearly enough places. In this particular example, I think it's that you don't set it in do_trace_exit, so when you strace the process, the system call exit - which is where the return value will be picked up - gets that warning. You did set TIS_SWITCH_STACK on trace_entry, but then it's cleared again during the system call, and not set at the trace_exit path. Oddly, your debug patch also _clears_ it on the exit path, but it doesn't set it when do_trace_exit does the SAVE_SWITCH_STACK. You oddly also set it for __sys_exit, but not all the other special system calls that also do that SAVE_SWITCH_STACK. Really, pretty much every single case of SAVE_SWITCH_STACK would need to set it. Not just do_trace_enter/exit It's why I didn't like Eric's debug patch either. It's quite expensive to do, partly because you look up that curptr thing. All very nasty. It would be *much* better to make the flag be part of the stack frame, but sadly at least on alpha we had exported the format of that stack frame to user space. Anyway, I think these debug patches are not just expensive but the m68k one most definitely is also very incomplete. Linus