Received: by 2002:ac2:5a04:0:0:0:0:0 with SMTP id q4csp109292lfn; Wed, 16 Feb 2022 19:49:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJxUHntMQhuOP+8/eFNbvGqnb4YEIqizfClRtSykm3bzAV7NwaFl5htDOc9FMiI37kxJUWBX X-Received: by 2002:aa7:c789:0:b0:410:dd40:d458 with SMTP id n9-20020aa7c789000000b00410dd40d458mr780523eds.3.1645069782852; Wed, 16 Feb 2022 19:49:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645069782; cv=none; d=google.com; s=arc-20160816; b=jB7aAUEnMI64DjeykREBJthhNcHhnl+Vg0z3/fA6NaEn3zMNvqYLyLuSF3EU/Ip8Mo i1PVDORF2AW+k7O+wWy/z8xg5j9dVd60VmGG7cJ5Rbkk5SP1MWGW/rlxeINF93yyK67f IoPz8MqsWJu5DUqSNYXwIuJaKcHqDyVhsiY8ALlxYk5qczq8HvRT9PBaR6KYHMUy26Xg I/QcE67O2mDvCcgBCS56NLywSNfJAgvimjgs3EKHRMPEq2Oc8Y3EuM2JXH/Ur3AzqNPp JxUhg1os00del+nZj0mMWCTNXyBaXeXxPmjB3/U8+wzOC5WgnfPszuO+ex73slJPpPhj J8VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=FGcQO3MYiNVzzOdQ6PURsZcaUd8RxaLP2F5BG8x7eyQ=; b=M723Hr4+6ubVqmsMnj93MKe8lU0HHLlyzkq03y7SkJJWLEyxDUSgBzD3YFpF7V7cM3 +u4wqUYHfkY8wBh+EMZOSUTiT4q1vkFppZhehP2XXlIuO0E0uFRxSsM06ngXxA2+c371 BxVOLqKU18rPMT0h8JCkcEBEq27Qp3khx3Yaqsje0TgNWcb4kt/mxiNbImDOhU6zUou+ 9MEYC85PwpdhyQtuAARvugv57rvBv3T+F7CYOrNNBrzuiprU1uEMg5k+ILe8eYT4obNk l53iD9ccTQZjeWpdKbl7Oed2/qhoTfrl/0nD7+mQW4Qp1j/VkV+52odHwkJuyQwlrF0t VZoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Lqy2LJOc; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs1si1304627ejc.413.2022.02.16.19.49.20; Wed, 16 Feb 2022 19:49:42 -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=@chromium.org header.s=google header.b=Lqy2LJOc; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229814AbiBQA3A (ORCPT + 99 others); Wed, 16 Feb 2022 19:29:00 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229793AbiBQA3A (ORCPT ); Wed, 16 Feb 2022 19:29:00 -0500 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 726201FFC88 for ; Wed, 16 Feb 2022 16:28:46 -0800 (PST) Received: by mail-pf1-x42a.google.com with SMTP id d17so3628751pfl.0 for ; Wed, 16 Feb 2022 16:28:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FGcQO3MYiNVzzOdQ6PURsZcaUd8RxaLP2F5BG8x7eyQ=; b=Lqy2LJOcN+upnxmIuTwy3fpzudc0qiFDVU+dx5qCPOwHk6QfaFIX97c4efamZKjMMi euF0m2g0IF54Vfa68IeK+IXk2NUQXtaq7kA0Uod+Y2cXxKbxzrX4PExsECyuXGTltvrA i2leezKeoQtfK2DYFOiqo//LmWYDTGnE5l2q8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FGcQO3MYiNVzzOdQ6PURsZcaUd8RxaLP2F5BG8x7eyQ=; b=d/ko8yzJYgIGw94heTnrFKzTvNVoexrqOWucYjeg+SbMlwoBTdTk4/zlnnoUjTdk+g EO5pqJ+m3xeTkb6hVUGJ9V70MJdcLP/WwNhxWu/1LSWMCJaSPjIUrjUEPqbMHPniIwzR 33ZyfCxA93+bxvHNxpSSSW4lZ7Zj7/gtHsy5LiEVTWQCzBLDam0GzUMaz6bfBrk45OOF iXlFVlHL9DQpOOMNdbBCz6u/aCVuI5bRofMkwPaIiiuhvo3De+6066Kz3QwVcY1+p2wH jcuzkgRJn+jfVBacxcLSHYwv9c5bKucQCv2rsFD54fXRJ/I+rjv87vppqp9veNsks3uG gGvA== X-Gm-Message-State: AOAM530Jjxp62D0D6aoYD9FH3EcWN+pd3XFO/KzVrS2jqSTmRVBMc+ui lzhtP6/7crGJ8jnh4IJOagYiRA== X-Received: by 2002:a63:8bca:0:b0:370:2717:3756 with SMTP id j193-20020a638bca000000b0037027173756mr396843pge.604.1645057725956; Wed, 16 Feb 2022 16:28:45 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id mj21sm199355pjb.20.2022.02.16.16.28.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 16:28:45 -0800 (PST) From: Kees Cook To: Jeff Dike Cc: Kees Cook , Richard Weinberger , Anton Ivanov , Masahiro Yamada , Nick Desaulniers , Nathan Chancellor , David Gow , linux-um@lists.infradead.org, linux-kbuild@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, x86@kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH] um: Allow builds with Clang Date: Wed, 16 Feb 2022 16:28:43 -0800 Message-Id: <20220217002843.2312603-1-keescook@chromium.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2149; h=from:subject; bh=vShMU0xnxVexx4MO5nHaUDLC8EDUgfNlHp2nsWHEiy8=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBiDZa6UafTd6YGrYc+tswDkAPHU5vTnnAfc+6lyNW/ iJEEJS+JAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCYg2WugAKCRCJcvTf3G3AJrobD/ 94N3eFm682VZ5KXRjhfpVMnBOe7gen8xGGN/fUaNo7D5ELCrVTZ2MtlaOxpZg3gFE2QOS9Qi3KfN4T evcT3Sx7e2eCQQVIH989akOsLuFQkuDsJRZoHarM0gDLFJzqJYV5DD2F2x802pGeBcAYXME1KMkgYv cjzKSXixhur7fi/4i8v1+oGXSW39WRHeZMsb2tZhhiZerHcEkgc2Z5CBLFgBWBNwdcq0G2bza84e8J /LETYVec+LxaEtcVGZEquYASEuBwVhfnU1ELznR5msJ1OE3CpBJdUq9rFIhJY+FpU3yW1O2FSELINI zyUhxrRYDxplhqkV/9AZtB/cNiD4KJpd7yHH19JsB+773pA2qjFHej71yPlqO76eLGq85fnpkPVLAs OeUT9i/B0TfTI9W2PdqsUuXV2EeAUt52hIJ7Tc0bFsewLzdpgwT+88sk5Gx8/X3eR07rEpVTGVPx8d VhPQDd+eYjbAkmdCIco+FoxapSJq/+HtPyDFsrqsJvHyzfaiSXCkHc4cNjJAOB0P+T4/RTrk5EgpIC Q1k75VinAtx6s3sX/wE3+X7/bDeN2MSznWVfMYpwbZuJ42y6W+HD7mZPRXCg+pBUBzo6xPucFqLzXN MpOxLvy+jlg8HUr9uGvI0UoDqaix1aidkMMl2KM5AWa+wnAS5UJHGqjM7euQ== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 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 CLANG_TARGET_FLAGS := $(CLANG_TARGET_FLAGS_$(SRCARCH)) ifeq ($(CROSS_COMPILE),) -- 2.30.2