Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2909613iog; Mon, 27 Jun 2022 05:34:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ua71mu+mmoYiwAK+XNBDIbHanJUNA/4NNlsCm8aqNzDT53XMRcGtLtqIwsRlrnoZR3KlDu X-Received: by 2002:a17:906:296a:b0:723:5321:f4e3 with SMTP id x10-20020a170906296a00b007235321f4e3mr12993381ejd.620.1656333258101; Mon, 27 Jun 2022 05:34:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333258; cv=none; d=google.com; s=arc-20160816; b=er+cYd1JxNdYRIi5dOHPjqC3zvv8e4ZC7aEZ2XJFNPE1vEVGP+UcDPp+USojvNbIX9 YN7ATQtpYROoIOGnfupVjpe/gYt4H5s1d5QDWlnFGQYUIigAT0j51AYUhizeVbLmg64s MbrIwnwoCLO3Hz0BeEG0+KRI66ZhZXvb2NOm9tgdWt71npj+VwjGDNurwq9+45a+DZJX QKFpqwmNrk52qsz/PzQrPR2zzua/qPxq2WujV7+Rp6viGRO7TIowyFpfs+wuha4mGK/Y GIFxIdUGgTBLlqZnMJ322J1eVIR//s+4yh2dYeCNhnRUZSI5m+9h6Lt2YGlqvgiZ5fdl MhOA== 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=92lD8eeCytwWSjIRNk93w9VcaRfxTLq3Pl3/R6CAWKE=; b=NAdi885yaHgqXp77AXyCiALdfILHEuFvQf89XUntQBUM2/kOLekOEpPUg4fa4vXp6+ yqbk6UZBJhzx3djpZQku7lk7VhFn5dSS4B/SL0Tx0djtnZBpqolwDojSEHsU3QREUn4a ETPAjqhg5ZXdEHu/mGjeChNoHYnj16aOVnNqb4lr7SxZXW9C6ElsBVT8FsuJQTZhdC3E WR6wjvlJzYD2VQ20IwmAQ7Jqmm0yQgOg0LLJq+DFEWtDXhoUJ4S25QrVD3VYc/UtOkBD 8D5R1g5xVDg2/bIXScSVaCYsZhpF2oc5t/VwNbI/D50DMvbUCyfXKcTCGQ4VP0V5Y9mu 1h2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ug8OhEzo; 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 sa7-20020a1709076d0700b00722e49d52c1si9200349ejc.564.2022.06.27.05.33.52; Mon, 27 Jun 2022 05:34:18 -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=ug8OhEzo; 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 S236032AbiF0LfN (ORCPT + 99 others); Mon, 27 Jun 2022 07:35:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236293AbiF0Lde (ORCPT ); Mon, 27 Jun 2022 07:33:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 755BEB07; Mon, 27 Jun 2022 04:30:50 -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 ams.source.kernel.org (Postfix) with ESMTPS id 12B8CB8111B; Mon, 27 Jun 2022 11:30:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6723BC3411D; Mon, 27 Jun 2022 11:30:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656329447; bh=cIyAScn2AhewLmNAPu3c6ZTbqfpYL2Q2tu+IGjIzypI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ug8OhEzoENU3oxBRayE4+c5iQoCQ4kPWx9VC1DoK0DpZ4/pD/hpwDGFWOg0NcriOY 8+Jk/EZMQ3UWKURjGhxWceMna1akm1mg73Cjoqz2zL4z/wUU7PfjXOSOeTHEkZY3ET 55QRB12EwsUf0it6xVp20yKSW9h2seg3Su73jbEQ= 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.4 49/60] powerpc: Enable execve syscall exit tracepoint Date: Mon, 27 Jun 2022 13:22:00 +0200 Message-Id: <20220627111929.133760521@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111927.641837068@linuxfoundation.org> References: <20220627111927.641837068@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 @@ -1719,7 +1719,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;