* sg_set_page not usable for .bss?
[not found] ` <49345EE4.3070409@oracle.com>
@ 2008-12-01 22:40 ` Jan Engelhardt
2008-12-02 0:10 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: Jan Engelhardt @ 2008-12-01 22:40 UTC (permalink / raw)
To: John Haxby; +Cc: Netfilter Development Mailinglist, Linux Kernel Mailing List
On Monday 2008-12-01 23:02, John Haxby wrote:
>>>+ sg_init_table(sg, 2);
>>>+ sg_set_buf(&sg[0], data, n);
>>>+ strcpy(digest_password, sysrq_password);
>>>+ i = strlen(digest_password);
>>>+ sg_set_buf(&sg[1], digest_password, i);
>>
>> Could we directly use sysrq_password instead of copying it to
>> digest_password first?
>
> No :-) Eventually I discovered the reason my code wasn't working
> boils down to the definition of sg_set_buf:
>
> sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf))
>
> which doesn't work for sysrq_password. I don't know why I'll
> double check.
Well, sysrq_password is in the .bss section, where as digest_password
is on the heap due to being kmalloc'ed. Maybe that makes a difference?
Someone more versed with the virtual memory layer might know.
>+static char sysrq_password[64];
>[...]
>+ digest_password = kmalloc(sizeof(sysrq_password), GFP_KERNEL);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: sg_set_page not usable for .bss?
2008-12-01 22:40 ` sg_set_page not usable for .bss? Jan Engelhardt
@ 2008-12-02 0:10 ` David Miller
2008-12-02 0:13 ` Jan Engelhardt
0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2008-12-02 0:10 UTC (permalink / raw)
To: jengelh; +Cc: john.haxby, netfilter-devel, linux-kernel
From: Jan Engelhardt <jengelh@medozas.de>
Date: Mon, 1 Dec 2008 23:40:18 +0100 (CET)
>
> On Monday 2008-12-01 23:02, John Haxby wrote:
> >>>+ sg_init_table(sg, 2);
> >>>+ sg_set_buf(&sg[0], data, n);
> >>>+ strcpy(digest_password, sysrq_password);
> >>>+ i = strlen(digest_password);
> >>>+ sg_set_buf(&sg[1], digest_password, i);
> >>
> >> Could we directly use sysrq_password instead of copying it to
> >> digest_password first?
> >
> > No :-) Eventually I discovered the reason my code wasn't working
> > boils down to the definition of sg_set_buf:
> >
> > sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf))
> >
> > which doesn't work for sysrq_password. I don't know why I'll
> > double check.
>
> Well, sysrq_password is in the .bss section, where as digest_password
> is on the heap due to being kmalloc'ed. Maybe that makes a difference?
> Someone more versed with the virtual memory layer might know.
You can't use these interfaces on kernel image addresses.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: sg_set_page not usable for .bss?
2008-12-02 0:10 ` David Miller
@ 2008-12-02 0:13 ` Jan Engelhardt
2008-12-02 0:14 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: Jan Engelhardt @ 2008-12-02 0:13 UTC (permalink / raw)
To: David Miller; +Cc: john.haxby, netfilter-devel, linux-kernel
On Tuesday 2008-12-02 01:10, David Miller wrote:
>> On Monday 2008-12-01 23:02, John Haxby wrote:
>> >>>+ sg_init_table(sg, 2);
>> >>>+ sg_set_buf(&sg[0], data, n);
>> >>>+ strcpy(digest_password, sysrq_password);
>> >>>+ i = strlen(digest_password);
>> >>>+ sg_set_buf(&sg[1], digest_password, i);
>> >>
>> >> Could we directly use sysrq_password instead of copying it to
>> >> digest_password first?
>> >
>> > No :-) Eventually I discovered the reason my code wasn't working
>> > boils down to the definition of sg_set_buf:
>> >
>> > sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf))
>> >
>> > which doesn't work for sysrq_password. I don't know why I'll
>> > double check.
>>
>> Well, sysrq_password is in the .bss section, where as digest_password
>> is on the heap due to being kmalloc'ed. Maybe that makes a difference?
>> Someone more versed with the virtual memory layer might know.
>
>You can't use these interfaces on kernel image addresses.
>
Great :-) So what is the best way to use the SHA1 crypto algo
with in-kernel addresses?
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: sg_set_page not usable for .bss?
2008-12-02 0:13 ` Jan Engelhardt
@ 2008-12-02 0:14 ` David Miller
2008-12-02 1:41 ` Jan Engelhardt
0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2008-12-02 0:14 UTC (permalink / raw)
To: jengelh; +Cc: john.haxby, netfilter-devel, linux-kernel
From: Jan Engelhardt <jengelh@medozas.de>
Date: Tue, 2 Dec 2008 01:13:34 +0100 (CET)
>
> On Tuesday 2008-12-02 01:10, David Miller wrote:
> >> On Monday 2008-12-01 23:02, John Haxby wrote:
> >> >>>+ sg_init_table(sg, 2);
> >> >>>+ sg_set_buf(&sg[0], data, n);
> >> >>>+ strcpy(digest_password, sysrq_password);
> >> >>>+ i = strlen(digest_password);
> >> >>>+ sg_set_buf(&sg[1], digest_password, i);
> >> >>
> >> >> Could we directly use sysrq_password instead of copying it to
> >> >> digest_password first?
> >> >
> >> > No :-) Eventually I discovered the reason my code wasn't working
> >> > boils down to the definition of sg_set_buf:
> >> >
> >> > sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf))
> >> >
> >> > which doesn't work for sysrq_password. I don't know why I'll
> >> > double check.
> >>
> >> Well, sysrq_password is in the .bss section, where as digest_password
> >> is on the heap due to being kmalloc'ed. Maybe that makes a difference?
> >> Someone more versed with the virtual memory layer might know.
> >
> >You can't use these interfaces on kernel image addresses.
> >
> Great :-) So what is the best way to use the SHA1 crypto algo
> with in-kernel addresses?
kmalloc and copy it there, or something like that, you just
can't use in-kernel addresses, ever.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: sg_set_page not usable for .bss?
2008-12-02 0:14 ` David Miller
@ 2008-12-02 1:41 ` Jan Engelhardt
2008-12-02 6:55 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: Jan Engelhardt @ 2008-12-02 1:41 UTC (permalink / raw)
To: David Miller; +Cc: john.haxby, netfilter-devel, linux-kernel
On Tuesday 2008-12-02 01:14, David Miller wrote:
>> >>
>> >> Well, sysrq_password is in the .bss section, where as digest_password
>> >> is on the heap due to being kmalloc'ed. Maybe that makes a difference?
>> >> Someone more versed with the virtual memory layer might know.
>> >
>> >You can't use these interfaces on kernel image addresses.
>> >
>> Great :-) So what is the best way to use the SHA1 crypto algo
>> with in-kernel addresses?
>
>kmalloc and copy it there, or something like that, you just
>can't use in-kernel addresses, ever.
>
Yes, kmalloc is already used. But then, what sort of address
does kmalloc return, if not an address within kernelspace?
(usually >=0xc0000000 on standard i386)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: sg_set_page not usable for .bss?
2008-12-02 1:41 ` Jan Engelhardt
@ 2008-12-02 6:55 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2008-12-02 6:55 UTC (permalink / raw)
To: jengelh; +Cc: john.haxby, netfilter-devel, linux-kernel
From: Jan Engelhardt <jengelh@medozas.de>
Date: Tue, 2 Dec 2008 02:41:02 +0100 (CET)
>
> On Tuesday 2008-12-02 01:14, David Miller wrote:
> >> >>
> >> >> Well, sysrq_password is in the .bss section, where as digest_password
> >> >> is on the heap due to being kmalloc'ed. Maybe that makes a difference?
> >> >> Someone more versed with the virtual memory layer might know.
> >> >
> >> >You can't use these interfaces on kernel image addresses.
> >> >
> >> Great :-) So what is the best way to use the SHA1 crypto algo
> >> with in-kernel addresses?
> >
> >kmalloc and copy it there, or something like that, you just
> >can't use in-kernel addresses, ever.
> >
> Yes, kmalloc is already used. But then, what sort of address
> does kmalloc return, if not an address within kernelspace?
> (usually >=0xc0000000 on standard i386)
I said "kernel image" addresses are a problem, not "kernel space."
And by "kernel image" I mean addresses within the confines defined
by the sections of the vmlinux binary.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-12-02 6:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <492E926D.5020807@oracle.com>
[not found] ` <alpine.LNX.1.10.0812011952520.17726@fbirervta.pbzchgretzou.qr>
[not found] ` <49345EE4.3070409@oracle.com>
2008-12-01 22:40 ` sg_set_page not usable for .bss? Jan Engelhardt
2008-12-02 0:10 ` David Miller
2008-12-02 0:13 ` Jan Engelhardt
2008-12-02 0:14 ` David Miller
2008-12-02 1:41 ` Jan Engelhardt
2008-12-02 6:55 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®