Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1803354imj; Fri, 8 Feb 2019 07:36:02 -0800 (PST) X-Google-Smtp-Source: AHgI3IabgP5np8YQaGatJUdHtIfA4V7ZEdUzB3YtvkPJ9IwuvjabBeaYbjPYarEVD6i6O+DwIFaQ X-Received: by 2002:aa7:8a45:: with SMTP id n5mr14627673pfa.151.1549640162029; Fri, 08 Feb 2019 07:36:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549640162; cv=none; d=google.com; s=arc-20160816; b=RMLuzbPEZ9+a64UYHlxRmGFKASYWUGMuhsXNGhcq5TJWwmY8xG/zYHk0ajetWUHwHH CLuC+fDQndD2nHHYwhnZtnyCiHfXVQz+3yhWdVYCcfpMLa0KxsIsIiSt8gOLNVBOyDtZ 7mq/081pFyJe/5BFKwStVpL9MQD0NYW/roI3OPfV62D54ArkkGjhwepYOQNwYtx0QvZw MFqkFDwHMc1zafKPgbfcgbbBWmKqdsb05+ZfJfYTftbMDr0TcZh7zDbz4faZC4yn35kX yNLm3JEl4+OQlOWpAv0QWC6ik4I78h/T8XVOjbuzq2loNxW68395cuEWPfXWU57js4on 6R5g== 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; bh=h46UpSsfYuJY3AgT5S57JD1Sq1HekbNaSdnFICZqhZA=; b=X5KC4bO/Dz43V5CoL61g2T/ufJNLdekGydeDadDRev2b/jZiSkgf6I5VBQXi0ydsNh wOeevtg2JJBfWWNWFdZKnmhUd1Vrut8Xs93apXaZJlhDDXBxtmIHax/+UmR/8OLVGJkk Hp5TmqaLc3h6VxL8SLLxalvQ4FYnGaVh4K1fJHPqI1Xtt/iZYLT8dlwMDMK5LWFqge9E C7X5wW1lExnN9WgsCf7UmECGNTDqzNjDCuHQkpfO2xfV/XmPPskEXK0O6JoGZEPZOYk9 7NXUsEZOudUoCXUELu6A3qik6h0jmCiN2IW4uQRzbO8iXAHiNjgwS/1ub8XNBCq8tsnu pXRA== 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 v7si2223134pgs.304.2019.02.08.07.35.45; Fri, 08 Feb 2019 07:36:02 -0800 (PST) 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 S1727930AbfBHPfV (ORCPT + 99 others); Fri, 8 Feb 2019 10:35:21 -0500 Received: from mx2.suse.de ([195.135.220.15]:33520 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727473AbfBHPfU (ORCPT ); Fri, 8 Feb 2019 10:35:20 -0500 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 A601BABE4; Fri, 8 Feb 2019 15:35:18 +0000 (UTC) Date: Fri, 8 Feb 2019 16:35:17 +0100 (CET) From: Miroslav Benes To: Kamalesh Babulal cc: Petr Mladek , Josh Poimboeuf , Alice Ferrazzi , jeyu@kernel.org, jikos@kernel.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Alice Ferrazzi Subject: Re: [PATCH v2] livepatch: core: Return EOPNOTSUPP instead of ENOSYS In-Reply-To: <20190208132238.GA32656@JAVRIS.in.ibm.com> Message-ID: References: <20190204183324.30775-1-alicef@alicef.me> <20190205155933.r6ey474lq4m5nlmp@treble> <20190206102832.apa7sekkwljo4ejg@pathway.suse.cz> <20190208062005.GA21436@JAVRIS.in.ibm.com> <20190208132238.GA32656@JAVRIS.in.ibm.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, 8 Feb 2019, Kamalesh Babulal wrote: > Hi Miroslav, > > On Fri, Feb 08, 2019 at 10:24:21AM +0100, Miroslav Benes wrote: > > Hi Kamalesh, > > > > On Fri, 8 Feb 2019, Kamalesh Babulal wrote: > > > > > On Wed, Feb 06, 2019 at 11:28:32AM +0100, Petr Mladek wrote: > > > > On Tue 2019-02-05 09:59:33, Josh Poimboeuf wrote: > > > > > On Tue, Feb 05, 2019 at 03:33:28AM +0900, Alice Ferrazzi wrote: > > > > > > From: Alice Ferrazzi > > > > > > > > > > > > As a result of an unsupported operation is better to use EOPNOTSUPP > > > > > > as error code. > > > > > > ENOSYS is only used for 'invalid syscall nr' and nothing else. > > [...] > > > > After removal of the immediate flag by > > > commit d0807da78e11 ("livepatch: Remove immediate feature"), every > > > architecture enabling livepatching is required to have implemented > > > reliable stack trace. Is it a better idea to make > > > HAVE_RELIABLE_STACKTRACE a config dependency, which will disable > > > livepatching support for architectures without reliable stack trace > > > function during kernel build? > > > > if I am not mistaken, s390x is currently the only one which is supported > > (the redirection works) but has no reliable stacktraces (so far, it is my > > plan to take a look soon). > > > > Theoretically, it could still work. We have the fake signal and we can > > force the remaining tasks (kthreads). It is not something to be used in > > production but it could make sense for a limited testing. > > That was my understanding too, s390 doesn't set HAVE_RELIABLE_STACKTRACE. > > (below output is right trimmed for readability) > > arch $ find . -name 'Kconfig'|xargs egrep -an "HAVE_LIVEPATCH" > ./powerpc/Kconfig:209: select HAVE_LIVEPATCH ... > ./x86/Kconfig:171: select HAVE_LIVEPATCH ... > ./s390/Kconfig:161: select HAVE_LIVEPATCH > > arch $ find . -name 'Kconfig'|xargs egrep -an "HAVE_RELIABLE_STACKTRACE" > ./powerpc/Kconfig:223: select HAVE_RELIABLE_STACKTRACE ... > ./x86/Kconfig:189: select HAVE_RELIABLE_STACKTRACE ... > ./Kconfig:690:config HAVE_RELIABLE_STACKTRACE > > klp_have_reliable_stack() will guard against loading of livepatching > module on s390, for the same reason being that HAVE_RELIABLE_STACKTRACE > is not set. My explanation is purely based on the above grep output > on Kconfig files, which might be partial. Am I missing something here? No, I don't think so. I think I mentioned the theoretical possibility at the time the check was introduced and we came to the conclusion that it is worth it and we should enforce the reliable stacktraces. > > > The idea is to remove klp_have_reliable_stack() by moving > > > CONFIG_HAVE_RELIABLE_STACKTRACE as a config dependency to Kconfig file > > > and adding the other CONFIG_STACKTRACE as a config dependency is not > > > required, as it's selected via CONFIG_DYNAMIC_FTRACE_WITH_REGS > > > dependency chain. With the patch on architecture without > > > HAVE_RELIABLE_STACKTRACE, the user should see: > > [...] > > > > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c > > > index fe1993399823..9a80f7574d75 100644 > > > --- a/kernel/livepatch/core.c > > > +++ b/kernel/livepatch/core.c > > > @@ -1002,12 +1002,6 @@ int klp_enable_patch(struct klp_patch *patch) > > > if (!klp_initialized()) > > > return -ENODEV; > > > > > > - if (!klp_have_reliable_stack()) { > > > - pr_err("This architecture doesn't have support for the livepatch consistency model.\n"); > > > - return -ENOSYS; > > > - } > > > - > > > - > > > mutex_lock(&klp_mutex); > > > > > > ret = klp_init_patch_early(patch); > > > > On the other hand, I like this change. So we have two options, I think. > > We can apply this and wait if someone complains (because of s390x > > testing), or we can wait for the full support of s390x and then enforce > > it. Scratch this. It is enforced even now. > Thanks, I am ok with either of the options. We could enforce the config > dependency, in case the above assumption in regard to s390 is correct. Yes, I think it is a nice cleanup. Miroslav