NetBSD Problem Report #48569

From martin@aprisoft.de  Mon Feb  3 11:51:58 2014
Return-Path: <martin@aprisoft.de>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 89CCBA5673
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  3 Feb 2014 11:51:58 +0000 (UTC)
Message-Id: <20140203115148.C9CC3ED0E3B@emmas.aprisoft.de>
Date: Mon,  3 Feb 2014 12:51:48 +0100 (CET)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: radeon video playback may crash the X server
X-Send-Pr-Version: 3.95

>Number:         48569
>Category:       xsrc
>Synopsis:       radeon video playback may crash the X server
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    xsrc-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 03 11:55:00 +0000 2014
>Closed-Date:    Sun Mar 22 10:19:00 +0000 2020
>Last-Modified:  Sun Mar 22 10:20:01 +0000 2020
>Originator:     Martin Husemann
>Release:        NetBSD 6.99.30
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD whoever-brings-the-night.aprisoft.de 6.99.30 NetBSD 6.99.30 (WHOEVER) #106: Thu Jan 30 21:52:06 CET 2014 martin@emmas.aprisoft.de:/usr/src/sys/arch/sparc64/compile/WHOEVER sparc64
Architecture: sparc64
Machine: sparc64
>Description:

On a sparc64 machine with XVR100 I am using gmplayer and xfce. When I move
the video playback window partly outside the screen, I can reproducably crash
the X server.

>How-To-Repeat:
s/a

>Fix:
Not sure if this is the best fix, but it works for me.

Index: radeon_accel.c
===================================================================
RCS file: /cvsroot/xsrc/external/mit/xf86-video-ati/dist/src/radeon_accel.c,v
retrieving revision 1.1.1.7
diff -u -r1.1.1.7 radeon_accel.c
--- radeon_accel.c	23 Sep 2012 19:49:26 -0000	1.1.1.7
+++ radeon_accel.c	3 Feb 2014 10:51:00 -0000
@@ -960,7 +960,30 @@
 	    return;
         }
     case RADEON_HOST_DATA_SWAP_32BIT:
-        {
+	if (((uintptr_t)dst & 1) || ((uintptr_t)src & 1)) {
+	    uint8_t *d = (uint8_t *)dst;
+	    uint8_t *s = (uint8_t *)src;
+	    unsigned int nwords = size >> 2;
+
+	    for (; nwords > 0; --nwords, d+=4, s+=4) {
+	        d[0] = s[3];
+		d[1] = s[2];
+		d[2] = s[1];
+		d[3] = s[0];
+	    }
+	    return;
+        } else if (((uintptr_t)dst & 3) || ((uintptr_t)src & 3)) {
+	    /* copy 16bit wise */
+	    uint16_t *d = (uint16_t *)dst;
+	    uint16_t *s = (uint16_t *)src;
+	    unsigned int nwords = size >> 2;
+
+	    for (; nwords > 0; --nwords, d+=2, s+=2) {
+	        d[0] = ((s[1] >> 8) & 0xff) | ((s[1] & 0xff) << 8);
+	        d[1] = ((s[0] >> 8) & 0xff) | ((s[0] & 0xff) << 8);
+	    }
+	    return;
+	} else {
 	    unsigned int *d = (unsigned int *)dst;
 	    unsigned int *s = (unsigned int *)src;
 	    unsigned int nwords = size >> 2;

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Sun, 22 Mar 2020 10:19:00 +0000
State-Changed-Why:
Patch commited


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48569 CVS commit: xsrc/external/mit/xf86-video-ati/dist/src
Date: Sun, 22 Mar 2020 10:18:19 +0000

 Module Name:	xsrc
 Committed By:	martin
 Date:		Sun Mar 22 10:18:19 UTC 2020

 Modified Files:
 	xsrc/external/mit/xf86-video-ati/dist/src: radeon_accel.c

 Log Message:
 PR 48569: avoid unaligned access. OK mrg@


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 \
     xsrc/external/mit/xf86-video-ati/dist/src/radeon_accel.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.