Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2915826iog; Mon, 27 Jun 2022 05:42:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tzw07Aeqc9w8zk1wEu6j29bdSp8nMVWurQx9+wMZNZH3ZHuheP3rDh21tMZnJn6CQ0b6Rm X-Received: by 2002:a17:903:2452:b0:16a:38f9:ade9 with SMTP id l18-20020a170903245200b0016a38f9ade9mr14204466pls.152.1656333770294; Mon, 27 Jun 2022 05:42:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333770; cv=none; d=google.com; s=arc-20160816; b=Pj/jwTxs6RHK6120gHt3ZCXC60iHByjf6SdA6DmPLW1r1erMdOUOHV9Wk63p60Cy5r v5c4qHSjYASARfSCWy3b/MN5HA6rPp9hPcH6pq4EdAbiZRtJS0KYsCHKUZIuMOUsIkmt YxyqTDeiQ2CZDyLAuY3PQ2lFPXhBn3o7dz0RT24yAMxSsZvjnBebVZh8xTQDOfs6AUrf l2E/uk1Ua6mkFB4sLFKGgTSnDJSRM3wFVpl5blFyIw2BO29YihOAMfMPBpORLBaW49jh eO3FgWEbFj+YlxFczbTU420uyMlqtUfGgQoVvY+X9BTgtiuZB//hDHfO7NGVaVRzr28F 6HjQ== 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=Bgkyf3scaFVhGzqCPc8bK8VLzHTTFZ+1BgM4kyeLAuQ=; b=Kf+L5sts1oQndpYc2foXOMNAXfIO8FbrPge2ho3lpk4OP/1q3k+5bjYVRtKlm4Rbbf xUt56Un7h04O5DEtPCpba7DX+CxLhuTFEyjSJ+inUvfzTdWL3Nm3Lk2w3MiL6KwYQNAh LrMghUF2RNEYZ/f9Pz9GnMRuo+Pxl+3XzUWZM092E+ujYH4A0u0WFEIZvJYNsy7ctMM/ ktnn5scKYu8wCRTrIvXo1uaSzaJRpOx1h/CDNbe5EpJX6SHnsTteNN5Uo/2wV/3BUXKx S0IpKRXcmgvX8p/HClDkJU56Ivm+O63rbXwUZLh0qMfyoHGswqf2gIh6NPLUplvFSFX5 0qpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0w3rppQF; 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 d3-20020a056a00244300b0052516019e31si15595970pfj.229.2022.06.27.05.42.37; Mon, 27 Jun 2022 05:42:50 -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=0w3rppQF; 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 S239283AbiF0L7Y (ORCPT + 99 others); Mon, 27 Jun 2022 07:59:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238729AbiF0Lwc (ORCPT ); Mon, 27 Jun 2022 07:52:32 -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 DEC25B860; Mon, 27 Jun 2022 04:45:21 -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 7B6D261274; Mon, 27 Jun 2022 11:45:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A73AC3411D; Mon, 27 Jun 2022 11:45:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656330320; bh=Ql+QXgkstFkoJAd2h3UmyPFTWmOZQiAPPYRobKxL5GY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0w3rppQFE1tHjN6LJ7THcvuHUKJvCiGLfOYhEaXvgYMRjS3qynODAIozvAGCSa3AJ wc82DsbA09Su2QmFgqEvu4jY9JAaXLOEEd4YT+H9tl+B4H4CM2tGOca1fuGESHnKc2 ypWWFZ4V0JepRIjpYe+PVMv25YHgzAl6UhRrMVT0= 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.18 158/181] powerpc: Enable execve syscall exit tracepoint Date: Mon, 27 Jun 2022 13:22:11 +0200 Message-Id: <20220627111949.266775150@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111944.553492442@linuxfoundation.org> References: <20220627111944.553492442@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 @@ -1857,7 +1857,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;