From patchwork Sun Jun 30 21:36:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dmitry V . Levin" X-Patchwork-Id: 13717441 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFAFFC27C4F for ; Sun, 30 Jun 2024 21:36:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2E6D46B0092; Sun, 30 Jun 2024 17:36:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 297186B0095; Sun, 30 Jun 2024 17:36:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 186276B0096; Sun, 30 Jun 2024 17:36:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id ED4AC6B0092 for ; Sun, 30 Jun 2024 17:36:30 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 368ACA3EFF for ; Sun, 30 Jun 2024 21:36:30 +0000 (UTC) X-FDA: 82288864140.14.EEAAA59 Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by imf16.hostedemail.com (Postfix) with ESMTP id 5FABC180005 for ; Sun, 30 Jun 2024 21:36:28 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf16.hostedemail.com: domain of ldv@altlinux.org designates 194.107.17.57 as permitted sender) smtp.mailfrom=ldv@altlinux.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719783371; a=rsa-sha256; cv=none; b=G8fBEL4yDWhyBawlgyAHzfpKZZfNR2+XNh+9EfsazSlw3/f6xz5+Ly9E07q53VzMs56Muh BDjBrIuKEDPdXL63mBZaWGBMysjBFRQMlyppeM/YjkXpYB5gkmqAUwvOjbS/PPQGzyQ9H7 cb5h2YDt67pQcoB6sX/oRPQAJz0pDe0= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf16.hostedemail.com: domain of ldv@altlinux.org designates 194.107.17.57 as permitted sender) smtp.mailfrom=ldv@altlinux.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719783371; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references; bh=sLFqGfhcO+gHvNPQZetCuOYXWzhcMM8qy/Np7/GsTVY=; b=V60ycX3/9uyYPgIU3CZ8cLMrij5/AiAcDS5vx+62RdtUjXMDsFvv8OOPiVqVykTDxJnGC2 P2CPXA/EhB0CnLNPkEKU35pBYBUvFiSWTTZKGz1kOCiKTl0sO0is7XHrjm4duSMemp3Thc A56Z34kURdmBDIVuOjnEhaTJbFvU86A= Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id BD3FC72C8CC; Mon, 1 Jul 2024 00:36:26 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id AB61B7CCB3A; Mon, 1 Jul 2024 00:36:26 +0300 (IDT) Date: Sun, 30 Jun 2024 21:36:26 +0000 From: "Dmitry V. Levin" To: Steven Rostedt Cc: Vincent Donnefort , David Hildenbrand , linux-api@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] uapi: change TRACE_MMAP_IOCTL_GET_READER to avoid collision with TCGETS Message-ID: <20240630213626.GA23566@altlinux.org> MIME-Version: 1.0 Content-Disposition: inline X-Rspamd-Server: rspam12 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xZ4T vloRyts2J9I1dDYpDZYuvTcKrWhTXJNWBaZm0Ilx3/IOjmOf03A/u7wf3KiPkrXrnxeID/iXA+7A/GlX6R/e/h+1i9rkadF0x2uPOBFzvLvXNErQ7fWqW8i/kJR6D6JzA8xgCCWG6B12g29w8MvREdLNIJryLV11b9liG1bYGaAuoCqYSF+26RowN55lil8EieetCH5k7uLwEGGwIBRY+KzgL1TrnfZTaWxFJjurO5PjoK95SjtdMa2Z9I0jgAa5vVquIL+uXzh29m779s00t/pEOmeGJb0zOgw6I/7xoglToAPvQSnuKY5RWbyZzbo12y6Nk X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The number that was initially chosen for TRACE_MMAP_IOCTL_GET_READER, unfortunately, collides with TCGETS on most of architectures. For example, this is how strace output would look like when support for this value of TRACE_MMAP_IOCTL_GET_READER is added: $ strace -e ioctl stty ioctl(0, TCGETS or TRACE_MMAP_IOCTL_GET_READER, {c_iflag=ICRNL|IXON, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, +c_cflag=B38400|CS8|CREAD, c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0 Even though ioctl numbers are inherently not unique, TCGETS is a very traditional one, so let's change the value of TRACE_MMAP_IOCTL_GET_READER a bit to avoid this collision. Given that _IO('T', 0x1) is _IOC(_IOC_NONE, 'T', 0x1, 0), something like _IOC(_IOC_NONE, 'T', 0x1, 0x1) should be OK. Fixes: cf9f0f7c4c5bb ("tracing: Allow user-space mapping of the ring-buffer") Signed-off-by: Dmitry V. Levin --- include/uapi/linux/trace_mmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/uapi/linux/trace_mmap.h b/include/uapi/linux/trace_mmap.h index bd1066754220..cb858f1b8367 100644 --- a/include/uapi/linux/trace_mmap.h +++ b/include/uapi/linux/trace_mmap.h @@ -43,6 +43,6 @@ struct trace_buffer_meta { __u64 Reserved2; }; -#define TRACE_MMAP_IOCTL_GET_READER _IO('T', 0x1) +#define TRACE_MMAP_IOCTL_GET_READER _IOC(_IOC_NONE, 'T', 0x1, 0x1) #endif /* _TRACE_MMAP_H_ */