From: Daniel Hartwig <mandyke@gmail.com>
To: Ian Price <ianprice90@googlemail.com>
Cc: 12095@debbugs.gnu.org
Subject: bug#12095: Protecting pointer on bytevector with guardian does not protect memory
Date: Tue, 7 Aug 2012 11:32:10 +0800 [thread overview]
Message-ID: <CAN3veRd86=y8pUQAFNzmedym3aQ4eUe86-pf2cSTg1Wxgvy0cA@mail.gmail.com> (raw)
In-Reply-To: <878vdskmde.fsf@Kagami.home>
[-- Attachment #1: Type: text/plain, Size: 1643 bytes --]
On 7 August 2012 00:37, Ian Price <ianprice90@googlemail.com> wrote:
> Patrick Bernaud <patrickb@chez.com> writes:
>
>> With auto compilation turned on, it looks like the problem can not be
>> reproduced.
That is to say, when using --fresh-auto-compile.
>
> I cannot reproduce this on 32 bit fedora 16 with guile (GNU Guile)
> 2.0.6-dirty (commit 1321a36ed61deb9431b41768dc92cb7230c9afa1). However,
> there was one caveat, as I didn't have html prag, I substituted for
> various other libraries (ice-9 regex)/(ice-9 threads)/(sxml simple)/ and
> my own (pfds queues).
>
> Is this bug somehow particular to htmlprag, or can you confirm it with others?
On x86 Debian sid I reproduced the bug by loading (web server) with
the original test.scm from the mailing list.
The bug report copy differs from the original by replacing
parse-c-struct with pointer->bytevector.
I attach test1.scm, with a loop to load many modules one at a time.
Curiously, when using pointer->bytevector the contents change (for me)
only when freshly compiling:
$ guile --fresh-auto-compile test1.scm
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling /home/daniel/Downloads/test1.scm
;;; compiled /home/daniel/.cache/guile/ccache/2.0-LE-4-2.0/home/daniel/Downloads/test1.scm.go
#<pointer 0xa1cdb7c>
#vu8(1 1 1 1 1 1 1 1 1 1)
Contents differ after (web http)
#vu8(110 116 104 101 115 105 122 101 0 1)
#<pointer 0xa1cdb7c>
$ guile test1.scm
#<pointer 0x82c754c>
#vu8(1 1 1 1 1 1 1 1 1 1)
#<pointer 0x82c754c>
With the original (using parse-c-struct) it was the other way around.
[-- Attachment #2: test1.scm --]
[-- Type: application/octet-stream, Size: 1037 bytes --]
(use-modules (system foreign) (rnrs bytevectors))
(define my-guardian (make-guardian))
(define len 10)
(define x (bytevector->pointer (make-bytevector len 1)))
(define a (pointer-address x))
(display x)(newline)
(my-guardian x)
;(my-guardian (pointer->bytevector x len))
(set! x #f)
(define (dump-struct)
(write (pointer->bytevector (make-pointer a) len))(newline))
(dump-struct)
(let lp ((s1 (with-output-to-string dump-struct))
(m '((web uri) (web http) (web request) (web response)
(web client) (web server) (sxml apply-templates)
(sxml fold) (sxml simple) (sxml ssax)
(ice-9 popen) (ice-9 getopt-long) (srfi srfi-42))))
(gc)
(primitive-eval `(use-modules ,(car m)))
(let ((s2 (with-output-to-string dump-struct)))
(if (not (string=? s1 s2))
(begin
(display "Contents differ after ")
(display (car m))
(newline)
(display s2))
(if (pair? (cdr m))
(lp s2 (cdr m))))))
(display (my-guardian))(newline)
next prev parent reply other threads:[~2012-08-07 3:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-30 16:01 bug#12095: Protecting pointer on bytevector with guardian does not protect memory Patrick Bernaud
2012-08-06 16:37 ` Ian Price
2012-08-07 3:32 ` Daniel Hartwig [this message]
2012-10-06 21:41 ` Ludovic Courtès
2012-10-07 2:56 ` Daniel Hartwig
2012-10-07 20:38 ` Ludovic Courtès
2012-10-07 23:49 ` Daniel Hartwig
2012-10-08 13:44 ` Ludovic Courtès
2012-10-08 14:10 ` Daniel Hartwig
2012-10-08 15:42 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAN3veRd86=y8pUQAFNzmedym3aQ4eUe86-pf2cSTg1Wxgvy0cA@mail.gmail.com' \
--to=mandyke@gmail.com \
--cc=12095@debbugs.gnu.org \
--cc=ianprice90@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).