Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4473036ybg; Tue, 29 Oct 2019 07:42:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqzSeu52NM3bb+ZEI/JA990ejI6pvSGg3hI3TtV+FVSMxTb2ImaVXaR1IhrX3isM1VQ9nDPO X-Received: by 2002:a17:906:1e55:: with SMTP id i21mr3746976ejj.47.1572360130904; Tue, 29 Oct 2019 07:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572360130; cv=none; d=google.com; s=arc-20160816; b=dm/1C332RDEuwCPJsY4g3wYpKRguQLFERFPn6KQIOetlu6lx5/dLfiH19GXY372ywW q98epCyAi3ZlOjETRw4SYG46bZgGXygovH1vrhVKggAgbXOPvu4XdYXhvxlBGC5wH8Yd gkaQr54ZSJQ65fflq+mEvT6+LpPS9C8+ACG5usnKBdL2VifEDre08xQojS4QNn9qZQPc 7rWc+ewb4DwRjjgJZQsoXwBFTw+LUgGSFVGlmYu2LtNZUmOK03tvJDaKey3J1P9q6YpH IzALn2bTb1JYM4zrizciA8iTI7BWtMcgtKfUxM1UelswBD++5M9mdUpd6fQZfV9szXce YQwg== 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 :message-id:date:subject:cc:to:from; bh=1dgfbhE/PxuQnRYszK/Y/wVXLr+4cmf4rmnH7zMiFTs=; b=FZFBte3LR4JmGJHAsO2tQ2sQJYXfvPxEFUFlvSuZFbL57AZbpyK4TVXpmMphoAmdo7 rCWI2eXKn5PhhdX7adqiuBWE4dye3AehY5UuUq3OuOR81lo86u+VBsZwJEiQ6QZJzmmi JzjhupoGwVOMqb2R5+wu9etSdLXZsKN07Gl/AWBxJVc3oNLRfKu48RPqjOupOTNkZ+rz hvyJkWZ5F8rVnHkc+iIPw20IAKPoJPRxrzzY36TGW3y4NMrGvndNzeY6QwolqGCz8gdE mHD5kTDAU4VVTYx0O8ecg1z72W2Z7p6g6uhTXoG7MjuHLYizfVVLZ0NcYfs3IkwxmSaz XOXw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pw18si5637618ejb.252.2019.10.29.07.41.46; Tue, 29 Oct 2019 07:42:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389488AbfJ2OjS (ORCPT + 99 others); Tue, 29 Oct 2019 10:39:18 -0400 Received: from mx2.suse.de ([195.135.220.15]:54584 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388885AbfJ2OjI (ORCPT ); Tue, 29 Oct 2019 10:39:08 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7CB12B29A; Tue, 29 Oct 2019 14:39:06 +0000 (UTC) From: Miroslav Benes To: heiko.carstens@de.ibm.com, gor@linux.ibm.com, borntraeger@de.ibm.com, jpoimboe@redhat.com, joe.lawrence@redhat.com Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, jikos@kernel.org, pmladek@suse.com, nstange@suse.de, live-patching@vger.kernel.org, Miroslav Benes Subject: [PATCH v2 0/3] s390/livepatch: Implement reliable stack tracing for the consistency model Date: Tue, 29 Oct 2019 15:39:01 +0100 Message-Id: <20191029143904.24051-1-mbenes@suse.cz> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The livepatch consistency model requires reliable stack tracing architecture support in order to work properly. In order to achieve this, two main issues have to be solved. First, reliable and consistent call chain backtracing has to be ensured. Second, the unwinder needs to be able to detect stack corruptions and return errors. The former should be guaranteed (see 3/3 for details), the latter is implemented by the patch set (mainly 3/3). It passes livepatch kselftests (with timeout disabled, see https://lore.kernel.org/live-patching/20191025115041.23186-1-mbenes@suse.cz/) and tests from https://github.com/lpechacek/qa_test_klp. Changes since v1 and questions follow: - rebased on top of v5.4-rc5. It also meant rebasing on top of ARCH_STACKWALK, which made the outcome nicer and addressed some of Joe's remarks. - sp alignment is checked in both _start and _next_frame cases - ftrace_graph_ret_addr() calling cleanup - I tried to use the existing infrastructure as much as possible with one exception. I kept unwind_next_frame_reliable() next to the ordinary unwind_next_frame(). I did not come up with a nice solution how to integrate it. The reliable unwinding is executed on a task stack only, which leads to a nice simplification. My integration attempts only obfuscated the existing unwind_next_frame() which is already not easy to read. Ideas are definitely welcome. - although not nice (Josh mentioned it in his review), I kept checking for kretprobe_trampoline in the main loop. It could go into _start and _next_frame callbacks, but more changes would be required (changing a function return type, ordinary unwinding does not need it). So I did not think it was worth it. I could change it in v3, of course. Miroslav Benes (3): s390/unwind: drop unnecessary code around calling ftrace_graph_ret_addr() s390/unwind: prepare the unwinding interface for reliable stack traces s390/livepatch: Implement reliable stack tracing for the consistency model arch/s390/Kconfig | 1 + arch/s390/include/asm/stacktrace.h | 3 +- arch/s390/include/asm/unwind.h | 15 +++--- arch/s390/kernel/dumpstack.c | 16 +++++- arch/s390/kernel/perf_event.c | 2 +- arch/s390/kernel/stacktrace.c | 48 +++++++++++++++++- arch/s390/kernel/unwind_bc.c | 79 ++++++++++++++++++++++++------ arch/s390/oprofile/init.c | 2 +- 8 files changed, 139 insertions(+), 27 deletions(-) -- 2.23.0