linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: thefirst ECS <ecs_dn@yahoo.com>
To: linuxppc-dev@lists.ozlabs.org
Subject: How would I code a Write to a proc file from within the kernel without reading anything from user space?
Date: Wed, 5 Aug 2020 14:52:58 -0700 (PDT)	[thread overview]
Message-ID: <32112832.26959.1596664366002.JavaMail.Dan@DanHP> (raw)
In-Reply-To: <3103222.25048.1596318084416.JavaMail.Dan@DanHP>

In order to help debug a certain discrepancy, I need to "simulate" an "echo 1 > /proc/file" but doing it from kernel even when root file system is unavailable. 

I have simulated it just fine via call_usermodehelper (with argv etc of "echo 1 > /proc/file") from inside the kernel which triggers:
[ee897ec0] [c0122704] proc_reg_write+0x80/0xb4
[ee897ef0] [c00d3b7c] vfs_write+0xb4/0x184

just as I had wanted. But now I need to trigger the "vfs_write" and "proc_reg_write" but without using call_usermodehelper since I will be doing it when root "/" is unavailable and so I can no longer access /bin/echo and call the usermodehelper etc. So my question is how can I do that in kernel?

Not sure if I'm supposed to look in fs read_write.c and fs.h and write a method based on those or if there's some other way etc.

Thanks,
-Dan

  reply	other threads:[~2020-08-05 21:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3103222.25048.1596318084416.JavaMail.Dan.ref@DanHP>
     [not found] ` <11049609.25021.1596315320093.JavaMail.Dan@DanHP>
2020-08-01 21:41   ` Scott Wood fix for SysRQ Crash over Serial Console on Linux PowerPC 2.6.32 kernel? thefirst ECS
2020-08-05 21:52     ` thefirst ECS [this message]
2020-08-06  1:30       ` How would I code a Write to a proc file from within the kernel without reading anything from user space? Michael Ellerman

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=32112832.26959.1596664366002.JavaMail.Dan@DanHP \
    --to=ecs_dn@yahoo.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /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 NNTP newsgroup(s).