Received: by 10.192.165.156 with SMTP id m28csp573680imm; Mon, 16 Apr 2018 05:26:49 -0700 (PDT) X-Google-Smtp-Source: AIpwx49suCyninVmf1HIKCXJYYo18x6LkdYb/7KXW9DxkzcVd4/Iq4DO2Mq4zpie8xjFb1sataX8 X-Received: by 2002:a17:902:3041:: with SMTP id u59-v6mr15145440plb.208.1523881609219; Mon, 16 Apr 2018 05:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523881609; cv=none; d=google.com; s=arc-20160816; b=M0kel+6TZJaTwDG2olBaBNst9Hb+7JAWS7wZAUP1WeiX3ETdadtAdpN1/KWqDiU6yk E4Vyeh43aU/AtUKeZU8bbInahUbkf1wup90Yyhq1Qd3FCk3SJSFqLuaQ/RUDZbyXAEFQ 5AfO7Z9WyyB92WSL14QId+d74aJZB0NTHun8XcByrtxTlxKsl/RWlm4dgTyeXZDICUSV KU7Z05oRc5MHamkJ6aHCq3PmyZohJx0VoBEo9C4zmdj2fqe//ZWyIEYe+2rsKhYQ24+J 45rfrz9/na8Oc+0/UYdXQJEOLapVEmwJxXRRcypk69A9Ww/u81FyPFcFqB46oZN0CyuH vkgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=fbpeNPk9jvU7rpgZCvhErUyftesqVnOXp84ZwomuEKM=; b=BZKpboZGWO1rHLkYlBN2z+zpljNb4VkGiB/TO/xkEiLgMahwLEU23o2YbxpqVXCVNm bc8EuPvznaR6wEn7VrjTTfzDh8zoywAZCAhmwt6QxF36rb9nuhDIKB1FskthU3M5E+fd vyW98ayU0aKYnHMVMOjerkdRXcHBMPs/oJ2aDmw44B8TABbfLuqWgSkoAyoyYBMBnGS/ 1UPEsodc18ycv7cyps+KYHQ1ZjtQOegbU1g4wTMS6f/05D+eD/brw89QewqSF79/VpS6 OcLSzONGnI13Bl3afowaHhehk5pXbHjhRtku0RKGexXMH1QoXtLLJ/JdWcp4t81MZei9 XpOQ== 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 b31-v6si12444969plb.111.2018.04.16.05.26.34; Mon, 16 Apr 2018 05:26:49 -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 S1753220AbeDPLd7 (ORCPT + 99 others); Mon, 16 Apr 2018 07:33:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:36473 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750946AbeDPLd5 (ORCPT ); Mon, 16 Apr 2018 07:33:57 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D34A0AF05; Mon, 16 Apr 2018 11:33:55 +0000 (UTC) Date: Mon, 16 Apr 2018 13:33:55 +0200 (CEST) From: Miroslav Benes To: Joe Lawrence cc: live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Kosina , Josh Poimboeuf , Petr Mladek , =?ISO-8859-2?Q?Libor_Pech=E1=E8ek?= , Nicolai Stange , Artem Savkov Subject: Re: [PATCH v3] selftests/livepatch: introduce tests In-Reply-To: Message-ID: References: <1523544871-29444-1-git-send-email-joe.lawrence@redhat.com> <1523544871-29444-2-git-send-email-joe.lawrence@redhat.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 13 Apr 2018, Joe Lawrence wrote: > On 04/13/2018 07:20 AM, Miroslav Benes wrote: > > Hi, > > > > On Thu, 12 Apr 2018, Joe Lawrence wrote: > > > >> Add a few livepatch modules and simple target modules that the included > >> regression suite can run tests against. > > > > Could you include a brief description which features are tested? > > I can add this to the commit msg: > > - basic livepatching (multiple patches, atomic replace) > - pre/post (un)patch callbacks > - shadow variable API > > Or do you prefer a little more detail? That would suffice. Thanks. > > > >> Signed-off-by: Joe Lawrence > >> --- > > > >> diff --git a/lib/livepatch/test_klp_shadow_vars.c b/lib/livepatch/test_klp_shadow_vars.c > >> new file mode 100644 > >> index 000000000000..18c75b21cb9e > >> --- /dev/null > >> +++ b/lib/livepatch/test_klp_shadow_vars.c > >> > >> +/* > >> + * Shadow variable wrapper functions that echo the function and arguments > >> + * to the kernel log for testing verification. Don't display raw pointers, > >> + * but use the ptr_id() value instead. > >> + */ > >> +void *shadow_get(void *obj, unsigned long id) > >> +{ > >> + void *ret = klp_shadow_get(obj, id); > >> + > >> + pr_info("klp_%s(obj=PTR%d, id=0x%lx) = PTR%d\n", > >> + __func__, ptr_id(obj), id, ptr_id(ret)); > >> + > >> + return ret; > >> +} > > > >> +void shadow_free(void *obj, unsigned long id, klp_shadow_dtor_t dtor) > >> +{ > >> + klp_shadow_free(obj, id, dtor); > >> + pr_info("klp_%s(obj=PTR%d, id=0x%lx, dtor=PTR%d)\n", > >> + __func__, ptr_id(obj), id, ptr_id(dtor)); > >> +} > > > > Sparse (make C=1) would be happier with those two being static. > > Ah right. I wonder why the kbuild test robot didn't complain about > those, too. Easy enough to fix up, thanks. > > > Otherwise it works as expected. Good job! > > Thanks for reviewing. I'll hold off on posting v4 until Petr (and > others) get a chance to comment. Perhaps there are other tests that > would be helpful? I think it would be useful to have tests for a stack checking and a consistency. Nicolai has written some lately for our internal testing, but it would take some time to transform them appropriately, I think. So I would start with this and we can add more later. I would also establish a (soft) rule to submit selftests with new features. Miroslav