Re: Free Linux/Ubuntu VMs for Kernal Development?

2017-03-13 Thread Freeman Zhang


On 3/14/17 12:04 PM, Balaji Barmavat wrote:

> 
> Anybody's has any VM's links to download, for practice kernel programming?
> 

Well, I am using QEMU system emulator, for it's easier to connect to GDB
debugging and itself handles bootloader thing. You can set all things up
by one line parameters, really tidy.

The disadvantage is that I've been told system running in QEMU is slow,
but for kernel programming that wouldn't be the problem, will it?

What about others?


All the best!
Freeman



signature.asc
Description: OpenPGP digital signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: cannot insmod sculld in ldd3

2017-03-12 Thread Freeman Zhang
Hi Greg,


On 3/13/17 3:03 AM, Greg KH wrote:

> 
> 'depmod' handles all of this when you install a kernel and its modules.
> 

Thanks for that information, now I take 'depmod' seriously and stop
making up inelegant methods. I studied the 'kmod', both its behaviors
and codes, and got plenty of ideas about module symbol stuff.

However, I am still wondering why copy Module.symvers file works too, at
building time?

>   step 1.   build lddbus, generate `*.ko` and `Module.symvers`
>   step 2.   copy `Module.symvers` located in lddbus directory
> to sculld directory
>   step 3.   build sculld


All the best!
Freeman




signature.asc
Description: OpenPGP digital signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: cannot insmod sculld in ldd3

2017-03-12 Thread Freeman Zhang
Hi

On 3/11/17 12:49 AM, Ali Aminian wrote:


> i checked dmsg and it says:
> [12073.858764] sculld: no symbol version for unregister_ldd_driver
> [12073.858767] sculld: Unknown symbol unregister_ldd_driver (err -22)
> [12073.858780] sculld: no symbol version for register_ldd_device
> [12073.858781] sculld: Unknown symbol register_ldd_device (err -22)
> [12073.858789] sculld: no symbol version for unregister_ldd_device
> [12073.858790] sculld: Unknown symbol unregister_ldd_device (err -22)
> [12073.858794] sculld: no symbol version for register_ldd_driver
> [12073.858795] sculld: Unknown symbol register_ldd_driver (err -22)
> 
> these functions are defined in lddbus and i have insmod lddbus.


Based on your description, you built two modules: lddbus and sculld.
sculld used the symbols exported in lddbus -- am I right? In this case,
you might want sculld to know these symbols via copying Module.symvers
file generated by the compilation of lddbus to sculld code directory
before building sculld. To make it clear:

step 1.   build lddbus, generate `*.ko` and `Module.symvers`
step 2.   copy `Module.symvers` located in lddbus directory
  to sculld directory
step 3.   build sculld

Just a mixture of guess and experiences... hope it can help!


All the best!
Freeman



signature.asc
Description: OpenPGP digital signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: "kdumpbase" dracut module

2016-03-21 Thread Freeman Zhang
On 3/21/16 9:55 PM, Ronit Halder wrote:
> Thanks for helping
> 
> So, this module is used to dump the crash kernel.
> Am I right?
> If not then can you explain how kdump kernel calls the makedumpfile?
> 

You are absolutely right Ronit. By the time the second kernel is booted,
this module will start a service called kdump-capture, which will
execute kdump.sh, which will invoke makedumpfile after all, depending on
your kdump configuration.

All the best!
Freeman



signature.asc
Description: OpenPGP digital signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: "kdumpbase" dracut module

2016-03-20 Thread Freeman Zhang
 Original Message 
> I want to know what is the job of "kdumpbase" dracut module.
> 
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 

dracut uses modules to include instructions and functions in initramfs. When 
the dump kernel(2nd kernel) is started, it needs to know what action it should 
take to dump the core. It also needs some infrastructure to support those 
actions. Dracut follows the kdumpbase script to build initramfs for the 2nd 
kernel.

Above is my own understanding, hope this will help.

Freeman



signature.asc
Description: OpenPGP digital signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: filesystem encryption problem.

2015-07-12 Thread Freeman Zhang
 Original Message 
> hello
> I am working on adding a simple encryption to file contents in ext4 driver
> (for learning purposes) I added simple XOR encryption to aio_read and
> aio_write functions and it worked until I faced this problem:
> 
> when I open a file in encrypted filesystem using VIM text editor and when I
> try to save it it gives me this error:
> 
>>> pointer block id wrong
>>> can not find line 1
> 
> and it just corrupts the entire file!
> 
> this is my aio_write function:
> 
> aio_write_enc(struct kiocb *iocb, const struct iovec *iov,
> unsigned long nr_segs, loff_t pos)
> {
> size_t i;
> ssize_t ret;
> char *data=vmalloc(sizeof(char)*iov->iov_len);
> copy_from_user(data,iov->iov_base,iov->iov_len);
> 
> for(i=0;iiov_len;i++)
> {
> data[i]^=5;
> }
> struct iovec iov_enc= { .iov_base = iov->iov_base, .iov_len =
> iov->iov_len };
> 
> copy_to_user(iov_enc.iov_base,data,iov->iov_len);
> ret=ext4_file_write(iocb,&iov_enc,nr_segs,pos);
> vfree(data);
> return ret;
> }
> 
> this just changes the data and then calls original function.
> 
> is there anything wrong with this function? can anyone help me?
> 
> 
> 
Hi Amir,

I'm not quite sure about what's wrong with your function, but here are
two suggestions I got from the list when I did similar things:

1. wrapfs
2. ecryptfs

I think you should check these two stackable filesystems if you haven't.

Hope this can help a little bit!

Freeman



signature.asc
Description: OpenPGP digital signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Writing driver for a net device which does not support interrupt

2015-03-23 Thread Freeman Zhang
Hi phil,

Thanks for your reply! I googled timer, it might be a solution except
that interval granularity is a little bit large. This device is for high
performance network. I'm not sure whether the missmatch will cause problem.

And I just figured another potential solution, to use soft interrupt to
active NAPI. I will spend some time to varify these ideas.


Thanks again!
Freeman

 Original Message 
> 
> 
> On 23/03/15 10:51, Freeman Zhang wrote:
>> I'm writing a net device driver for my final project in college. But the
>> half-finished device doesn't support interrupt yet(those hardware
>> guys...)
>>
>> So I'm wondering if there is some way to poll the device for its status
>> and events.
> 
> You should take a look at kernel timers, this is a rather old resource
> and was just the first hit in a google search but it should still be
> relevant.
> 
> http://www.ibm.com/developerworks/library/l-timers-list/
> 
> Kernel timers will sort of prepare you for interrupts i.e. a kernel
> timer will fire every $time_value and you can put your code which should
> normally run during an interrupt in the callback code.
> 
> I've used kernel timers to debug interrupts on our hardware devices,
> i.e. there have been times when the hardware has stopped raising
> interrupts and I've put timers in to cover this. For example a new
> firmware might work fine, but have completely broken interrupts or not
> fire interrupts often enough and timers can prove to the hardware guys
> that it's interrupts at fault ;)
> 
> hint: you might also want to look at tasklets and have your timer
> callback just call a tasklet.
> 
> Phil



signature.asc
Description: OpenPGP digital signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Writing driver for a net device which does not support interrupt

2015-03-23 Thread Freeman Zhang
Hi Valdis,

Thanks for your warning. I feel like I believe in my group and those
engineers. In fact, implementing interrupts is part of the plan, but,
yes, the prototype is really buggy However they are trying hard to
fix it, and I should not stand by just to watch, waiting for the
deadline, should I?

Anyway, this is a serious project. This work need to be done. And I just
figured out something that might solve the current problem and might be
easily modifid when hardware interrupt is available. I think I could use
soft interrupt to active NAPI polling, so that I can use existing
infrastructure, as what 'snull' does. What do you think?


Thanks again!
Freeman

 Original Message 
> On Mon, 23 Mar 2015 18:51:51 +0800, Freeman Zhang said:
>> I'm writing a net device driver for my final project in college. But the
>> half-finished device doesn't support interrupt yet(those hardware guys...)
>>
>> So I'm wondering if there is some way to poll the device for its status
>> and events.
> 
> As a realistic datapoint - if it still doesn't support interrupts, the *rest*
> of it is probably still so buggy that trying to write a driver isn't worth
> the effort.
> 
> It's doable if you are working with a group of talented and experienced
> engineers - but if the hardware is also being done as a final project,
> you're in for naught but misery.
> 
> You *could* do something like this:
> 
>   while (waiting) {
>   status = read_status_bits(your_device);
>   if (status & DATA_AVAIL_MASK) break;
>   msleep(100);
>   }
> 
> But having seen enough student hardware design projects in my life, I estimate
> that if it still can't signal interrupts, the status bits probably aren't 
> valid
> either. (Think about it - a bog-simple implementation of interrupts would be
> to just feed a transition-high on the appropriate status bit to the interrupt
> pin, and use a read from the chip to clear the pin).
> 
> Good luck - I suspect you're going to need it
> 



signature.asc
Description: OpenPGP digital signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Writing driver for a net device which does not support interrupt

2015-03-23 Thread Freeman Zhang
Hi list,

I'm writing a net device driver for my final project in college. But the
half-finished device doesn't support interrupt yet(those hardware guys...)

So I'm wondering if there is some way to poll the device for its status
and events.

Google tells me 'NAPI' uses a polling mechanism, but it still needs
hardware interrupt support :(

Any suggestions?


Thanks
Freeman



signature.asc
Description: OpenPGP digital signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to git clone kernel source fast?

2014-12-10 Thread Freeman Zhang

Hi Michael,

I am an undergraduate from China. I asked a similar question in the list
several days ago.

Considering the connecting situation in my city(Nanjing, Jiangsu), I
used CHINATELECOM and it can speed up over 2MB/s when cloning the souce
tree. I don't think it is the GFW that causes trouble.

My suggestion is changing to another ISP. Alternatively, I can share my
mainline kernel tree(git cloned from git.kernel.org) with you via Baidu Pan:

http://pan.baidu.com/s/1pJ5akjD

You need to `git pull` to update it after uncompressing because it is a
little bit out-of-date.


Hope this can help!
Freeman

 Original Message 
> Hi, Ming Lin
> 
> 
> I'm a college student in China. My research for the master degree is related 
> to Linux kernel, which has driven me to learn a lot about the kernel. Thus It 
>  makes me eager to be a kernel contributor. I want to participate the project 
> "Block layer projects that I haven't had time for" raised by Kent. I have 
> read the mails about it in lkml and the source code.
> 
> 
> But there is still two problems. 
> 1. Until now my way of getting source is directly download tar package from 
> kernel.org. I know it will be better to use git, but I found that it is quite 
> slow with the speed of only 20 KB per second. I have configured my PC to by 
> pass the annoying GFW so I think it is nothing with it.
> 
> 
> I guess you're also in China from your name and you are also participating in 
> this project. So could you help me with it?
> 
> 
> 2. I'm not quite sure about which tree should I clone and whether the bcache 
> branch is contained in mainline kernel tree. If not, should I clone the 
> bcache tree from this address http://evilpiepirate.org/git/linux-bcache.git? 
> And I found the address https://github.com/dongsupark/linux%3E gives me a 404 
> not found response, which is mentioned in lkml by Donsu Park
> 
> 
> Thanks a lot!
> 
> 
> Michael
> 
> 
> 
> 
> 
> 
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 



signature.asc
Description: OpenPGP digital signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Problem in Getting Mainline Kernel

2014-12-04 Thread Freeman Zhang
My cloning process showed no visible errors, but 'git status' print
thousands of [Deleted]. I think that is why I miss nearly all the
directories in my git directory.

Anyway, now I'm using:

rsync -av --progress
rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git .

rsync is resumable. Hope it works :)


All the best!
Freeman
 Original Message 
> Am 04.12.14 um 14:58 schrieb Freeman Zhang:
>> Hi Kristof,
>>
>> You are right, I did clone the source on mac os. And I am really
>> suffering :(
> 
> I just tried it myself. Cloning works at least without *visible* errors.
> Cross compiling on OSX will lead to errors though I guess because of the
> aforementioned case insensivity.
> 
> I'm on Yosemity, btw.
> 
>>
>>
>> All the best!
>>
>> Freeman
>>
>>  Original Message 
>>> On 2014-12-04 20:21:58 (+0800), Freeman Zhang
>>>  wrote:
>>>> Finally I cloned the mainline kernel from
>>>> "git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git".
>>>> However, when I'm looking at the git directory, I got nothing but:
>>>>
>>>> .   ..arch  .DS_Store  .git  .gitignore  .mailmap
>>>>
>>> Are you by any chance trying to do this on an OS X machine?
>>> That's going to lead to pain and suffering.
>>>
>>> For example, there are a couple of files which have the same name with
>>> different case, which isn't going to work on a default OS X install.
>>> By default OS X has a case insensitive file system. It's possible to
>>> change that, but you *really* want a Linux system to build the kernel.
>>>
>>> Regards,
>>> Kristof
>>>
>>
>>
>>
>> ___
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>



signature.asc
Description: OpenPGP digital signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Problem in Getting Mainline Kernel

2014-12-04 Thread Freeman Zhang
Hi Kristof,

You are right, I did clone the source on mac os. And I am really
suffering :(


All the best!

Freeman

 Original Message 
> On 2014-12-04 20:21:58 (+0800), Freeman Zhang  
> wrote:
>> Finally I cloned the mainline kernel from
>> "git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git".
>> However, when I'm looking at the git directory, I got nothing but:
>>
>>  .   ..  arch  .DS_Store  .git  .gitignore  .mailmap
>>
> Are you by any chance trying to do this on an OS X machine?
> That's going to lead to pain and suffering.
> 
> For example, there are a couple of files which have the same name with
> different case, which isn't going to work on a default OS X install.
> By default OS X has a case insensitive file system. It's possible to
> change that, but you *really* want a Linux system to build the kernel.
> 
> Regards,
> Kristof
> 



signature.asc
Description: OpenPGP digital signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Problem in Getting Mainline Kernel

2014-12-04 Thread Freeman Zhang
Hi list,

I cloned it for nearly 30 hours due to the poor connection :( How I wish
the cloning process is resumable.

Finally I cloned the mainline kernel from
"git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git".
However, when I'm looking at the git directory, I got nothing but:

.   ..  arch  .DS_Store  .git  .gitignore  .mailmap

I'm confused. I thought it would be like this:

arch   include  mm   security
block  init modules.builtin  sound
COPYINGipc  modules.orderSystem.map
CREDITSKbuild   Module.symvers   tools
crypto Kconfig  net  usr
Documentation  kernel   README   virt
driverslib  REPORTING-BUGS   vmlinux
firmware   MAINTAINERS  samples  vmlinux.o
fs Makefile scripts

Is my clone broken? I ran `git pull` and it said the clone is
up-to-date. And the size of .git directory is over 1 GB.

Now I'm using `tar.xz` from kernel.org and it works just fine. But I
still want to know what I should do with my git clone.


All the best!

Freeman Zhang







signature.asc
Description: OpenPGP digital signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Debug Kernel Modules With KGDB

2014-12-01 Thread Freeman Zhang
Hi Raghavendra,

Yes, you are right, 'sudo' isn't implemented in android. However, `su`
enable me to read the .text as root. It's the same, 0x.

So I guess something else should be wrong.


Thanks anyway!

Freeman Zhang

 Original Message 
> Hi Zhang,
> 
> On Monday 01 December 2014 04:32 PM, Freeman Zhang wrote:
>> Hi Raghavendra,
>>
>> Thanks for your reply, but `sudo` doesn't solve the problem :(
> Well then I guess 'sudo' isn't implemented in android. Any way,
> ultimately you may wan't to login as root and then try reading the file
> in order to get the address.
> Regards,
> Raghavendra
>>
>> All the best!
>>
>> Freeman Zhang
>>
>>  Original Message 
>>> On Monday 01 December 2014 03:26 PM, Freeman Zhang wrote:
>>>> Hi list,
>>>>
>>>> I've been trying to setup a debug environment for linux
>>>> kernel(v3.4,Android,ARM) with kgdb. It worked fine untill I tried to
>>>> use
>>>> it to debug a module. Under the instruction from LDD, I add module
>>>> debug
>>>> info in gdb with command:
>>>>
>>>>  add-symbol-file test-module.ko  address
>>>>
>>>> LDD uses `cat /sys/module/test-module/sections/.text` to get the
>>>> address
>>>> where the module has been loaded. However, I got:
>>>>   0x
>>> Try reading the file as a root.
>>> $ sudo cat /sys/module/test-module/sections/.text
>>>> When I use `lsmod`, I got:
>>>>
>>>>  test-module 15278 0 - Live 0x (O)
>>>>
>>>> Why nothing but 0x ??
>>>>
>>>> So I have to do some research in kernel/module.c, and find out that
>>>> struct module -> module_core = 0xbf00. But when I try these in gdb:
>>>>
>>>>  add-symbol-file test-module.ko  0xbf00
>>>>  break one_of_my_function
>>>>
>>>> I got:
>>>>
>>>>  Cannot access memory at address 0xbf002350
>>>>
>>>> :(
>>>> Could somebody help?
>>>>
>>>>
>>>> All the best!
>>>> Freeman Zhang
>>>>
>>>>  
>>>>
>>>>
>>>>
>>>> ___
>>>> Kernelnewbies mailing list
>>>> Kernelnewbies@kernelnewbies.org
>>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>
>>> ---
>>>
>>>
>>> [ C-DAC is on Social-Media too. Kindly follow us at:
>>> Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]
>>>
>>> This e-mail is for the sole use of the intended recipient(s) and may
>>> contain confidential and privileged information. If you are not the
>>> intended recipient, please contact the sender by reply e-mail and
>>> destroy
>>> all copies and the original message. Any unauthorized review, use,
>>> disclosure, dissemination, forwarding, printing or copying of this email
>>> is strictly prohibited and appropriate legal action will be taken.
>>> ---
>>>
>>>
>>>
>>>
>>>
>>>
>>> ___
>>> Kernelnewbies mailing list
>>> Kernelnewbies@kernelnewbies.org
>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>
> 
> 
> ---
> 
> [ C-DAC is on Social-Media too. Kindly follow us at:
> Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]
> 
> This e-mail is for the sole use of the intended recipient(s) and may
> contain confidential and privileged information. If you are not the
> intended recipient, please contact the sender by reply e-mail and destroy
> all copies and the original message. Any unauthorized review, use,
> disclosure, dissemination, forwarding, printing or copying of this email
> is strictly prohibited and appropriate legal action will be taken.
> ---
> 
> 



signature.asc
Description: OpenPGP digital signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Debug Kernel Modules With KGDB

2014-12-01 Thread Freeman Zhang
Hi Raghavendra,

Thanks for your reply, but `sudo` doesn't solve the problem :(


All the best!

Freeman Zhang

 Original Message 
> On Monday 01 December 2014 03:26 PM, Freeman Zhang wrote:
>> Hi list,
>>
>> I've been trying to setup a debug environment for linux
>> kernel(v3.4,Android,ARM) with kgdb. It worked fine untill I tried to use
>> it to debug a module. Under the instruction from LDD, I add module debug
>> info in gdb with command:
>>
>> add-symbol-file test-module.ko  address
>>
>> LDD uses `cat /sys/module/test-module/sections/.text` to get the address
>> where the module has been loaded. However, I got:
>> 
>> 0x
> Try reading the file as a root.
> $ sudo cat /sys/module/test-module/sections/.text
>>
>> When I use `lsmod`, I got:
>>
>> test-module 15278 0 - Live 0x (O)
>>
>> Why nothing but 0x ??
>>
>> So I have to do some research in kernel/module.c, and find out that
>> struct module -> module_core = 0xbf00. But when I try these in gdb:
>>
>> add-symbol-file test-module.ko  0xbf00
>> break one_of_my_function
>>
>> I got:
>>
>> Cannot access memory at address 0xbf002350
>>
>> :(
>> Could somebody help?
>>
>>
>> All the best!
>> Freeman Zhang
>>
>> 
>> 
>>
>>
>>
>>
>> ___
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 
> 
> ---
> 
> [ C-DAC is on Social-Media too. Kindly follow us at:
> Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]
> 
> This e-mail is for the sole use of the intended recipient(s) and may
> contain confidential and privileged information. If you are not the
> intended recipient, please contact the sender by reply e-mail and destroy
> all copies and the original message. Any unauthorized review, use,
> disclosure, dissemination, forwarding, printing or copying of this email
> is strictly prohibited and appropriate legal action will be taken.
> ---
> 
> 
> 
> 
> 
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 



signature.asc
Description: OpenPGP digital signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Debug Kernel Modules With KGDB

2014-12-01 Thread Freeman Zhang
Hi list,

I've been trying to setup a debug environment for linux
kernel(v3.4,Android,ARM) with kgdb. It worked fine untill I tried to use
it to debug a module. Under the instruction from LDD, I add module debug
info in gdb with command:

add-symbol-file test-module.ko  address

LDD uses `cat /sys/module/test-module/sections/.text` to get the address
where the module has been loaded. However, I got:

0x

When I use `lsmod`, I got:

test-module 15278 0 - Live 0x (O)

Why nothing but 0x ??

So I have to do some research in kernel/module.c, and find out that
struct module -> module_core = 0xbf00. But when I try these in gdb:

add-symbol-file test-module.ko  0xbf00
break one_of_my_function

I got:

Cannot access memory at address 0xbf002350

:(
Could somebody help?


All the best!
Freeman Zhang







signature.asc
Description: OpenPGP digital signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Share the project directory or a patch?

2014-10-15 Thread Freeman Zhang
Hi list,

I'm building a kernel module (a stackable file system) with some
userspace tools, and I'd like to share them. I don't know if I should
share it in the form of patch or just as a pack of source codes. Under
which circumstances do I need to make a patch?

All the best!
Freeman

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Problem in Compiling Wireless Adapter(9271) Driver for Cubieboard

2014-08-18 Thread Freeman Zhang
Hi anupam,

Thanks so much for your information. It is of great value!

May I ask how did you find that? In case I run into similar situation
next time so that I can help myself, as well as others.

Thanks agagin!
Freeman Zhang
On 2014-08-18 16:52, anupam kapoor wrote:
>>>>>> [Mon, 18 Aug 2014 16:41:32 +0800]: "Freeman Zhang" (freeman-zhang):
> ,[ freeman-zhang ]
> | In file included from include/linux/timex.h:174:0,
> | from include/linux/jiffies.h:8,
> | from include/linux/ktime.h:25,
> | from include/linux/timer.h:5
> | from include/linux/workqueue.h:8,
> | from include/linux/kmod.h:26
> | from include/linux/module.h:13
> | from /home/cubie/src/ath9k/htc.h:20,
> | from /home/cubie/src/ath9k/htc_hst.c:17:
> | /usr/src/linux-headers-3.4.79-sun7i/arch/arm/include/asm/timex.h:15:24:
> | fatal error: mach/timex.h: No such file or directory
> `
> http://lists.infradead.org/pipermail/linux-arm-kernel/2011-August/060045.html
>
> kind regards
> anupam


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Problem in Compiling Wireless Adapter(9271) Driver for Cubieboard

2014-08-18 Thread Freeman Zhang
Hi List,

I don't know how many people in the list have played with cubieboard. It
is really fun :D
The Sad thing is that, I have a usb wireless adapter TL-WN721N(with 9271
chipset) that doesn't work
on the board. The system is Cubian Linux(derieved from Debian for the
cubieboard).

I googled around, find the driver is called "ath9k_htc". Later, I find
the driver's source code in
the kernel for Cubian. I compiled it but all I'd got is this:

In file included from include/linux/timex.h:174:0,
from include/linux/jiffies.h:8,
from include/linux/ktime.h:25,
from include/linux/timer.h:5
from include/linux/workqueue.h:8,
from include/linux/kmod.h:26
from include/linux/module.h:13
from /home/cubie/src/ath9k/htc.h:20,
from /home/cubie/src/ath9k/htc_hst.c:17:
/usr/src/linux-headers-3.4.79-sun7i/arch/arm/include/asm/timex.h:15:24:
fatal error: mach/timex.h: No such file or directory

How can I deal with this error?
Does the existence of the driver's code in the kernel source means that
it has already been ported to Cubian?

You can get more information about Cubian and its kernel source in:
http://cubian.org/sources/

Thanks for your attention!
Freeman Zhang
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Beagleboard and Panda Board Drivers

2014-08-17 Thread Freeman Zhang
Hi,

The list is of great importance to me. I always get great ideas from it,
even just by hearing the conversation.
It is very scary to hear that the experts are leaving!

I miss the old, friendly and comfortable environment. Please, stay calm.

All the best,
Freeman Zhang

On 2014-08-18 12:16, Saket Sinha wrote:
> Hi All,
>
> Its really sad that many experts on Linux who have guided me and many
> others like me  are leaving this list just because of some people who
> do not deserve to be on this list.
>
> I request them not to take such abrupt steps deriving many of us of
> their precious guidance and mentor-ship. This list has personally
> helped me a lot in ways when even days of googling  and searching did
> not work.
>
> I know, with people like  Nick this becomes very irritating but lets
> take his mails as spams. I get a feeling that he has been deliberately
> trying to get on the nerves of many just to damage their intention and
> gesture of helping others.
>
> But provided that this list has helped me so much, I try to put up
> with his mails I request and  pray,  none of the experts and even
> novices and advocates of FOSS whose discussions and questions are so
> valuable, not to leave this list and consider Nick and his mails as
> non-existent.
>
> Regards,
> Saket Sinha
>
>
>
>
>
>
>
>
>
>
> On Mon, Aug 18, 2014 at 9:23 AM, Brad Rex  <mailto:brad...@gmail.com>> wrote:
>
> On Sun, Aug 17, 2014 at 8:02 PM, Nick Krause  <mailto:xerofo...@gmail.com>> wrote:
>
> I forget about that thanks Dave. In addition , Brad Rex due to my
> memory and my Asperger's  I am
> able to do lots of complicated things in my head. Further more
> I learn
> really fast  in my areas of interest,
> after my first year of programming I was already have build my own
> distro of Linux from Scratch, and
> after my second year was learning how to program embedded
> bootloaders
> and the like.  I am not lying
> this is no joke and rather common with how high functioning my
> As is.
> Cheers and Thanks Again,
>
>
> My sincerest apologies in not taking into account your abilities.
>  Given your past dialog with both this list and LKML, you can
> forgive me in not being able to fully grasp what you can and
> cannot do.  Clearly, I'm in the wrong, and myself, and I'm sure
> many others, have underestimated what you bring to the table.
>
> I wish you the best of luck working on Linux ARM-based processors
> without hardware in hand.  My office cube is full of Cortex
> A-8/9/15 hardware from different manufacturers.  I guess I've been
> doing it wrong all these years.
>
> And with that, I'll be leaving this list, just like others have.
>  While I never contributed in direct ways to the list, I did
> benefit from it, and those learnings came out in the code I
> created for my customers.  I shall miss Valdis' emails: curt,
> funny, and to the point.  Apparently I'm not worthy enough to be
> working with or on the kernel or it's drivers, as there are others
> with way more skill than I have that should be leading the charge.
>  My years of working on Android, creating tablets, making IP
> phones, developing VR glasses, creating car infotainment systems,
> and just plain using Linux as my development environment were just
> silly endeavors on my part.
>
> PS.  Don't bother responding.  Your response will be send to
> /dev/null. 
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> <mailto:Kernelnewbies@kernelnewbies.org>
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Make queues in kernel space

2014-07-04 Thread Freeman Zhang
Hi,
On 2014-07-04 13:50, Robert Clove wrote:
> Hi All,
>
> How we create queues in kernel space and what are the size limit ?
>
> Regards
>
That should be kfifo. Check this:
http://thelinuxdesk.com/tag/linux-kernel-queue/ 
Hope this can help  :D


All the best!
Freeman
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to use keyring in the kernel?

2014-07-03 Thread Freeman Zhang
Hi,

On Thu, 03 Jul 2014 22:34, valdis.kletni...@vt.edu wrote:
> On Thu, 03 Jul 2014 17:12:15 +0800, Freeman Zhang said:
>
>> And most importantly, what if someone need to manipulate
>> (created, updated and read) keys(not keyring) in kernel
>> services while user key type "aren't intended" for that?
> Why would the kernel be doing that in the first place, when it can
> just use a key that's *not* either a user key or a keyring?
Oh, that's why we should define our own key types.
Thank you Valdis!

Freeman

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


How to use keyring in the kernel?

2014-07-03 Thread Freeman Zhang
Hi List!

Recently I want to play with kernel keyring facilities. But
I find out that only a few programs like eCryptfs using
kernel keyring. I read the documents. It said:

The key service defines two special key types:

(+) "keyring"

Keyrings are special keys that contain a list of other keys. Keyring
lists can be modified using various system calls. Keyrings should not
be given a payload when created.

(+) "user"

A key of this type has a description and a payload that are arbitrary
blobs of data. These can be created, updated and read by userspace,
and aren't intended for use by kernel services.

Does it means we keep the keyring in the kernel only for
userspace programs to use? How can this strategy ensure
security?

And most importantly, what if someone need to manipulate
(created, updated and read) keys(not keyring) in kernel
services while user key type "aren't intended" for that?



All the best!
Freeman

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


How to use kernel crypto

2014-06-14 Thread Freeman Zhang
Hi list,

Recently I'm learning to use kernel crypto. I find some examples but
they are out of date.
I manage to write a test program, trying to use aes to encrypt 'buf'
,but something goes wrong:

struct scatterlist sg;
struct crypto_blkcipher *tfm;
struct blkcipher_desc desc;
unsigned char buf[10];
char *key = "00112233445566778899aabbccddeeff";
int keylen = 16;

memset(buf, 'A', 10);
tfm = crypto_alloc_blkcipher("ecb(aes)", 0, CRYPTO_ALG_ASYNC);
crypto_blkcipher_setkey(tfm,key,keylen);
desc.tfm = tfm;
desc.flags = 1;
sg_init_one(&sg, buf, 10);
crypto_blkcipher_encrypt(&desc, &sg, &sg, 10);
sg_set_buf(&sg, buf,10);
hexdump(buf,10);

The result of hexdump(buf) shows that 'buf' stay unchanged. What should
I do to encrypt the buffer?


All the best!
Freeman Zhang

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Help] How to use linux kernel crypto

2014-03-14 Thread Freeman Zhang
Hi List,

My transparent encryption filesystem goes fine with wrapfs framework.
Just now I finished coding the Android Locking Screen application that
works with the kernel filesystem module. But I get stuck again when it
come to using AES to encrypt and decrypt data of files.

I've read the documents in kernel/documentation/crypto/ but found
nothing helpful ( Wrong place? :-S )

Would anyone introduce me to a demo showing how to use it , or some
other documents?
Or maybe I need a third-party crypto that can work in the kernel.
Thanks!




All the best!
Freeman Zhang

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: how to deal with page

2014-03-06 Thread Freeman Zhang
Hi,

 2014-03-06 17:20 于运超:
> Hi. nowdays i am studing Transparent encryption in linux system. when
> reading file needs do_generic_file_read function decrpty file. but in
> do_generic_file_read Physical data using struct page ,how did i use
> page decrpty.
Maybe you need to do en/decryption in the address_space operations,
which is used with struct page. The do_generic_file_read will evoke the
page->mapping->a_ops->readpage, and the readpage is  one of the
address_space operations. So I guess that's what you want.
Hope this can help!



Regards,
Freeman Zhang

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: [Help] How to Replace File Operations in File System?

2014-02-23 Thread Freeman Zhang

Hi,
Sorry about the delayed response. To be frank, I haven't think over
these stuff
seriously. I didn't expect too much about the module at first. Now I
know I was
wrong. I shouldn't  get through it rashly-people are watching on me!
And I  believe I can make it with the help and advice I got from all of
you.
Thank you!

> The first question is - what are you trying to protect against? The
> answer to that will influence your design.
>
> As Bruce Schneier said in the intro to Applied Cryptography:
>
> There are two kinds of cryptography in this world: cryptography that will stop
> your kid sister from reading your files, and cryptography that will stop major
> governments from reading your files. This book is about the latter.
>
> It's one thing to write a silly kernel module that will rot13 your
> files.  It's totally another to design a complete system that works.
>
> Do you need to worry about a directory being open for access to encrypted
> files, and another rogue process on the system simply going and reading
> the files and the crypto doesn't matter? (This is an issue for cryptLUKS,
> for instance - it defends against somebody stealing a powered-off laptop,
> but not against processes that get access to a running system.  You may wish
> to think for a bit about what security is provided by a system that is
> suspended, rather than powered off - particularly in the case of
> cold-boot attacks)
>
> Do you need to worry about somebody replacing the binary that prompts
> the user for the passphrase before loading it into the kernel, with a
> version that saves the passphrase for later, after the device has been
> "recovered" via theft or similar? (And yes, this *has* been used before,
> see 'FBI v Scarfo', where they installed a keylogger to snag a PGP passphrase:
>
> https://epic.org/crypto/scarfo.html
>
> Do you need to worry about other more generic keystroke loggers?
>
> Do you need to worry about the fact that most user passphrases won't
> have enough entropy to be used directly as crypto keys?  If you merely
> use the passphrase for salting a randomized key (such as the way gpg,
> ssh, and cryptLUKS use your passphrase), how do you address the problem
> of insufficient random entropy at key generation time?
>
> That's just the obvious stuff you will need to worry about. :)
>
Regards
Freeman Zhang
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies