Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1605762yba; Sat, 27 Apr 2019 03:11:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5hbtCz0rsm7LrJ+M9Haxkhc+M15Rx2SjKpT9twVv+R42tjNlXDuhJv6q6FbpuMd+FFUPO X-Received: by 2002:a17:902:2bc9:: with SMTP id l67mr51574536plb.237.1556359866768; Sat, 27 Apr 2019 03:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556359866; cv=none; d=google.com; s=arc-20160816; b=Aq/62aiXn7c1DzvJJ7hMk6QaqxIvlG5YuPyXJQApi0pq8E+eKeo93S+dOiMTRNyi8Y ODpM2BYynRP9Nex53widzFJp1pfp12NWrLgQAx8uWTGrB3qGC/mW18etJ34oHCNKrX87 TLRwDICwC3h6zGgR/U76yf/4zpkBjwLHtvsZ50TFgxlb75/A7n3b0AsLtBCqaGdl+48+ 3MC4LGwM+YOS/cjbR5KcKZ2Nwd68A95QBVnJtrcGs3MpFl31XhYu7tLZQqDPdMGyejQK EA/yILWTRd965NcDYBzTFAyEYkymUXXWifVXHHLjXpTV1zmcKSCJQPR+Fjk0ry+TaIPe 5Tvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=ZChI6GtSSHF3O+cZsjf/v9jw40AD1ziduJgRVSTl/n0=; b=kc/QM9dVy/dSLhM1EfORTvyYreMZ1Oi1fEElVhuB5b4Lg2SdYhdATTNm7uR8uRWO3K Y+zvwLzY6G3n6opyw32zTepBzQKcNv2zs8ccfVBl6D89mjMcGKrZnTb2YAqJjCDQIaNR NvlPyxBXbNQ8bjSi8jdEYIKyHUvBOfpTymsxVBY9L8C8iOyl4/now2eMquFIoc11z9rO /y4XEDm44pevhI6Dd/xD46cQCWpXDQQ7Qi0Fa4oY0sg3FZ8T/rSZEisO4uu14EIrQ0ii nwgHj4mS8FBJu0jKo7Yur+hdRfzI8SILdpDZsCYfgGgw+JbBTJ6/28VtwEhv8MVZ8u3V NQLw== 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 r16si21705760pgv.503.2019.04.27.03.10.51; Sat, 27 Apr 2019 03:11:06 -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 S1726252AbfD0KHr (ORCPT + 99 others); Sat, 27 Apr 2019 06:07:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:51308 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725902AbfD0KHq (ORCPT ); Sat, 27 Apr 2019 06:07:46 -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 1C391ACBC; Sat, 27 Apr 2019 10:07:45 +0000 (UTC) From: Nicolai Stange To: Steven Rostedt Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , Shuah Khan , Konrad Rzeszutek Wilk , Tim Chen , Sebastian Andrzej Siewior , Mimi Zohar , Juergen Gross , Nick Desaulniers , Nayna Jain , Masahiro Yamada , Andy Lutomirski , Joerg Roedel , linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org, Nicolai Stange Subject: [PATCH 0/4] x86/ftrace: make ftrace_int3_handler() not to skip fops invocation Date: Sat, 27 Apr 2019 12:06:35 +0200 Message-Id: <20190427100639.15074-1-nstange@suse.de> X-Mailer: git-send-email 2.13.7 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, this series is the result of the discussion to the RFC patch found at [1]. The goal is to make x86' ftrace_int3_handler() not to simply skip over the trapping instruction as this is problematic in the context of the live patching consistency model. For details, c.f. the commit message of [3/4] ("x86/ftrace: make ftrace_int3_handler() not to skip fops invocation"). Everything is based on v5.1-rc6, please let me know in case you want me to rebase on somehing else. For x86_64, the live patching selftest added in [4/4] succeeds with this series applied and fails without it. On 32 bits I only compile-tested. checkpatch reports warnings about - an overlong line in assembly -- I chose to ignore that - MAINTAINERS perhaps needing updates due to the new files arch/x86/kernel/ftrace_int3_stubs.S and tools/testing/selftests/livepatch/test-livepatch-vs-ftrace.sh. As the existing arch/x86/kernel/ftrace_{32,64}.S haven't got an explicit entry either, this one is probably Ok? The selftest definitely is. Changes to the RFC patch: - s/trampoline/stub/ to avoid confusion with the ftrace_ops' trampolines, - use a fixed size stack kept in struct thread_info for passing the (adjusted) ->ip values from ftrace_int3_handler() to the stubs, - provide one stub for each of the two possible jump targets and hardcode those, - add the live patching selftest. Thanks, Nicolai Nicolai Stange (4): x86/thread_info: introduce ->ftrace_int3_stack member ftrace: drop 'static' qualifier from ftrace_ops_list_func() x86/ftrace: make ftrace_int3_handler() not to skip fops invocation selftests/livepatch: add "ftrace a live patched function" test arch/x86/include/asm/thread_info.h | 11 +++ arch/x86/kernel/Makefile | 1 + arch/x86/kernel/asm-offsets.c | 8 +++ arch/x86/kernel/ftrace.c | 79 +++++++++++++++++++--- arch/x86/kernel/ftrace_int3_stubs.S | 61 +++++++++++++++++ kernel/trace/ftrace.c | 8 +-- tools/testing/selftests/livepatch/Makefile | 3 +- .../livepatch/test-livepatch-vs-ftrace.sh | 44 ++++++++++++ 8 files changed, 199 insertions(+), 16 deletions(-) create mode 100644 arch/x86/kernel/ftrace_int3_stubs.S create mode 100755 tools/testing/selftests/livepatch/test-livepatch-vs-ftrace.sh -- 2.13.7