Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp65564pxb; Wed, 16 Feb 2022 21:59:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwc7YMjGy6X0J+wmM+YSuQDQtH29hupiV5KJBCYt93wj0gs95RLtIY5hLA92gIM+KVfkgZe X-Received: by 2002:a62:ab09:0:b0:4e0:d967:318f with SMTP id p9-20020a62ab09000000b004e0d967318fmr1657327pff.86.1645077574696; Wed, 16 Feb 2022 21:59:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645077574; cv=none; d=google.com; s=arc-20160816; b=DdYx6bTk54REb+19W4JsRIvCl6ffCtvurDfWhDmc/n/Gv0zQFF+yuZbKd+cIUL9AuF YUdEd4KgY73nUvkaa7PmybnvgWZGVqlVgs6ExNSzHmutPqhERJnV0aL1h+lHD6IqjbUD 5KAGG7oBoT5O0pV/qOO88wF/u/fpu2d+wrFdyycYpE5ZwQDg2GApK1ImxFQtemPbFf90 YcJEqy2wzr+tiFeukbKedJy5cnAJ7U0rP6AoHbknyCL9C5E08TcxNYPoAy3uah0+NcO3 NZ1opuUN+q3uSLZ8RgaxWBVqkEHRH5Sw6B0/Cj4u73NSfxfD0k7kl/Gd9OYpUqOOxJDL 2TRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=XT+hixO3OHzRLvB8+uXJ8rcVlX1aTroBtBRh2n+1zQY=; b=qzAlMKF0Cvt4iwMDDABQXJydWKfDTpqq7HKsYc5LsriVqY9nzCuBNk/0cS/G/veV5o unqWsJx0ZwUlFJX+WFG1qIdFzh7mSTMGNhAWTyuWesdnRAw82WM8PEF3/TfqM4j3BZNq Y+5ii7nAJnR2S/FGROFQs8CELaD5ZORLOD9jRo8BbeORk9wfbD44N8ppm126PclORH48 /22WIbTS3SX6MzklVCKaSyIDJ8dLHYYNNqn/GEfpyrzQEliW/3+CEqCLct/1tpgwk3n8 kJuscdtVxS7aggJC96Z8Ifr9gdw3hFLo7RA3D2hRZI72mc5B7QkAuybSoPfmaFI8/8ER vccw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=y7dYjnFd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e4si14103355plh.559.2022.02.16.21.59.18; Wed, 16 Feb 2022 21:59:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=y7dYjnFd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234070AbiBQE4N (ORCPT + 99 others); Wed, 16 Feb 2022 23:56:13 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229952AbiBQE4L (ORCPT ); Wed, 16 Feb 2022 23:56:11 -0500 Received: from conssluserg-02.nifty.com (conssluserg-02.nifty.com [210.131.2.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6BB51F227D; Wed, 16 Feb 2022 20:55:57 -0800 (PST) Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (authenticated) by conssluserg-02.nifty.com with ESMTP id 21H4tb7b030427; Thu, 17 Feb 2022 13:55:38 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com 21H4tb7b030427 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1645073738; bh=XT+hixO3OHzRLvB8+uXJ8rcVlX1aTroBtBRh2n+1zQY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=y7dYjnFd4wsC3TTZW1BdEoNjB4sXAHPx0oJ8ABx+P0g3nx4tKIj8RHnGp5PTqxZxP F/NwszPL7gcDNXn8C95gahpJKOuhawN36TQNiyqpII8iJ7j1obZhq9H1Jm8mU4AoDo tYEsoc19rtHNgG0UMiUzgfJi6rdU5DmfXuNc6rgFuhRYpHfhA52pBSeYa4fofhQDYN ARoDDn05/6oJ8613UFpkQwaDNAV3QbUGSNTBVmLB+VEJ/3eyMmAXbAvyCJOZ4ZvD2i sKEiwUEm3utUkypeph7bZ8SWyRkIahSFZHZrsY4kepFKduHoMAgcYGBF7Vz4YdhaHP qCnjo7q5wYCSQ== X-Nifty-SrcIP: [209.85.216.43] Received: by mail-pj1-f43.google.com with SMTP id ki18-20020a17090ae91200b001b8be87e9abso5284343pjb.1; Wed, 16 Feb 2022 20:55:37 -0800 (PST) X-Gm-Message-State: AOAM533LyphR5LuoChSI1L6v+i1cwCPDBAuuII6YV7H09qcfrQ7TkJV3 ShZ+OC17RNuDYpHam+P0DZCUBnvvY/L5IuGNDW4= X-Received: by 2002:a17:902:e8d7:b0:149:3b5d:2b8b with SMTP id v23-20020a170902e8d700b001493b5d2b8bmr1173473plg.162.1645073737215; Wed, 16 Feb 2022 20:55:37 -0800 (PST) MIME-Version: 1.0 References: <20220217002843.2312603-1-keescook@chromium.org> In-Reply-To: <20220217002843.2312603-1-keescook@chromium.org> From: Masahiro Yamada Date: Thu, 17 Feb 2022 13:54:58 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] um: Allow builds with Clang To: Kees Cook Cc: Jeff Dike , Richard Weinberger , Anton Ivanov , Nick Desaulniers , Nathan Chancellor , David Gow , linux-um@lists.infradead.org, Linux Kbuild mailing list , "open list:KERNEL SELFTEST FRAMEWORK" , kunit-dev@googlegroups.com, llvm@lists.linux.dev, Linux Kernel Mailing List , X86 ML , linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Thu, Feb 17, 2022 at 9:28 AM Kees Cook wrote: > > Add x86-64 target for Clang+um and update user-offsets.c to use > Clang-friendly assembler, similar to the fix from commit cf0c3e68aa81 > ("kbuild: fix asm-offset generation to work with clang"). > > This lets me run KUnit tests with Clang: > > $ ./tools/testing/kunit/kunit.py config --make_options LLVM=1 > ... > $ ./tools/testing/kunit/kunit.py run --make_options LLVM=1 > ... > > Cc: Jeff Dike > Cc: Richard Weinberger > Cc: Anton Ivanov > Cc: Masahiro Yamada > Cc: Nick Desaulniers > Cc: Nathan Chancellor > Cc: David Gow > Cc: linux-um@lists.infradead.org > Cc: linux-kbuild@vger.kernel.org > Cc: linux-kselftest@vger.kernel.org > Cc: kunit-dev@googlegroups.com > Cc: llvm@lists.linux.dev > Signed-off-by: Kees Cook > --- > arch/x86/um/user-offsets.c | 4 ++-- > scripts/Makefile.clang | 1 + > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/um/user-offsets.c b/arch/x86/um/user-offsets.c > index bae61554abcc..d9071827b515 100644 > --- a/arch/x86/um/user-offsets.c > +++ b/arch/x86/um/user-offsets.c > @@ -10,10 +10,10 @@ > #include > > #define DEFINE(sym, val) \ > - asm volatile("\n->" #sym " %0 " #val : : "i" (val)) > + asm volatile("\n.ascii \"->" #sym " %0 " #val "\"": : "i" (val)) > > #define DEFINE_LONGS(sym, val) \ > - asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long))) > + asm volatile("\n.ascii \"->" #sym " %0 " #val "\"": : "i" (val/sizeof(unsigned long))) > > void foo(void) > { > diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang > index 51fc23e2e9e5..857b23de51c6 100644 > --- a/scripts/Makefile.clang > +++ b/scripts/Makefile.clang > @@ -10,6 +10,7 @@ CLANG_TARGET_FLAGS_powerpc := powerpc64le-linux-gnu > CLANG_TARGET_FLAGS_riscv := riscv64-linux-gnu > CLANG_TARGET_FLAGS_s390 := s390x-linux-gnu > CLANG_TARGET_FLAGS_x86 := x86_64-linux-gnu > +CLANG_TARGET_FLAGS_um := x86_64-linux-gnu Does this work for the i386 host? UML supports i386 and x86_64 as the host architecture as of now, but this always compiles UML for x86_64? > CLANG_TARGET_FLAGS := $(CLANG_TARGET_FLAGS_$(SRCARCH)) > > ifeq ($(CROSS_COMPILE),) > -- > 2.30.2 > -- Best Regards Masahiro Yamada