Message ID | cover.1664876744.git.research_trasio@irq.a4lg.com |
---|---|
Headers |
Return-Path: <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp42483wrs; Tue, 4 Oct 2022 02:46:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6y6M6VlL8Zne0Dohjj8ZhBNJkA5gO1+XAojbDVilyvHeqIXOdVDkZ4S+dP80UJGakBowiW X-Received: by 2002:aa7:d38f:0:b0:458:8d32:d642 with SMTP id x15-20020aa7d38f000000b004588d32d642mr16509618edq.208.1664876774447; Tue, 04 Oct 2022 02:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664876774; cv=none; d=google.com; s=arc-20160816; b=FexVMS9AaI7uhy558jtomGx/sDhOuPAI5LlD+gQdQmOiufVM7Ghs92C343t9u/T90T H79WjqoOfBhbdRHIcCggFmpjBU2J0CKm28DpdguJ3kUJMS/ri48w/kTulhh+ihFlo25n owQ60lApyFCqcH0AZhafXSMhUh0GD2MxKp1ZrX8mzYqXVu8WruQ55U8vmjx4m4Zrt+jb PmLounyrFeN4fd+gUK+P7w4SFOyRUluOXHHPADTqVF03hHYCJhjK3wqgZUhBssWHXrdg yNIDo9OVd8oe5AT2V6W9wrE+bDk5LPY18pTBD0kbzWMpm6pGFoIpfbJAcNiq+ZhT3W3L X+cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=wM8DQrdbRugAX5VLaU3xKSitcuvviir8wtl4giOPd8A=; b=hRnkqGs5ibaXC8L5emjXLFfepfaTWymNOM/rCxMnw93PuOEeJWGSrTv+QfJXgLQYT0 5GtbkUtbO+SmqjRbACn/m02jJvJGnP19n75JbdmydNXbHEqJThVT+BwLXB9oGci/UJoR wdwy7XO9pFxXQoR9FQXyFk9LJHHbO/iu6EeKP4cm+1eaehfsnm9J1GZ0CRChxQ74GcBF +LPm/ew9Ae9BAQD1oez/mahGVru7/tOq1tsU0LoCd8CDREY2ygvQFk85rbbcoBXik7bH iVAVHuZGQSy6+GGaoCToAYkncMG/QY++D4AVeigubwhP5w5gqjo9TAtWYsGJYJsUghLD +UJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=JF8oKD8k; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id l13-20020a170906794d00b0077b49a2aca5si12011300ejo.393.2022.10.04.02.46.14 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Oct 2022 02:46:14 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=JF8oKD8k; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 68569385AC3E for <ouuuleilei@gmail.com>; Tue, 4 Oct 2022 09:46:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 68569385AC3E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664876773; bh=wM8DQrdbRugAX5VLaU3xKSitcuvviir8wtl4giOPd8A=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=JF8oKD8kmwqA2eaWTv+tOsDTTUZ/vEWqkHqOyDRMF9bKxI+SvyCOIVWuAUNvWeTUC CAcUNvdcc+khI2hh7NoTfjyI4Z88Jn0LzWzasxCkxPssfe9ibESuWwJNZEPw4P1Cvr YuKUD04iy4Fix/ZVyedW3w2ROyHk7wTO1y79KsPI= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id 676873858D1E; Tue, 4 Oct 2022 09:46:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 676873858D1E Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 99A24300089; Tue, 4 Oct 2022 09:45:59 +0000 (UTC) To: Tsukasa OI <research_trasio@irq.a4lg.com>, Nelson Chu <nelson@rivosinc.com>, Kito Cheng <kito.cheng@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Andrew Burgess <aburgess@redhat.com>, Jan Beulich <jbeulich@suse.com>, Andreas Schwab <schwab@suse.de> Subject: [PATCH v2 0/2] RISC-V: Fix buffer overflow after 176-bit instruction support Date: Tue, 4 Oct 2022 09:45:48 +0000 Message-Id: <cover.1664876744.git.research_trasio@irq.a4lg.com> In-Reply-To: <cover.1664873933.git.research_trasio@irq.a4lg.com> References: <cover.1664873933.git.research_trasio@irq.a4lg.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KAM_MANYTO, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> From: Tsukasa OI via Binutils <binutils@sourceware.org> Reply-To: Tsukasa OI <research_trasio@irq.a4lg.com> Cc: binutils@sourceware.org, gdb-patches@sourceware.org Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1745749828616799813?= X-GMAIL-MSGID: =?utf-8?q?1745749828616799813?= |
Series |
RISC-V: Fix buffer overflow after 176-bit instruction support
|
|
Message
Tsukasa OI
Oct. 4, 2022, 9:45 a.m. UTC
Hello, After commit bb996692bd9 "RISC-V/gas: allow generating up to 176-bit instructions with .insn", I started to see some crashes while running "make check-gas". The cause was simple. Some functions depended on the fact that maximum length returned by riscv_insn_length is 8. But since the commit above increased that upper limit from 64-bits (8 bytes) to 176-bits (22 bytes), we need to increase two buffer sizes to avoid crashes. But note that this change doesn't really support over 64-bit instructions. At least we can safely ignore those long instructions but we must remember that we are still in a partial support for 176-bit instructions. [Changes: v1 -> v2] - Fix assertion failure on riscv_insn::decode - Use new constant RISCV_MAX_INSN_LEN for buffer size PATCH 1: Binutils PATCH 2: GDB (v2: depends on PATCH 1) Thanks, Tsukasa Tsukasa OI (2): RISC-V: Fix buffer overflow on print_insn_riscv gdb/riscv: Partial support for instructions up to 176-bits gdb/riscv-tdep.c | 9 +++++---- include/opcode/riscv.h | 2 ++ opcodes/riscv-dis.c | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) base-commit: 034235cebd790d4f9a1728043a175d7d7d9338b1