Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp948301imd; Thu, 1 Nov 2018 08:02:45 -0700 (PDT) X-Google-Smtp-Source: AJdET5dHFrnbX6wkjxdAHVYVDqEuMXvgIRMoc4DVuMglGVcsLe0EfMje/QZ1kIEoGI/b2FrABaSW X-Received: by 2002:a17:902:e193:: with SMTP id cd19-v6mr7933621plb.262.1541084565290; Thu, 01 Nov 2018 08:02:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541084565; cv=none; d=google.com; s=arc-20160816; b=runZTyj3oLoMHcHrnLUmCPsOUe81TLScWr0gfN9Q55Pqw5ESYyOLjA8W3fmJfrpcyI s8OaOei1SEn01b4/WoBeixu128rOjpNI7mT7Vs+w3hhjiBLWOKT7ynF50BJXhdNXu9Vy 4UR5+knEfYyoGnEGx/LoN/F/ATEQVa8NN93Jj4k1I4AtavgdIpFyFdcnX1Mv7+VIII+F 79bhSObJkEFzbKfz5eZurhCJrworvQ2EdOvfxMj4yVNjJ4M5C6Wz5Xyu0tIYzJlQ6nWI P0YBR57mDMRx+WSGbdX4NFCXvDgsyBm0cM2LQGs72FEQ2wD3lKHuUpsobemYfbGpcuWs HiYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=sTDfURA/tqxjt0BBe5YYsXv6HjrQ2tsmhyGtpXDeCBQ=; b=VlxfOq63Z93H0NOkSyWTJu3Zt/PrUIRXD2UCQ/mqYKtYAMUUoeXvOoCtmEk5oWRRKN 1D1/hx3iPRpE3zcRuhecXojYiCXrLI51MU1jeTvUqzDosqCiVVCLK42ExwlG90T35dtY LQb1Vlap8UkEjqe6G63EBXRG4iGWBl7WgQ3uOmdahaSdMv0q5ItiIB+LT+f9s22cJjop a427nlD57RK0TsFIJ8XV2/02cTY2mkzAN7oD+FCoCSZbCAWS2Cc0GzalWWUSlPYG+DMK e5F5eOAof7zZd2geDszPRMhXZfFxWA2TaRvAzjsM7OYk076wZMMdqyEWFW8+MfnqqFPg FjHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uspwl2m4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11-v6si6730865plg.300.2018.11.01.08.02.29; Thu, 01 Nov 2018 08:02:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uspwl2m4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728829AbeKBAFV (ORCPT + 99 others); Thu, 1 Nov 2018 20:05:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:37832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728440AbeKBAFU (ORCPT ); Thu, 1 Nov 2018 20:05:20 -0400 Received: from devbox (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 60C912064C; Thu, 1 Nov 2018 15:01:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541084520; bh=KGl9or9EVnZdYg5a/ggsiGlZuUnpSi830BiYPxcIsgY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=uspwl2m4rTmykYyyIp8m8TSaL6KB1lapXqzI+K1AbqWbq0KgIt8dLniDu8+/nFknf dgNyzWYyWtJKeCSXU29ifX3dhh/Mf5XtJnt/VDlTZ+lgYa5OuVQRzjpXepeht6pDML mzUo8p8WjY9y/Z7kdYgnULlpxqnmM7TvjBAKEy8w= Date: Fri, 2 Nov 2018 00:01:56 +0900 From: Masami Hiramatsu To: Aleksa Sarai Cc: Steven Rostedt , "Naveen N. Rao" , Anil S Keshavamurthy , "David S. Miller" , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Brendan Gregg , Christian Brauner , Aleksa Sarai , linux-kernel@vger.kernel.org Subject: Re: [PATCH] kretprobe: produce sane stack traces Message-Id: <20181102000156.21304d571e756352b36d2bf2@kernel.org> In-Reply-To: <20181101104948.bc7wk453bfryhhk7@yavin> References: <20181026132210.12569-1-cyphar@cyphar.com> <20181030101206.2e5998ca3c75496c91ba5b09@kernel.org> <20181031090317.4e211fdd@vmware.local.home> <20181031133912.3j5tryq2vyhkdn4d@yavin> <20181101191347.74eadff4a5d1fab2d79d7efe@kernel.org> <20181101104948.bc7wk453bfryhhk7@yavin> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 1 Nov 2018 21:49:48 +1100 Aleksa Sarai wrote: > On 2018-11-01, Masami Hiramatsu wrote: > > > > > Anyway, until that merge happens, this patch looks good to avoid > > > > > this issue for generic solution (e.g. for the arch which doesn't > > > > > supports retstack). > > > > > > > > I think its time to come up with an algorithm that makes function graph > > > > work with multiple users, and have kretprobes be able to hook into it > > > > just like kprobes hooks into function tracer. > > > > > > > > I have some ideas on how to get this done, and will try to have an RFC > > > > patch set ready by plumbers. > > > > > > Should I continue working on this patchset? > > > > Yes, until we finally introduce Steven's algorithm on all arch (yeah, we still > > have some archs which don't support graph-tracer but supports kprobes), > > I think your patch is the best fix for this issue. > > Thanks, I just sent a v3. > > Though, even with Steven's hooking of kprobes I think you'd still need > to stash away the stack trace somewhere (or am I misunderstanding the > proposal?). Wait, I might miss something. kretprobe and func-graph tracer just swap the return address on the stack but no change on other stuffs on the stack. In that case, if we can restore the stack, isn't it enough? And anyway, even if using func-graph tracer, stack unwinding works correctly. I thought it means we don't need to backup whole the stack, doesn't it? Thank you, -- Masami Hiramatsu