Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3449238pxb; Mon, 4 Apr 2022 17:19:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcQbTzVN1jtXGp00/RxCE6n05Y5EM9uMvPKuNP64WjYrxAjAzt+OMMEyusIGbuckgmOO5L X-Received: by 2002:a17:902:f68e:b0:154:6518:69ba with SMTP id l14-20020a170902f68e00b00154651869bamr833107plg.60.1649117987594; Mon, 04 Apr 2022 17:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649117987; cv=none; d=google.com; s=arc-20160816; b=qcnG/7PJSmX4ZrhgdDuLoPT7rsAp7z84jufNXO0wDwI/j/Zrl9PT9cFGhdL1shCeya Dj+vBgjw5kCLuYJ/iCJlVNQ/x9SR9P7y4L1cLApHJoxo28qYkodjc7+0s0jQIYsQrSUf flJIic4lB2g77A5LwvZK+HcRAHiyNtXf6FQJMWE6kjltndTFf7YciOkL3g1YoPAJ2oKu jHGktxdgoJDlIUPcGUR5f9O6B37jwIhwRP9TopAWxrKckEuWIt+4Qb7uKTjST44d6/ML cpBHKn2Gf9CjqOw6XGMwmFKSOcIIZH2SWFUaVXNwb5F2ye8xQxpxis/7mWaBwtDPvImP DfyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=VAiOedGj62M5GgHEj7eqNLEu8ktVlLz7dVBNkHNEBCI=; b=Qw0BLZS+NhVYi8CRK8Fy3J8SEoQ0rs5V9ahOSqIWvfqDuGrat4pIJfaB98cAkKzEds j6rNKUwl4NrkYS0RS9twswGADWhrc/EMCxSAcgzkuwDhb9vXfTsaQFWr8mA4IwSuzuvz PpHAf+bek8vtNxEZJG/P0Hgqe/K3H8aGyonEULoDfzw4TOOe6JaQ6qGoeM9iDQMOvd6p 3dZ7y5WVRGjfYIAYi4f6bYo7KtaYRlOyPnVrR8jy9Ay7HU4UQR9ixBZhuZiTbCV4d3Kg sJgYAvW/QiDGClbXA9jNzyMxVCFO1JA3dkKtpzCxdnyg3o+pFXya1PVASBAkANj4KFKR yr4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=WcxVAn7b; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h16-20020a056a001a5000b004fa3a8dffa1si11848708pfv.88.2022.04.04.17.19.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:19:47 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=WcxVAn7b; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 178C156772; Mon, 4 Apr 2022 16:46:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359172AbiDDLMG (ORCPT + 99 others); Mon, 4 Apr 2022 07:12:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243187AbiDDLME (ORCPT ); Mon, 4 Apr 2022 07:12:04 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 569DC3AA50; Mon, 4 Apr 2022 04:10:06 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: usama.anjum) with ESMTPSA id 231F71F44F1C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1649070605; bh=uJM/eBYziCRkGOrHOqJSiL8T5PL06TZOxD1+cp1k4lI=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=WcxVAn7bem/ad7tCGkNyhTYZGuTiG9TbACZ2HKZn3kk0abKkB6mCKQ86B5fNfagf8 2cogEYTERRbxiCrtblpFqezTh9SfWlVYOj2qhYrEpyvvRPuSQEI6MV/AnUNc8Zv2ER l2BywD1pTw1bzWtfKqPRbvgRGO2cL4ctwqk8QjbmBnMD5xp8/YneID54IGN4bWto2R oI1hwKhzaCBut0lQ6kP08E+JitpPC1bi8S9xnWNAUl4NjcIHQdGmT1OHyEzjDLeIAB BOzJFo317z0D7tOS7JnJOwgQAt5mAzGU8Cw2NHny8n+YXErlUq8/j7KgEdQwfJ2EcH 71dHdcJuu36Mg== Message-ID: Date: Mon, 4 Apr 2022 16:09:57 +0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Cc: usama.anjum@collabora.com, Michal Marek , Nick Desaulniers , kernel@collabora.com, kernelci@groups.io, "open list:KERNEL SELFTEST FRAMEWORK" , Kees Cook , Linux Kbuild mailing list , Linux Kernel Mailing List Subject: Re: [PATCH] Makefile: Fix separate output directory build of kselftests Content-Language: en-US To: Masahiro Yamada , Shuah Khan References: <20220223191016.1658728-1-usama.anjum@collabora.com> <63c5d7ad-b0b2-9b37-16c3-354ac10858b6@collabora.com> From: Muhammad Usama Anjum In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From [Makefile](https://elixir.bootlin.com/linux/latest/source/Makefile): ``` ifeq ($(abs_srctree),$(abs_objtree)) # building in the source tree srctree := . building_out_of_srctree := else ifeq ($(abs_srctree)/,$(dir $(abs_objtree))) # building in a subdirectory of the source tree srctree := .. else srctree := $(abs_srctree) endif building_out_of_srctree := 1 endif ``` `ifeq ($(abs_srctree)/,$(dir $(abs_objtree)))` condition is setting `srctree` to `..`. This is wrong. This condition isn't considering that `header_install` doesn't depend on `abs_srctree and abs_objtree`. This condition needs to be tweaked or removed for the `install_headers` to work fine and fix this issue. I've added `KBUILD_ABS_SRCTREE=1` to the kselftest target which sets the `srctree` to `abs_srctree` and thus forcefully affecting only kselftest targets. This seems like the clean fix. Alternatively we should remove this condition `ifeq ($(abs_srctree)/,$(dir $(abs_objtree)))` but it'll affect other targets as well. Complete details of investigation can be found here: https://github.com/kernelci/kernelci-project/issues/92#issuecomment-1087406222 On 3/17/22 11:08 PM, Masahiro Yamada wrote: > On Thu, Mar 17, 2022 at 7:49 PM Muhammad Usama Anjum > wrote: >> >> Reminder. Shuah is okay with this patch. Any thoughts? > > I do not think this is the right fix, > but something you just happen to find working. > > > The Make is working in a wrong directory, that is why > the relative path does not work > (and you use the absolute path to work around it) > `ifeq ($(abs_srctree)/,$(dir $(abs_objtree))) \ srctree := ..` has broken the `make headers_install` when called through selftests/Makefile. We can remove it or use the absolute path each time. -- Muhammad Usama Anjum