Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1602901ima; Thu, 25 Oct 2018 01:44:12 -0700 (PDT) X-Google-Smtp-Source: AJdET5ciUzjXfe1tAHnEMJHZFuPtkm21GzKYY0o1k6v6xTlmtUQMOgrftIXMbynR6ZVkksJRTivk X-Received: by 2002:a17:902:6941:: with SMTP id k1-v6mr626472plt.321.1540457052418; Thu, 25 Oct 2018 01:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540457052; cv=none; d=google.com; s=arc-20160816; b=l+dw6XxthImTH6E7BXP5znUxibatzhgV+dhUMJyA0jegIpjY/E0k1u8KWc+mXUxrFH W4hd1jhXolbH2lGNrf6tjGBHA+x+bKmsnHLkQfND1v2G1gdObn1DYm1neqVfEYb0/LSt aqqtydAnVz2/X0RCXCw3EIopDJiGMsvOunMhWQpSLV2bAxDHbry3j2wsHFDZMNODSHOv KkewRrbQjCgKBN7GO42rk4cI1ZV5QkRNxkiAfUB0CAgB8Z542Wx2/jyXUzslZnHYVvgp b1eHGUMuw8rWgqJJzGHxrTx5f4JCdGsNrVYD2OPFo7B9SiHTvS5//Rxcd5LChxuBG3mN KQww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=cKeHlJtpb4onBajLG/WTnvffqBg3ahovxRZm3V1xZcY=; b=Cwg2G280/3H8qEYXGEfwVVf9wdAWWlDTNU+ATySWyBrfytAM2CnOm/PDigf/tDAw/T aL32wLusJ97HJ9FrzHn3N2O8S5YM6JC4nFlbM7NgB1TcRlO4yLiFTrgRpFspa1HNG+Pu 2uKRTudlUTa/x+ndXHG5dR4GUI/szvlObmKu7UjnQNtm5StROCzkHRI5vqw0yZH5QC2R 5pd5s43iqmJGn64ZPzDTAFXdKuaRWlvi3rLJw8q9UU55gwQpJXy4OggyFcCuVSHbAEhK F7Olias2x31lcY61Tj9Bl9GT4iCjjzKW0OZOT9BpCF69nVEYey9RzyvgGMkdHImFiNhA xWiA== 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; dmarc=fail (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 x5-v6si7289471plv.256.2018.10.25.01.43.53; Thu, 25 Oct 2018 01:44:12 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727009AbeJYRPR (ORCPT + 99 others); Thu, 25 Oct 2018 13:15:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:40572 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726748AbeJYRPQ (ORCPT ); Thu, 25 Oct 2018 13:15:16 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 06097B03C; Thu, 25 Oct 2018 08:43:28 +0000 (UTC) Date: Thu, 25 Oct 2018 10:43:27 +0200 From: Michal Hocko To: Uladzislau Rezki Cc: Joel Fernandes , Shuah Khan , Matthew Wilcox , Kees Cook , Andrew Morton , linux-mm@kvack.org, LKML , Thomas Garnier , Oleksiy Avramchenko , Steven Rostedt , Joel Fernandes , Thomas Gleixner , Ingo Molnar , Tejun Heo , maco@android.com Subject: Re: [RFC PATCH 0/2] improve vmalloc allocation Message-ID: <20181025084327.GN18839@dhcp22.suse.cz> References: <20181022125142.GD18839@dhcp22.suse.cz> <20181022165253.uphv3xzqivh44o3d@pc636> <20181023072306.GN18839@dhcp22.suse.cz> <20181023152640.GD20085@bombadil.infradead.org> <20181023170532.GW18839@dhcp22.suse.cz> <98842edb-d462-96b1-311f-27c6ebfc108a@kernel.org> <20181023193044.GA139403@joelaf.mtv.corp.google.com> <20181024062252.GA18839@dhcp22.suse.cz> <20181024173418.2bxkdjbcyzfkgfeu@pc636> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181024173418.2bxkdjbcyzfkgfeu@pc636> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 24-10-18 19:34:18, Uladzislau Rezki wrote: > Hi. > > On Wed, Oct 24, 2018 at 08:22:52AM +0200, Michal Hocko wrote: > > On Tue 23-10-18 12:30:44, Joel Fernandes wrote: > > > On Tue, Oct 23, 2018 at 11:13:36AM -0600, Shuah Khan wrote: > > > > On 10/23/2018 11:05 AM, Michal Hocko wrote: > > > > > On Tue 23-10-18 08:26:40, Matthew Wilcox wrote: > > > > >> On Tue, Oct 23, 2018 at 09:02:56AM -0600, Shuah Khan wrote: > > > > > [...] > > > > >>> The way it can be handled is by adding a test module under lib. test_kmod, > > > > >>> test_sysctl, test_user_copy etc. > > > > >> > > > > >> The problem is that said module can only invoke functions which are > > > > >> exported using EXPORT_SYMBOL. And there's a cost to exporting them, > > > > >> which I don't think we're willing to pay, purely to get test coverage. > > > > > > > > > > Yes, I think we do not want to export internal functionality which might > > > > > be still interesting for the testing coverage. Maybe we want something > > > > > like EXPORT_SYMBOL_KSELFTEST which would allow to link within the > > > > > kselftest machinery but it wouldn't allow the same for general modules > > > > > and will not give any API promisses. > > > > > > > > > > > > > I like this proposal. I think we will open up lot of test opportunities with > > > > this approach. > > > > > > > > Maybe we can use this stress test as a pilot and see where it takes us. > > > > > > I am a bit worried that such an EXPORT_SYMBOL_KSELFTEST mechanism can be abused by > > > out-of-tree module writers to call internal functionality. > > > > > > How would you prevent that? > > > > There is no way to prevent non-exported symbols abuse by 3rd party > > AFAIK. EXPORT_SYMBOL_* is not there to prohibid abuse. It is a mere > > signal of what is, well, an exported API. > > Can we just use kallsyms_lookup_name()? Heh, this is the abuse I've had in mind ;) > > static void *((*__my_vmalloc_node_range)(unsigned long size, > unsigned long align,unsigned long start, unsigned long end, > gfp_t gfp_mask,pgprot_t prot, unsigned long vm_flags, > int node, const void *caller)); > > __my_vmalloc_node_range = (void *) kallsyms_lookup_name("__vmalloc_node_range"); > This is just too ugly to live. So I would go with it only if there is no reasonable way to export what tests need with a sane interface. -- Michal Hocko SUSE Labs