Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2907808iog; Mon, 27 Jun 2022 05:32:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v08WfxeAbrjihnFB2SHMT36f+IYR/lnZnFWLoIsD0N5EUo+CaiBfgere872UQQZlWusMFG X-Received: by 2002:a17:902:f7d3:b0:16a:208e:b2c4 with SMTP id h19-20020a170902f7d300b0016a208eb2c4mr14098400plw.64.1656333154345; Mon, 27 Jun 2022 05:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333154; cv=none; d=google.com; s=arc-20160816; b=N6SSLZm9FGgfYBXuxNpnWcXQ44p1uIMQBng1s19ZDhAXnrVeUr9iXjdd3rFmGIUp4T lu9QyFfcOSKyFBHY9Wa1p6qcdwd1WZJgJ4ON90Yg0Gy18uU5JobGO9+WWbA8OJgLzm8d mpl8TfwAtuW8Vhn8gvvDGqA6/+w9peHVVtAJMRMyyhVWhcvD0sWWyYG7FSMgnEm93q0w XGw06+wCdtaulJFi/vmEGvRF79mIvM7dFsUUN5O+wk4SNDahmgPfThGLwqpUBHv4EFe1 b+11rOvMA7q9/HNykV5IFfzj7pP9nmYha2FQWZ+qyAJgiq3zYdi6ejueaqWiTaDWSwV3 vBzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=x8lJJIkX0Uy76+TbKnKC2EZZbXlXk7eO1vSEhCjTg5k=; b=qNWq48ijFm2QcZ5+8Doh0wp9jgCuZ/CYfYqe+JvmahLXDzqgTAHSXQTk3Vec4Y2vi7 b5qUnEoEjAr7FvyBovJl+mngnM4e+JU/17wngMQQkVEUmOKKkgU6+9jN6FqGsStMtICf vi1DDuqwws+8snef0ng0kgzScDEKa3v3K1cGT1/4IfjnKhj1k3n1yQm8D/wYUbej8aNk 44WmJgY4dI/pfLg1S94jO2ovVeQj/Dxq+Oh/2E1+5qGzEFiM09SlXQUmWAVfUYF3RsBr lJ8G5vX7PegVhK7WGDVnr5wURk3v4SieQDMQYM1m0TJwqkEwc4GTdbno3WzjlMbcAzFS MH0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NJ3JpXMm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j12-20020a170903024c00b0016793c0c85bsi15708606plh.311.2022.06.27.05.32.22; Mon, 27 Jun 2022 05:32:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NJ3JpXMm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235418AbiF0L3w (ORCPT + 99 others); Mon, 27 Jun 2022 07:29:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235174AbiF0L3E (ORCPT ); Mon, 27 Jun 2022 07:29:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09F7A65C1; Mon, 27 Jun 2022 04:27:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A189612D8; Mon, 27 Jun 2022 11:27:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA88DC341C7; Mon, 27 Jun 2022 11:27:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656329270; bh=BNIPZ8C8PSW/ggTgnvB3lSNdhO/8RHhYOUOMKuVbyhs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NJ3JpXMmiR3ZUXh+FOGj81jXZ+oiTH7kgD1DJspO+G+taYnF3JAC/Ez9a41U0WsDZ ipbbT+2VoZNqrM0KX721kfU7bSROU1M+1ZeXn9YOkR+Sfxv3AUOH8Lr9YlG/vkHMmp mmfcamnUKWjop8jZ4rocboFhfPFeu4fzyxoIWrMs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Naveen N. Rao" , Sumit Dubey2 , Michael Ellerman Subject: [PATCH 5.10 089/102] powerpc: Enable execve syscall exit tracepoint Date: Mon, 27 Jun 2022 13:21:40 +0200 Message-Id: <20220627111936.106030381@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111933.455024953@linuxfoundation.org> References: <20220627111933.455024953@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Naveen N. Rao commit ec6d0dde71d760aa60316f8d1c9a1b0d99213529 upstream. On execve[at], we are zero'ing out most of the thread register state including gpr[0], which contains the syscall number. Due to this, we fail to trigger the syscall exit tracepoint properly. Fix this by retaining gpr[0] in the thread register state. Before this patch: # tail /sys/kernel/debug/tracing/trace cat-123 [000] ..... 61.449351: sys_execve(filename: 7fffa6b23448, argv: 7fffa6b233e0, envp: 7fffa6b233f8) cat-124 [000] ..... 62.428481: sys_execve(filename: 7fffa6b23448, argv: 7fffa6b233e0, envp: 7fffa6b233f8) echo-125 [000] ..... 65.813702: sys_execve(filename: 7fffa6b23378, argv: 7fffa6b233a0, envp: 7fffa6b233b0) echo-125 [000] ..... 65.822214: sys_execveat(fd: 0, filename: 1009ac48, argv: 7ffff65d0c98, envp: 7ffff65d0ca8, flags: 0) After this patch: # tail /sys/kernel/debug/tracing/trace cat-127 [000] ..... 100.416262: sys_execve(filename: 7fffa41b3448, argv: 7fffa41b33e0, envp: 7fffa41b33f8) cat-127 [000] ..... 100.418203: sys_execve -> 0x0 echo-128 [000] ..... 103.873968: sys_execve(filename: 7fffa41b3378, argv: 7fffa41b33a0, envp: 7fffa41b33b0) echo-128 [000] ..... 103.875102: sys_execve -> 0x0 echo-128 [000] ..... 103.882097: sys_execveat(fd: 0, filename: 1009ac48, argv: 7fffd10d2148, envp: 7fffd10d2158, flags: 0) echo-128 [000] ..... 103.883225: sys_execveat -> 0x0 Cc: stable@vger.kernel.org Signed-off-by: Naveen N. Rao Tested-by: Sumit Dubey2 Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220609103328.41306-1-naveen.n.rao@linux.vnet.ibm.com Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -1800,7 +1800,7 @@ void start_thread(struct pt_regs *regs, tm_reclaim_current(0); #endif - memset(regs->gpr, 0, sizeof(regs->gpr)); + memset(®s->gpr[1], 0, sizeof(regs->gpr) - sizeof(regs->gpr[0])); regs->ctr = 0; regs->link = 0; regs->xer = 0;