From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 98B94740038 for ; Thu, 24 Aug 2023 16:34:21 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ri4+SXU0BiRgPwwOYZ7ayKKqCVvXxHSsqXXS7W6IOjQ=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1692894860; v=1; b=cr9LuhNI6QWs5OC4oeJVHyJQirvehCezZN5KQD+Krirtp2mgm81oqzFdsyGyqSR+1/zPYeXk YuCkAO4GGczegKvHVRQfYjfTHvkHyE8t6UqZ80uEFVHAIVlkqHretS3xk39roVKqE4pCFVb5xmU dVWL/Jpx7HWD+bF0mFsK511A= X-Received: by 127.0.0.2 with SMTP id mTExYY7687511xfDCwC2jku4; Thu, 24 Aug 2023 09:34:20 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.4.1692894855819359108 for ; Thu, 24 Aug 2023 09:34:19 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10812"; a="373367014" X-IronPort-AV: E=Sophos;i="6.02,195,1688454000"; d="scan'208";a="373367014" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2023 09:34:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10812"; a="827220449" X-IronPort-AV: E=Sophos;i="6.02,195,1688454000"; d="scan'208";a="827220449" X-Received: from njayapra-mobl.gar.corp.intel.com ([10.215.198.205]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2023 09:34:17 -0700 From: "Jayaprakash, N" To: devel@edk2.groups.io Cc: Jayaprakash N , Rebecca Cran , Michael D Kinney , Kloper Dimitry Subject: [edk2-devel] [edk2-libc Patch 1/1] edk2-libc/StdLib: Fix console jump to 0, 0 issue in lseek() Date: Thu, 24 Aug 2023 22:04:05 +0530 Message-Id: <20230824163405.1386-2-n.jayaprakash@intel.com> In-Reply-To: <20230824163405.1386-1-n.jayaprakash@intel.com> References: <20230824163405.1386-1-n.jayaprakash@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,n.jayaprakash@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: CBscRombRXPQC7oqk0l5aBHkx7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=cr9LuhNI; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4531 Python code opens console file descriptor and uses lseek() with position == 0 and SEEK_CUR as 'do nothing, check console is alive' operation. Current implementation of daConsole ignores whence argument, this is wrong in case lseek(0, SEEK_CUR) will send cursor to (0,0). This fix is not generic, but solves the particular situation. Cc: Rebecca Cran Cc: Michael D Kinney Cc: Jayaprakash N Signed-off-by: Kloper Dimitry --- StdLib/LibC/Uefi/Devices/Console/daConsole.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/StdLib/LibC/Uefi/Devices/Console/daConsole.c b/StdLib/LibC/Uefi/Devices/Console/daConsole.c index 56571af..ba031d6 100644 --- a/StdLib/LibC/Uefi/Devices/Console/daConsole.c +++ b/StdLib/LibC/Uefi/Devices/Console/daConsole.c @@ -141,8 +141,16 @@ da_ConSeek( EFIerrno = RETURN_UNSUPPORTED; return -1; } - // Everything is OK to do the final verification and "seek". + Proto = (EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)Stream->Dev; + + if(Position == 0 && whence == SEEK_CUR) { + CursorPos.XYpos.Column = (UINT32)Proto->Mode->CursorColumn; + CursorPos.XYpos.Row = (UINT32)Proto->Mode->CursorRow; + return CursorPos.Offset; + } + + // Everything is OK to do the final verification and "seek". CursorPos.Offset = Position; EFIerrno = Proto->SetCursorPosition(Proto, -- 2.40.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108016): https://edk2.groups.io/g/devel/message/108016 Mute This Topic: https://groups.io/mt/100938751/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-