misc/151861: dlclose() of library causes separately opened libraries to unload as well

2010-11-01 Thread Arjan van Leeuwen

>Number: 151861
>Category:   misc
>Synopsis:   dlclose() of library causes separately opened libraries to 
>unload as well
>Confidential:   no
>Severity:   serious
>Priority:   medium
>Responsible:freebsd-bugs
>State:  open
>Quarter:
>Keywords:   
>Date-Required:
>Class:  sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 01 12:20:11 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Arjan van Leeuwen
>Release:FreeBSD 8.1-RELEASE amd64
>Organization:
Opera Software ASA 
>Environment:


System: FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:36:49 UTC 2010
r...@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC



>Description:


Assume we have a library liba.so, containing a function a(), and a library 
libb.so, containing function b(). liba.so needs functionality from libb.so, so 
liba.so links in libb.so.

An application doesn't know about the relation between these libraries, but 
needs to call a() and b(). It dlopen()s libb.so and obtains a pointer to b(), 
and it dlopen()s liba.so and obtains a pointer to a().

As soon as the application doesn't need a() anymore, it dlclose()s liba.so.

Expected result: the pointer to b() is still valid and can be called
Actual result: the pointer to b() has become invalid, even though the 
application did not dlclose() the handle to libb.so. On calling b(), the 
application crashes with a segmentation fault.

Note: this bug is the cause of a FreeBSD-specific crash in Opera (ports/150117).


>How-To-Repeat:


Extract the attached shar archive and execute 'make test'.

This will cause a crash on FreeBSD, and will print 'success' on Linux.


>Fix:


--- dlopentest.sh begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#   dlopentest
#   dlopentest/Makefile
#   dlopentest/a.h
#   dlopentest/a.c
#   dlopentest/b.h
#   dlopentest/b.c
#   dlopentest/main.c
#
echo c - dlopentest
mkdir -p dlopentest > /dev/null 2>&1
echo x - dlopentest/Makefile
sed 's/^X//' >dlopentest/Makefile << '2075fca623562c5bd8776415e7b01bf6'
Xall: dlopentest liba.so
X
Xlibb.so: b.c
X   gcc -g -fPIC -shared -o libb.so b.c
X
Xliba.so: libb.so a.c
X   gcc -g -L. -fPIC -shared -lb -o liba.so a.c
X
Xdlopentest: main.c
X   gcc -g -o dlopentest main.c
X
Xclean:
X   rm -f dlopentest liba.so libb.so
X
Xtest: all
X   LD_LIBRARY_PATH=. ./dlopentest
2075fca623562c5bd8776415e7b01bf6
echo x - dlopentest/a.h
sed 's/^X//' >dlopentest/a.h << 'fc414acea66cdc81629a88bfee826a11'
Xconst char* a();
fc414acea66cdc81629a88bfee826a11
echo x - dlopentest/a.c
sed 's/^X//' >dlopentest/a.c << '0ad10ab266ed1f8ba3b38758bb80e7f7'
X#include "a.h"
X#include "b.h"
X
Xconst char* a()
X{
X  return b();
X}
0ad10ab266ed1f8ba3b38758bb80e7f7
echo x - dlopentest/b.h
sed 's/^X//' >dlopentest/b.h << '318c19e5810f4ba86fe6f909829d72e7'
Xconst char* b();
318c19e5810f4ba86fe6f909829d72e7
echo x - dlopentest/b.c
sed 's/^X//' >dlopentest/b.c << 'f9fa01da76fe4015102bc9a5d0c22c09'
X#include "b.h"
X
Xconst char* b()
X{
X  return "b";
X}
f9fa01da76fe4015102bc9a5d0c22c09
echo x - dlopentest/main.c
sed 's/^X//' >dlopentest/main.c << 'a3b6e3077e820f950e38c9b3614efead'
X#include 
X#include 
X#include 
X
Xvoid* LoadLibrary(const char* library)
X{
X  void* handle = dlopen(library, RTLD_LAZY);
X  if (!handle)
X  {
X   fprintf(stderr, "can't load %s: %s\n", library, dlerror());
X   exit(1);
X  }
X  return handle;
X}
X
Xvoid* LoadFunction(void* handle, const char* function)
X{
X  void* fptr = dlsym(handle, function);
X  if (!fptr)
X  {
X   fprintf(stderr, "can't resolve function %s: %s\n", function, dlerror());
X   exit(1);
X  }
X  return fptr;
X}
X
Xint main(int argc, char* argv[])
X{
X  void* handle_a = LoadLibrary("liba.so");
X  const char* (*a)() = LoadFunction(handle_a, "a");
X
X  printf("from a: %s\n", a());
X
X  void* handle_b = LoadLibrary("libb.so");
X  const char* (*b)() = LoadFunction(handle_b, "b");
X
X  printf("from b: %s\n", b());
X
X  dlclose(handle_a);
X
X  printf("from b after dlclosing a: %s\n", b());
X
X  dlclose(handle_b);
X
X  printf("success\n");
X
X  return 0;
X}
a3b6e3077e820f950e38c9b3614efead
exit

--- dlopentest.sh ends here ---



>Release-Note:
>Audit-Trail:
>Unformatted:
___
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


bin/151866: [libfetch] [patch] closing the cached FTP connection

2010-11-01 Thread Mark Johnston

>Number: 151866
>Category:   bin
>Synopsis:   [libfetch] [patch] closing the cached FTP connection
>Confidential:   no
>Severity:   non-critical
>Priority:   low
>Responsible:freebsd-bugs
>State:  open
>Quarter:
>Keywords:   
>Date-Required:
>Class:  change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 01 15:10:07 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Mark Johnston
>Release:8.1-RELEASE
>Organization:
Sandvine Inc.
>Environment:
FreeBSD mark-laptop-bsd.mark-home 8.1-RELEASE FreeBSD 8.1-RELEASE #2: Mon Oct 
25 15:07:21 EDT 2010 
r...@mark-laptop-bsd.mark-home:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
This patch adds a function to libfetch which allows programs to close the 
cached socket that libfetch holds on to when performing a file transfer.

See http://lists.freebsd.org/pipermail/freebsd-current/2010-October/020694.html
>How-To-Repeat:
Running this test program and using sockstat demonstrates the issue.

#include 
#include 
#include 
#include 

#define URL "ftp://ftp.freebsd.org/pub/FreeBSD/releases/README.TXT";

int
main(int argc, char **argv)
{
char c;
FILE *f = fetchGetURL(URL, NULL);
if (!f) {
printf("Error: could not open connection.\n");
return (1);
}

while (!feof(f)) {
fread(&c, sizeof(char), 1, f);
putchar(c);
}

printf("Transfer complete.\n");
fclose(f);

if (fork())
//Close the cached FTP connection.
//fetchCloseCachedFTP();
else
for ( ;; ) ;

return (0);
}
>Fix:
My patch adds a function to libfetch which makes it possible to force close the 
cached connection. Included is a patch to pkg_add(1) which fixes the problem 
described in the email.

Patch attached with submission follows:

diff --git a/lib/libfetch/fetch.h b/lib/libfetch/fetch.h
index 11a3f77..d379e63 100644
--- a/lib/libfetch/fetch.h
+++ b/lib/libfetch/fetch.h
@@ -109,6 +109,7 @@ FILE*fetchGetFTP(struct url *, const char 
*);
 FILE   *fetchPutFTP(struct url *, const char *);
 int fetchStatFTP(struct url *, struct url_stat *, const char *);
 struct url_ent *fetchListFTP(struct url *, const char *);
+voidfetchCloseCachedFTP();
 
 /* Generic functions */
 FILE   *fetchXGetURL(const char *, struct url_stat *, const char *);
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c
index 0983a76..746ad54 100644
--- a/lib/libfetch/ftp.c
+++ b/lib/libfetch/ftp.c
@@ -1204,3 +1204,12 @@ fetchListFTP(struct url *url __unused, const char *flags 
__unused)
warnx("fetchListFTP(): not implemented");
return (NULL);
 }
+
+/*
+ * Force close the cached connection.
+ */
+void
+fetchCloseCachedFTP()
+{
+   ftp_disconnect(cached_connection);
+}
diff --git a/usr.sbin/pkg_install/lib/url.c b/usr.sbin/pkg_install/lib/url.c
index 914ce39..68f31bb 100644
--- a/usr.sbin/pkg_install/lib/url.c
+++ b/usr.sbin/pkg_install/lib/url.c
@@ -163,5 +163,6 @@ fileGetURL(const char *base, const char *spec, int 
keep_package)
printf("tar command returns %d status\n", WEXITSTATUS(pstat));
 if (rp && (isatty(0) || Verbose))
printf(" Done.\n");
+fetchCloseCachedFTP();
 return rp;
 }


>Release-Note:
>Audit-Trail:
>Unformatted:
___
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


misc/151870: games/vavoom: update to 1.32

2010-11-01 Thread Barbara

>Number: 151870
>Category:   misc
>Synopsis:   games/vavoom: update to 1.32
>Confidential:   no
>Severity:   non-critical
>Priority:   low
>Responsible:freebsd-bugs
>State:  open
>Quarter:
>Keywords:   
>Date-Required:
>Class:  sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 01 16:30:09 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Barbara
>Release:RELENG_8
>Organization:
>Environment:
FreeBSD satanasso.local.net 8.1-STABLE FreeBSD 8.1-STABLE #0: Sat Oct 30 
16:43:56 CEST 2010 r...@satanasso.local.net:/usr/obj/usr/src/sys/SATANASSO  
i386
>Description:
Update games/vavoom to 1.32.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- Makefile.orig   2010-06-06 22:43:51.0 +0200
+++ Makefile2010-11-01 16:18:09.0 +0100
@@ -6,8 +6,7 @@
 #
 
 PORTNAME=  vavoom
-PORTVERSION=   1.30
-PORTREVISION=  5
+PORTVERSION=   1.32
 CATEGORIES=games
 MASTER_SITES=  SF/${PORTNAME}/Vavoom-source/${PORTVERSION}
 
@@ -135,14 +134,6 @@
${WRKSRC}/utils/acc/parse.c
@${REINPLACE_CMD} -e 's///' \
${WRKSRC}/utils/acc/strlist.c
-   @${REINPLACE_CMD} -e 
's/png_set_gray_1_2_4_to_8/png_set_expand_gray_1_2_4_to_8/' \
-   ${WRKSRC}/source/r_tex_png.cpp
-
-.if defined(WITH_LAUNCHER)
-   @${REINPLACE_CMD} -e '/add_definitions($${wxWidgets_DEFINITIONS})/d; \
-   
s/include_directories($${wxWidgets_INCLUDE_DIRS})/include($${wxWidgets_USE_FILE})/'
 \
-   ${WRKSRC}/utils/vlaunch/CMakeLists.txt
-.endif
 
 post-configure:
 .if defined(WITH_LAUNCHER)
--- distinfo.orig   2009-10-14 15:34:06.0 +0200
+++ distinfo2010-11-01 16:13:04.0 +0100
@@ -1,3 +1,2 @@
-MD5 (vavoom-1.30.tar.bz2) = 205c3645006232d75790fb8779a54e85
-SHA256 (vavoom-1.30.tar.bz2) = 
a6bc1ffb7458e8050add65d7083d9cec0d64d4e475486be8cfa44dd6f5ea1ca4
-SIZE (vavoom-1.30.tar.bz2) = 1597647
+SHA256 (vavoom-1.32.tar.bz2) = 
1efc070068513448d39937c0c6b7c5dbc68e186f55614c68eef69948d163ebda
+SIZE (vavoom-1.32.tar.bz2) = 1675740


>Release-Note:
>Audit-Trail:
>Unformatted:
___
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


Re: ports/151870: games/vavoom: update to 1.32

2010-11-01 Thread brucec
Synopsis: games/vavoom: update to 1.32

Responsible-Changed-From-To: freebsd-bugs->freebsd-ports-bugs
Responsible-Changed-By: brucec
Responsible-Changed-When: Mon Nov 1 16:34:22 UTC 2010
Responsible-Changed-Why: 
Ports PR.

http://www.freebsd.org/cgi/query-pr.cgi?pr=151870
___
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


bin/151871: camcontrol(8): incorrect standby timer calculation

2010-11-01 Thread Bruce Cran

>Number: 151871
>Category:   bin
>Synopsis:   camcontrol(8): incorrect standby timer calculation
>Confidential:   no
>Severity:   non-critical
>Priority:   low
>Responsible:freebsd-bugs
>State:  open
>Quarter:
>Keywords:   
>Date-Required:
>Class:  sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 01 17:30:09 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Bruce Cran
>Release:9.0-CURRENT
>Organization:
>Environment:
FreeBSD core.nessbank 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r214509: Fri Oct 29 
13:26:38 BST 2010 bru...@core.nessbank:/usr/obj/usr/src/head/sys/CORE  amd64
>Description:
Incorrect standby timer values are sent to the disk. According to t13, the 
values should be:

1-1200 seconds: (seconds / 5)
1260 seconds: 252
1800-19800 seconds: (minutes/30) + 240

Currently a timeout value of 1800s (30 minutes) is being programmed as 242, 
which will cause the drive to go into standby after 60 minutes.
>How-To-Repeat:
Compare the code on line 4315 of src/sbin/camcontrol/camcontrol.c with table 19 
in T13 1532D Volume 1.
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:
___
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


misc/151876: Squid rc script doesn't restart the daemon

2010-11-01 Thread Mark Felder

>Number: 151876
>Category:   misc
>Synopsis:   Squid rc script doesn't restart the daemon
>Confidential:   no
>Severity:   serious
>Priority:   low
>Responsible:freebsd-bugs
>State:  open
>Quarter:
>Keywords:   
>Date-Required:
>Class:  maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 01 22:30:19 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Mark Felder
>Release:6.2-RELEASE
>Organization:
>Environment:
FreeBSD proxy.orbitec.com 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Tue Apr 24 
20:12:20 CDT 2007 r...@proxy.orbitec.com:/usr/src/sys/i386/compile/IPFW  
i386

>Description:
I upgraded squid on this machine today and while troubleshooting the config I 
discovered that when I issued `/usr/local/etc/rc.d/squid restart` that it was 
saying it was restarting the process but in reality it never happens.
>How-To-Repeat:
/usr/local/etc/rc.d/squid restart
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:
___
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


Re: bin/151871: [cam] camcontrol(8): incorrect standby timer calculation

2010-11-01 Thread arundel
Old Synopsis: camcontrol(8): incorrect standby timer calculation
New Synopsis: [cam] camcontrol(8): incorrect standby timer calculation

Responsible-Changed-From-To: freebsd-bugs->freebsd-scsi
Responsible-Changed-By: arundel
Responsible-Changed-When: Tue Nov 2 00:47:55 UTC 2010
Responsible-Changed-Why: 
Over to maintainer(s).

http://www.freebsd.org/cgi/query-pr.cgi?pr=151871
___
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


Re: kern/106340: [ata] [request] Need to control disk write cache on per-disk basis

2010-11-01 Thread arundel
Synopsis: [ata] [request] Need to control disk write cache on per-disk basis

State-Changed-From-To: suspended->closed
State-Changed-By: arundel
State-Changed-When: Tue Nov 2 00:58:49 UTC 2010
State-Changed-Why: 
I'm closing this PR, since 127717 deals with the same issue and (unlike this PR)
contains a patch.

http://www.freebsd.org/cgi/query-pr.cgi?pr=106340
___
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


Re: kern/127717: [ata] [patch] [request] - support write cache toggling per device

2010-11-01 Thread arundel
Old Synopsis: [ata] [patch] - support write cache toggling per device
New Synopsis: [ata] [patch] [request] - support write cache toggling per device

Responsible-Changed-From-To: freebsd-bugs->freebsd-scsi
Responsible-Changed-By: arundel
Responsible-Changed-When: Tue Nov 2 01:02:06 UTC 2010
Responsible-Changed-Why: 
Although this PR is related to ATA and not CAM, I think developers reading the
freebsd-scsi@ mailinglist will have an opinion about this request.

http://www.freebsd.org/cgi/query-pr.cgi?pr=127717
___
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"