Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp8098188rdb; Thu, 4 Jan 2024 20:18:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGVI46KHMMA8eAp+k3h9pmix1nri5BDbkeOcKD7Bu/+38eDD3YYpbuHr4IrEarSdIuUP0v5 X-Received: by 2002:a17:906:ee81:b0:a28:a7f4:e862 with SMTP id wt1-20020a170906ee8100b00a28a7f4e862mr952799ejb.102.1704428286745; Thu, 04 Jan 2024 20:18:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704428286; cv=none; d=google.com; s=arc-20160816; b=LzWpqGLm0ZvHgIo8nnWRRbGMMtLWEx3xCjX4M5QHha53S0i38cmBkEsyzwLc/5Tdne BdU0lM2vnAzr9O6YVeMVCqyyTH7Cv/HGmZz54s2zflg+DhwrfEVBJteT3XLy6HDpcxFL YGFfTCgVadp4jecf0SgOd08+qgTK313o0QAX4IVFYE8rPbsW/Dm9dZce6UjDqN1+c4Xx IYRVSKcjM+I+9TE9K3c0PNVKjUDgEDNLDaqvM9jCveqOW9gT77MlQQ1xEBDAx4rAmRQb kEXP8IDEVsd2BsAH5hjlSg+GUariTvRRZG308kP7fkyRV2aY1JZziFyRwXA4rj1W+3jk qaGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=3wBtvd8AcUa+3WyzFrFiVlLy0PPCAnv0pduZK21JO48=; fh=WtRC5cGbudSI3gcDeyRYeu+LgIB5ivv79zZoMSzi3Ks=; b=Ui4C9nKhIj1spJ+GYlcL9B2T/zq1a9GBPrvqi36JXwmpFmufyoIv60ccB9D6lCGDWl eYM7z/t+I7GwmyopDbr2BVBBrmwRz/gceAPmTy4tXs6nna0gIhzjRNNRPbZzwhetK12e tj5jY17tIPZ+5thUo4fYsOg118xjSv4UOmHbjD/8alxY2ZDMeOsCP3fYt6H9qcCWdU8h PY5aD7KI1ZWRgW7mYwqmnruzLLaIdlJju6OPJIR2tWm9X7Xp+o8B4Y2NtCit+A9Q91Ln LTjMinMlAVl/Ju50UGW6M8nrAp+kHrDTjPepMM+WHgaxHQca0axzaPRVl+QNL4y9huDW bdoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=D7LDz2On; spf=pass (google.com: domain of linux-kernel+bounces-17466-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17466-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id g24-20020a170906199800b00a28ad652f5asi283827ejd.531.2024.01.04.20.18.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 20:18:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17466-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=D7LDz2On; spf=pass (google.com: domain of linux-kernel+bounces-17466-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17466-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7B6681F228AD for ; Fri, 5 Jan 2024 04:18:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3F74524B; Fri, 5 Jan 2024 04:17:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="D7LDz2On" X-Original-To: linux-kernel@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67C595225 for ; Fri, 5 Jan 2024 04:17:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704428276; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=3wBtvd8AcUa+3WyzFrFiVlLy0PPCAnv0pduZK21JO48=; b=D7LDz2OntocsgwDidf+YsLjGpfK3+qZHeIyU9OBoA4fNng9uQ0pxmdcA7EYi62an4iEzn+ c20l9DlTCRMMGX45OfWZMjOt+NuefhJQtaAvw+m13uUeNhPLvEcoJje5q//v9fujGnfOEv E7Y3TSD3iwKSkN5OAlbTJxAuReNzWAo= Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-111-D34ut3twO6GfGwE1G3ifDA-1; Thu, 04 Jan 2024 23:17:54 -0500 X-MC-Unique: D34ut3twO6GfGwE1G3ifDA-1 Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-6d9dfc1fc38so203427b3a.0 for ; Thu, 04 Jan 2024 20:17:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704428273; x=1705033073; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3wBtvd8AcUa+3WyzFrFiVlLy0PPCAnv0pduZK21JO48=; b=OsnNCaWMrEv1R2kkh94294tfedSpiE0fXbWMPjpwG4pW2a69iF6Yh9cznEcK8O3O4z 2dekSziuZ+P06esmJTYN11UlnLr6rw1roR9Rh3fqNIk/8M/dRRqIpjYFLFrjBHcJg/51 OQStJuL1wDJyYBlIWzVI/Ue7xZytBrA1sC/3fr8sHIDxAJsDod1EVPwfGdL6GCalZuCg aijDCpPU5oNbXK40hZpW1CWnUn2oB94X5G+iuoGGIqI06/252UCQr0j6qzfiZxQKdGsv srphhXYcRQL/FZZcq3qq/xg/IWSZRx1onfeDdyr9IGpkdbJ7vWDNm459QRrIuD4STPtF TDuQ== X-Gm-Message-State: AOJu0YzUc5p6YNqAbUTI3wBSsS8PYjYqpGkZ2s2BRFh4lgP3Z28C47XD HWfkWjVFUADGGaT9A+3ySOFhXV4220kJ5RRT1371h/lzltZRyxRAj504VaMgWnVBZRiWuiZMw8F 9rF9N1QBmgvVQHYDQu/sYYHUk+jyzxeMx713K5KyX X-Received: by 2002:a05:6a20:e104:b0:197:78be:b5f6 with SMTP id kr4-20020a056a20e10400b0019778beb5f6mr1830571pzb.30.1704428272963; Thu, 04 Jan 2024 20:17:52 -0800 (PST) X-Received: by 2002:a05:6a20:e104:b0:197:78be:b5f6 with SMTP id kr4-20020a056a20e10400b0019778beb5f6mr1830559pzb.30.1704428272620; Thu, 04 Jan 2024 20:17:52 -0800 (PST) Received: from localhost.localdomain ([2804:431:c7ec:3efd:1dbc:859f:ecb4:d775]) by smtp.gmail.com with ESMTPSA id s11-20020a63f04b000000b005cdad153d84sm443222pgj.90.2024.01.04.20.17.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 20:17:51 -0800 (PST) From: Leonardo Bras To: Oleg Nesterov , Catalin Marinas , Will Deacon , Mark Brown , Mark Rutland , "Steven Rostedt (Google)" , Arnd Bergmann , Leonardo Bras , Guo Hui Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/1] arm64: remove unnecessary ifdefs around is_compat_task() Date: Fri, 5 Jan 2024 01:15:00 -0300 Message-ID: <20240105041458.126602-3-leobras@redhat.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Currently some parts of the codebase will test for CONFIG_COMPAT before testing is_compat_task(). is_compat_task() is a inlined function only present on CONFIG_COMPAT. On the other hand, for !CONFIG_COMPAT, we have in linux/compat.h: #define is_compat_task() (0) Since we have this define available in every usage of is_compat_task() for !CONFIG_COMPAT, it's unnecessary to keep the ifdefs, since the compiler is smart enough to optimize-out those snippets on CONFIG_COMPAT=n Signed-off-by: Leonardo Bras --- Changes since RFCv1: - Removed unnecessary new inlined is_compat_task() for arm64 - Adjusted commit text and title Link: https://lore.kernel.org/all/20240104192433.109983-2-leobras@redhat.com/ arch/arm64/kernel/ptrace.c | 6 ++---- arch/arm64/kernel/syscall.c | 5 +---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 20d7ef82de90a..9f8781f1fdfda 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -173,7 +173,6 @@ static void ptrace_hbptriggered(struct perf_event *bp, struct arch_hw_breakpoint *bkpt = counter_arch_bp(bp); const char *desc = "Hardware breakpoint trap (ptrace)"; -#ifdef CONFIG_COMPAT if (is_compat_task()) { int si_errno = 0; int i; @@ -195,7 +194,7 @@ static void ptrace_hbptriggered(struct perf_event *bp, desc); return; } -#endif + arm64_force_sig_fault(SIGTRAP, TRAP_HWBKPT, bkpt->trigger, desc); } @@ -2112,7 +2111,6 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, const struct user_regset_view *task_user_regset_view(struct task_struct *task) { -#ifdef CONFIG_COMPAT /* * Core dumping of 32-bit tasks or compat ptrace requests must use the * user_aarch32_view compatible with arm32. Native ptrace requests on @@ -2123,7 +2121,7 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task) return &user_aarch32_view; else if (is_compat_thread(task_thread_info(task))) return &user_aarch32_ptrace_view; -#endif + return &user_aarch64_view; } diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c index 9a70d9746b661..ad198262b9817 100644 --- a/arch/arm64/kernel/syscall.c +++ b/arch/arm64/kernel/syscall.c @@ -20,14 +20,11 @@ long sys_ni_syscall(void); static long do_ni_syscall(struct pt_regs *regs, int scno) { -#ifdef CONFIG_COMPAT - long ret; if (is_compat_task()) { - ret = compat_arm_syscall(regs, scno); + long ret = compat_arm_syscall(regs, scno); if (ret != -ENOSYS) return ret; } -#endif return sys_ni_syscall(); } -- 2.43.0