Discussion:
[chromium-discuss] How to do system calls from chromium on Android
Abhishek Kanike
2018-06-28 18:40:18 UTC
Permalink
Hi,
I am working in chromium for an application on Android. When i try to do a
system call, i am getting a non zero return value. That means the system
call is not working.
Basically I am just checking (copying to /sdcard/) the usermap of chromium
browser process (from /proc/<pid>/usermap).
I am guessing this is because chrome is running as a sandbox process. I
tried to disable sandbox, by passing --no-sandox as run time parameter to
chrome.
But when i pass this flag, chromium is crashing.

Can anyone please help me in accessing system files?

Regards,
K Abhishek
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Torne (Richard Coles)
2018-06-28 20:09:58 UTC
Permalink
Android has its own application sandbox which *all* applications on android
are subject to, and you cannot disable this. The Chrome browser process is
just as subject to the general android app sandbox as any other android app
is.
Post by Abhishek Kanike
Hi,
I am working in chromium for an application on Android. When i try to do a
system call, i am getting a non zero return value. That means the system
call is not working.
Basically I am just checking (copying to /sdcard/) the usermap of chromium
browser process (from /proc/<pid>/usermap).
I am guessing this is because chrome is running as a sandbox process. I
tried to disable sandbox, by passing --no-sandox as run time parameter to
chrome.
But when i pass this flag, chromium is crashing.
Can anyone please help me in accessing system files?
Regards,
K Abhishek
--
--
http://groups.google.com/a/chromium.org/group/chromium-discuss
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Abhishek Kanike
2018-06-29 14:26:45 UTC
Permalink
Hi,​
Yeah. It follows a seccomp-bpf sandbox technique (
https://chromium.googlesource.com/chromium/src/+/lkgr/docs/linux_sandboxing.md
)
We can see different sandbox status at chrome://sandbox.

I tried reading process map through File pointers as following:

* // Reading process map... start*
size_t datalen_ = 0;
char* data_;
char filename[1024];
sprintf(filename, "/proc/%d/maps", (int) getpid());

FILE* fp = fopen(filename, "r");
if (fp != nullptr) {
for (;;) {
char buffer[256];
size_t n = fread(buffer, 1, sizeof(buffer), fp);
if (n == 0) {
break;
}
datalen_ += n;
}
fclose(fp);
}



* // Read the contents of the cpuinfo file.* data_ = new char[datalen_
+ 1];
fp = fopen(filename, "r");
if (fp != nullptr) {
for (size_t offset = 0; offset < datalen_; ) {
size_t n = fread(data_ + offset, 1, datalen_ - offset, fp);
if (n == 0) {
break;
}
offset += n;
}
fclose(fp);
}


* // Zero-terminate the data.* data_[datalen_] = '\0';
When I redirected this *data_* to adb logcat complete process map was not
outputted.

Any suggestions in accessing or copy process map (from /proc/<pid>/maps) to
external storage (/sdcard)/?
Post by Torne (Richard Coles)
Android has its own application sandbox which *all* applications on
android are subject to, and you cannot disable this. The Chrome browser
process is just as subject to the general android app sandbox as any other
android app is.
Post by Abhishek Kanike
Hi,
I am working in chromium for an application on Android. When i try to do
a system call, i am getting a non zero return value. That means the system
call is not working.
Basically I am just checking (copying to /sdcard/) the usermap of
chromium browser process (from /proc/<pid>/usermap).
I am guessing this is because chrome is running as a sandbox process. I
tried to disable sandbox, by passing --no-sandox as run time parameter
to chrome.
But when i pass this flag, chromium is crashing.
Can anyone please help me in accessing system files?
Regards,
K Abhishek
--
--
http://groups.google.com/a/chromium.org/group/chromium-discuss
--
Cheers,
K Abhishek
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Angelo Mantellini
2018-06-29 14:46:10 UTC
Permalink
Hi,

Do you pass parameters in the compilation phase?

Or do you run chromium passing arguments? I’m talking about android.

Thank you



From: <chromium-***@chromium.org> on behalf of Abhishek Kanike <***@gmail.com>
Reply-To: <***@gmail.com>
Date: Friday, June 29, 2018 at 4:26 PM
To: <***@chromium.org>
Cc: <chromium-***@chromium.org>
Subject: Re: [chromium-discuss] How to do system calls from chromium on Android



Hi,​

Yeah. It follows a seccomp-bpf sandbox technique (https://chromium.googlesource.com/chromium/src/+/lkgr/docs/linux_sandboxing.md)

We can see different sandbox status at chrome://sandbox.



I tried reading process map through File pointers as following:



// Reading process map... start

size_t datalen_ = 0;

char* data_;

char filename[1024];

sprintf(filename, "/proc/%d/maps", (int) getpid());



FILE* fp = fopen(filename, "r");

if (fp != nullptr) {

for (;;) {

char buffer[256];

size_t n = fread(buffer, 1, sizeof(buffer), fp);

if (n == 0) {

break;

}

datalen_ += n;

}

fclose(fp);

}





// Read the contents of the cpuinfo file.
data_ = new char[datalen_ + 1];
fp = fopen(filename, "r");
if (fp != nullptr) {
for (size_t offset = 0; offset < datalen_; ) {
size_t n = fread(data_ + offset, 1, datalen_ - offset, fp);
if (n == 0) {
break;
}
offset += n;
}
fclose(fp);
}

// Zero-terminate the data.
data_[datalen_] = '\0';

When I redirected this data_ to adb logcat complete process map was not outputted.



Any suggestions in accessing or copy process map (from /proc/<pid>/maps) to external storage (/sdcard)/?





On Thu, Jun 28, 2018 at 3:10 PM Torne (Richard Coles) <***@chromium.org> wrote:

Android has its own application sandbox which *all* applications on android are subject to, and you cannot disable this. The Chrome browser process is just as subject to the general android app sandbox as any other android app is.



On Thu, 28 Jun 2018 at 14:40 Abhishek Kanike <***@gmail.com> wrote:

Hi,

I am working in chromium for an application on Android. When i try to do a system call, i am getting a non zero return value. That means the system call is not working.

Basically I am just checking (copying to /sdcard/) the usermap of chromium browser process (from /proc/<pid>/usermap).

I am guessing this is because chrome is running as a sandbox process. I tried to disable sandbox, by passing --no-sandox as run time parameter to chrome.

But when i pass this flag, chromium is crashing.



Can anyone please help me in accessing system files?



Regards,

K Abhishek
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss
--
Cheers,

K Abhishek
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Abhishek Kanike
2018-06-29 14:51:25 UTC
Permalink
​
I tried passing in runtime by writing into
/data/local/tmp/chrome-command-line file
​
Post by Angelo Mantellini
Hi,
Do you pass parameters in the compilation phase?
Or do you run chromium passing arguments? I’m talking about android.
Thank you
*Date: *Friday, June 29, 2018 at 4:26 PM
*Subject: *Re: [chromium-discuss] How to do system calls from chromium on
Android
Hi,​
Yeah. It follows a seccomp-bpf sandbox technique (
https://chromium.googlesource.com/chromium/src/+/lkgr/docs/linux_sandboxing.md
)
We can see different sandbox status at chrome://sandbox.
* // Reading process map... start*
size_t datalen_ = 0;
char* data_;
char filename[1024];
*sprintf*(filename, "/proc/%d/maps", (*int*) getpid());
FILE* fp = fopen(filename, "r");
*if* (fp != nullptr) {
*for* (;;) {
char buffer[256];
size_t n = fread(buffer, 1, sizeof(buffer), fp);
*if* (n == 0) {
*break*;
}
datalen_ += n;
}
fclose(fp);
}
*//*
* Read the contents of the cpuinfo file.* data_ = *new* char[datalen_
+ 1];
fp = fopen(filename, "r");
*if* (fp != nullptr) {
*for* (size_t offset = 0; offset < datalen_; ) {
size_t n = fread(data_ + offset, 1, datalen_ - offset, fp);
*if* (n == 0) {
*break*;
}
offset += n;
}
fclose(fp);
}
*//*
* Zero-terminate the data.* data_[datalen_] = '\0';
When I redirected this *data_* to adb logcat complete process map was not
outputted.
Any suggestions in accessing or copy process map (from /proc/<pid>/maps)
to external storage (/sdcard)/?
Android has its own application sandbox which *all* applications on
android are subject to, and you cannot disable this. The Chrome browser
process is just as subject to the general android app sandbox as any other
android app is.
Hi,
I am working in chromium for an application on Android. When i try to do a
system call, i am getting a non zero return value. That means the system
call is not working.
Basically I am just checking (copying to /sdcard/) the usermap of chromium
browser process (from /proc/<pid>/usermap).
I am guessing this is because chrome is running as a sandbox process. I
tried to disable sandbox, by passing --no-sandox as run time parameter to
chrome.
But when i pass this flag, chromium is crashing.
Can anyone please help me in accessing system files?
Regards,
K Abhishek
--
--
http://groups.google.com/a/chromium.org/group/chromium-discuss
--
Cheers,
K Abhishek
--
--
http://groups.google.com/a/chromium.org/group/chromium-discuss
---
You received this message because you are subscribed to the Google Groups
"Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
Cheers,
K Abhishek
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Angelo Mantellini
2018-06-29 14:58:27 UTC
Permalink
I put in /data/local/tmp/chrome-command-line “chrome --no-sandbox”, but the sandbox is always alive



From: Abhishek Kanike <***@gmail.com>
Date: Friday, June 29, 2018 at 4:51 PM
To: Angelo Mantellini <***@gmail.com>
Cc: <***@chromium.org>, <chromium-***@chromium.org>
Subject: Re: [chromium-discuss] How to do system calls from chromium on Android



​

I tried passing in runtime by writing into /data/local/tmp/chrome-command-line file

​





On Fri, Jun 29, 2018 at 9:46 AM Angelo Mantellini <***@gmail.com> wrote:

Hi,

Do you pass parameters in the compilation phase?

Or do you run chromium passing arguments? I’m talking about android.

Thank you



From: <chromium-***@chromium.org> on behalf of Abhishek Kanike <***@gmail.com>
Reply-To: <***@gmail.com>
Date: Friday, June 29, 2018 at 4:26 PM
To: <***@chromium.org>
Cc: <chromium-***@chromium.org>
Subject: Re: [chromium-discuss] How to do system calls from chromium on Android



Hi,​

Yeah. It follows a seccomp-bpf sandbox technique (https://chromium.googlesource.com/chromium/src/+/lkgr/docs/linux_sandboxing.md)

We can see different sandbox status at chrome://sandbox.



I tried reading process map through File pointers as following:



// Reading process map... start

size_t datalen_ = 0;

char* data_;

char filename[1024];

sprintf(filename, "/proc/%d/maps", (int) getpid());



FILE* fp = fopen(filename, "r");

if (fp != nullptr) {

for (;;) {

char buffer[256];

size_t n = fread(buffer, 1, sizeof(buffer), fp);

if (n == 0) {

break;

}

datalen_ += n;

}

fclose(fp);

}





// Read the contents of the cpuinfo file.
data_ = new char[datalen_ + 1];
fp = fopen(filename, "r");
if (fp != nullptr) {
for (size_t offset = 0; offset < datalen_; ) {
size_t n = fread(data_ + offset, 1, datalen_ - offset, fp);
if (n == 0) {
break;
}
offset += n;
}
fclose(fp);
}

// Zero-terminate the data.
data_[datalen_] = '\0';

When I redirected this data_ to adb logcat complete process map was not outputted.



Any suggestions in accessing or copy process map (from /proc/<pid>/maps) to external storage (/sdcard)/?





On Thu, Jun 28, 2018 at 3:10 PM Torne (Richard Coles) <***@chromium.org> wrote:

Android has its own application sandbox which *all* applications on android are subject to, and you cannot disable this. The Chrome browser process is just as subject to the general android app sandbox as any other android app is.



On Thu, 28 Jun 2018 at 14:40 Abhishek Kanike <***@gmail.com> wrote:

Hi,

I am working in chromium for an application on Android. When i try to do a system call, i am getting a non zero return value. That means the system call is not working.

Basically I am just checking (copying to /sdcard/) the usermap of chromium browser process (from /proc/<pid>/usermap).

I am guessing this is because chrome is running as a sandbox process. I tried to disable sandbox, by passing --no-sandox as run time parameter to chrome.

But when i pass this flag, chromium is crashing.



Can anyone please help me in accessing system files?



Regards,

K Abhishek
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss
--
Cheers,

K Abhishek
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
--
Cheers,

K Abhishek
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Abhishek Kanike
2018-06-29 15:02:00 UTC
Permalink
Yes. *--no-sandbox* didn't work for me either.
Post by Angelo Mantellini
I put in /data/local/tmp/chrome-command-line “chrome --no-sandbox”, but
the sandbox is always alive
*Date: *Friday, June 29, 2018 at 4:51 PM
*Subject: *Re: [chromium-discuss] How to do system calls from chromium on
Android
​
I tried passing in runtime by writing into
/data/local/tmp/chrome-command-line file
​
Hi,
Do you pass parameters in the compilation phase?
Or do you run chromium passing arguments? I’m talking about android.
Thank you
*Date: *Friday, June 29, 2018 at 4:26 PM
*Subject: *Re: [chromium-discuss] How to do system calls from chromium on
Android
Hi,​
Yeah. It follows a seccomp-bpf sandbox technique (
https://chromium.googlesource.com/chromium/src/+/lkgr/docs/linux_sandboxing.md
)
We can see different sandbox status at chrome://sandbox.
* // Reading process map... start*
size_t datalen_ = 0;
char* data_;
char filename[1024];
*sprintf*(filename, "/proc/%d/maps", (*int*) getpid());
FILE* fp = fopen(filename, "r");
*if* (fp != nullptr) {
*for* (;;) {
char buffer[256];
size_t n = fread(buffer, 1, sizeof(buffer), fp);
*if* (n == 0) {
*break*;
}
datalen_ += n;
}
fclose(fp);
}
*//*
* Read the contents of the cpuinfo file.* data_ = *new* char[datalen_
+ 1];
fp = fopen(filename, "r");
*if* (fp != nullptr) {
*for* (size_t offset = 0; offset < datalen_; ) {
size_t n = fread(data_ + offset, 1, datalen_ - offset, fp);
*if* (n == 0) {
*break*;
}
offset += n;
}
fclose(fp);
}
*//*
* Zero-terminate the data.* data_[datalen_] = '\0';
When I redirected this *data_* to adb logcat complete process map was not
outputted.
Any suggestions in accessing or copy process map (from /proc/<pid>/maps)
to external storage (/sdcard)/?
Android has its own application sandbox which *all* applications on
android are subject to, and you cannot disable this. The Chrome browser
process is just as subject to the general android app sandbox as any other
android app is.
Hi,
I am working in chromium for an application on Android. When i try to do a
system call, i am getting a non zero return value. That means the system
call is not working.
Basically I am just checking (copying to /sdcard/) the usermap of chromium
browser process (from /proc/<pid>/usermap).
I am guessing this is because chrome is running as a sandbox process. I
tried to disable sandbox, by passing --no-sandox as run time parameter to
chrome.
But when i pass this flag, chromium is crashing.
Can anyone please help me in accessing system files?
Regards,
K Abhishek
--
--
http://groups.google.com/a/chromium.org/group/chromium-discuss
--
Cheers,
K Abhishek
--
--
http://groups.google.com/a/chromium.org/group/chromium-discuss
---
You received this message because you are subscribed to the Google Groups
"Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
Cheers,
K Abhishek
--
Cheers,
K Abhishek
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Torne (Richard Coles)
2018-06-29 15:10:57 UTC
Permalink
Post by Abhishek Kanike
Hi,​
Yeah. It follows a seccomp-bpf sandbox technique (
https://chromium.googlesource.com/chromium/src/+/lkgr/docs/linux_sandboxing.md
)
We can see different sandbox status at chrome://sandbox.
No, that's not the Android sandbox. Chromium applies its own seccomp-bpf
filters to *renderer* processes specifically, but the browser process is
not sandboxed by Chromium.

The Android operating system itself *already* runs all applications,
including the browser process, in a sandbox, with restrictions enforced by
both a *separate* seccomp-bpf policy, and by SELinux rules. It also has a
*more* restrictive, second sandbox used for isolated processes, which is
what Chromium renderer processes run as, but you said you were doing this
in the browser process so the isolated process rules should not apply. The
status of the Android sandbox will not be shown in chrome://sandbox because
Chromium doesn't manage it, and so can't display any status about it.

--no-sandbox has little (no?) effect on the Android version of Chromium,
which always uses isolated processes for the renderer no matter what.
This is a different /proc file than the one you mentioned in your initial
post, and /proc/$pid/maps should be accessible just fine - we rely on being
able to access this for crash reporting purposes.
Post by Abhishek Kanike
* // Reading process map... start*
size_t datalen_ = 0;
char* data_;
char filename[1024];
sprintf(filename, "/proc/%d/maps", (int) getpid());
FILE* fp = fopen(filename, "r");
if (fp != nullptr) {
for (;;) {
char buffer[256];
size_t n = fread(buffer, 1, sizeof(buffer), fp);
if (n == 0) {
break;
}
datalen_ += n;
}
fclose(fp);
}
* // Read the contents of the cpuinfo file.* data_ = new
char[datalen_ + 1];
fp = fopen(filename, "r");
if (fp != nullptr) {
for (size_t offset = 0; offset < datalen_; ) {
size_t n = fread(data_ + offset, 1, datalen_ - offset, fp);
if (n == 0) {
break;
}
offset += n;
}
fclose(fp);
}
* // Zero-terminate the data.* data_[datalen_] = '\0';
When I redirected this *data_* to adb logcat complete process map was not
outputted.
logcat has length limits that would prevent something as big as
/proc/$pid/maps from being printed in a single call, unless you're
splitting it up into chunks. I don't know why this code isn't working but
it doesn't appear to be anything specific to chromium; nothing in the
browser process is preventing you from accessing these files, as we already
do this in our code anyway.
Post by Abhishek Kanike
Any suggestions in accessing or copy process map (from /proc/<pid>/maps)
to external storage (/sdcard)/?
Post by Torne (Richard Coles)
Android has its own application sandbox which *all* applications on
android are subject to, and you cannot disable this. The Chrome browser
process is just as subject to the general android app sandbox as any other
android app is.
Post by Abhishek Kanike
Hi,
I am working in chromium for an application on Android. When i try to do
a system call, i am getting a non zero return value. That means the system
call is not working.
Basically I am just checking (copying to /sdcard/) the usermap of
chromium browser process (from /proc/<pid>/usermap).
I am guessing this is because chrome is running as a sandbox process. I
tried to disable sandbox, by passing --no-sandox as run time parameter
to chrome.
But when i pass this flag, chromium is crashing.
Can anyone please help me in accessing system files?
Regards,
K Abhishek
--
--
http://groups.google.com/a/chromium.org/group/chromium-discuss
--
Cheers,
K Abhishek
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Abhishek Kanike
2018-06-29 15:40:35 UTC
Permalink
Torne,
Thanks for detailed information about sandboxing at different levels. It
helped me understand the differences between android sandbox and chromium
own restriction technique (sandbox).
Sorry I meant */proc/<pid>/maps* (not */proc/<pid>/usermap*).
Ah, so logcat length limit might prevent it from printing the entire map.
How can i copy this file and store in different location?
Basically, I am trying to profile on different web benchmarks. For every
testcase in a web benchmark I want to capture the map.
Post by Torne (Richard Coles)
Post by Abhishek Kanike
Hi,​
Yeah. It follows a seccomp-bpf sandbox technique (
https://chromium.googlesource.com/chromium/src/+/lkgr/docs/linux_sandboxing.md
)
We can see different sandbox status at chrome://sandbox.
No, that's not the Android sandbox. Chromium applies its own seccomp-bpf
filters to *renderer* processes specifically, but the browser process is
not sandboxed by Chromium.
The Android operating system itself *already* runs all applications,
including the browser process, in a sandbox, with restrictions enforced by
both a *separate* seccomp-bpf policy, and by SELinux rules. It also has a
*more* restrictive, second sandbox used for isolated processes, which is
what Chromium renderer processes run as, but you said you were doing this
in the browser process so the isolated process rules should not apply. The
status of the Android sandbox will not be shown in chrome://sandbox because
Chromium doesn't manage it, and so can't display any status about it.
--no-sandbox has little (no?) effect on the Android version of Chromium,
which always uses isolated processes for the renderer no matter what.
This is a different /proc file than the one you mentioned in your initial
post, and /proc/$pid/maps should be accessible just fine - we rely on being
able to access this for crash reporting purposes.
Post by Abhishek Kanike
* // Reading process map... start*
size_t datalen_ = 0;
char* data_;
char filename[1024];
sprintf(filename, "/proc/%d/maps", (int) getpid());
FILE* fp = fopen(filename, "r");
if (fp != nullptr) {
for (;;) {
char buffer[256];
size_t n = fread(buffer, 1, sizeof(buffer), fp);
if (n == 0) {
break;
}
datalen_ += n;
}
fclose(fp);
}
* // Read the contents of the cpuinfo file.* data_ = new
char[datalen_ + 1];
fp = fopen(filename, "r");
if (fp != nullptr) {
for (size_t offset = 0; offset < datalen_; ) {
size_t n = fread(data_ + offset, 1, datalen_ - offset, fp);
if (n == 0) {
break;
}
offset += n;
}
fclose(fp);
}
* // Zero-terminate the data.* data_[datalen_] = '\0';
When I redirected this *data_* to adb logcat complete process map was
not outputted.
logcat has length limits that would prevent something as big as
/proc/$pid/maps from being printed in a single call, unless you're
splitting it up into chunks. I don't know why this code isn't working but
it doesn't appear to be anything specific to chromium; nothing in the
browser process is preventing you from accessing these files, as we already
do this in our code anyway.
Post by Abhishek Kanike
Any suggestions in accessing or copy process map (from /proc/<pid>/maps)
to external storage (/sdcard)/?
Post by Torne (Richard Coles)
Android has its own application sandbox which *all* applications on
android are subject to, and you cannot disable this. The Chrome browser
process is just as subject to the general android app sandbox as any other
android app is.
Post by Abhishek Kanike
Hi,
I am working in chromium for an application on Android. When i try to
do a system call, i am getting a non zero return value. That means the
system call is not working.
Basically I am just checking (copying to /sdcard/) the usermap of
chromium browser process (from /proc/<pid>/usermap).
I am guessing this is because chrome is running as a sandbox process. I
tried to disable sandbox, by passing --no-sandox as run time parameter
to chrome.
But when i pass this flag, chromium is crashing.
Can anyone please help me in accessing system files?
Regards,
K Abhishek
--
--
http://groups.google.com/a/chromium.org/group/chromium-discuss
--
Cheers,
K Abhishek
--
Cheers,
K Abhishek
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Torne (Richard Coles)
2018-06-29 15:43:21 UTC
Permalink
You should just be able to read it and write it out again somewhere else,
with normal file IO.
Post by Abhishek Kanike
Torne,
Thanks for detailed information about sandboxing at different levels. It
helped me understand the differences between android sandbox and chromium
own restriction technique (sandbox).
Sorry I meant */proc/<pid>/maps* (not */proc/<pid>/usermap*).
Ah, so logcat length limit might prevent it from printing the entire map.
How can i copy this file and store in different location?
Basically, I am trying to profile on different web benchmarks. For every
testcase in a web benchmark I want to capture the map.
Post by Torne (Richard Coles)
Post by Abhishek Kanike
Hi,​
Yeah. It follows a seccomp-bpf sandbox technique (
https://chromium.googlesource.com/chromium/src/+/lkgr/docs/linux_sandboxing.md
)
We can see different sandbox status at chrome://sandbox.
No, that's not the Android sandbox. Chromium applies its own seccomp-bpf
filters to *renderer* processes specifically, but the browser process is
not sandboxed by Chromium.
The Android operating system itself *already* runs all applications,
including the browser process, in a sandbox, with restrictions enforced by
both a *separate* seccomp-bpf policy, and by SELinux rules. It also has a
*more* restrictive, second sandbox used for isolated processes, which is
what Chromium renderer processes run as, but you said you were doing this
in the browser process so the isolated process rules should not apply. The
status of the Android sandbox will not be shown in chrome://sandbox because
Chromium doesn't manage it, and so can't display any status about it.
--no-sandbox has little (no?) effect on the Android version of Chromium,
which always uses isolated processes for the renderer no matter what.
This is a different /proc file than the one you mentioned in your initial
post, and /proc/$pid/maps should be accessible just fine - we rely on being
able to access this for crash reporting purposes.
Post by Abhishek Kanike
* // Reading process map... start*
size_t datalen_ = 0;
char* data_;
char filename[1024];
sprintf(filename, "/proc/%d/maps", (int) getpid());
FILE* fp = fopen(filename, "r");
if (fp != nullptr) {
for (;;) {
char buffer[256];
size_t n = fread(buffer, 1, sizeof(buffer), fp);
if (n == 0) {
break;
}
datalen_ += n;
}
fclose(fp);
}
* // Read the contents of the cpuinfo file.* data_ = new
char[datalen_ + 1];
fp = fopen(filename, "r");
if (fp != nullptr) {
for (size_t offset = 0; offset < datalen_; ) {
size_t n = fread(data_ + offset, 1, datalen_ - offset, fp);
if (n == 0) {
break;
}
offset += n;
}
fclose(fp);
}
* // Zero-terminate the data.* data_[datalen_] = '\0';
When I redirected this *data_* to adb logcat complete process map was
not outputted.
logcat has length limits that would prevent something as big as
/proc/$pid/maps from being printed in a single call, unless you're
splitting it up into chunks. I don't know why this code isn't working but
it doesn't appear to be anything specific to chromium; nothing in the
browser process is preventing you from accessing these files, as we already
do this in our code anyway.
Post by Abhishek Kanike
Any suggestions in accessing or copy process map (from /proc/<pid>/maps)
to external storage (/sdcard)/?
On Thu, Jun 28, 2018 at 3:10 PM Torne (Richard Coles) <
Post by Torne (Richard Coles)
Android has its own application sandbox which *all* applications on
android are subject to, and you cannot disable this. The Chrome browser
process is just as subject to the general android app sandbox as any other
android app is.
On Thu, 28 Jun 2018 at 14:40 Abhishek Kanike <
Post by Abhishek Kanike
Hi,
I am working in chromium for an application on Android. When i try to
do a system call, i am getting a non zero return value. That means the
system call is not working.
Basically I am just checking (copying to /sdcard/) the usermap of
chromium browser process (from /proc/<pid>/usermap).
I am guessing this is because chrome is running as a sandbox process.
I tried to disable sandbox, by passing --no-sandox as run time
parameter to chrome.
But when i pass this flag, chromium is crashing.
Can anyone please help me in accessing system files?
Regards,
K Abhishek
--
--
http://groups.google.com/a/chromium.org/group/chromium-discuss
--
Cheers,
K Abhishek
--
Cheers,
K Abhishek
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Abhishek Kanike
2018-06-29 16:45:42 UTC
Permalink
When I tried with *fwrite* to copy process map content, the browser is
crashing.


*--------- beginning of crash*
06-29 11:43:40.156 15940 15955 F libc : Fatal signal 11 (SIGSEGV), code 1,
fault addr 0x58 in tid 15955 (CrRendererMain)
06-29 11:43:40.157 3122 3122 W : debuggerd: handling request: pid=
15940 uid=99034 gid=99034 tid=15955
06-29 11:43:40.290 16012 16012 F DEBUG : *** *** *** *** *** *** *** ***
*** *** *** *** *** *** *** ***
06-29 11:43:40.290 16012 16012 F DEBUG : Build fingerprint:
'samsung/dreamltexx/dreamlte:7.0/NRD90M/G950FXXU1AQC9:user/release-keys'
06-29 11:43:40.290 16012 16012 F DEBUG : Revision: '10'
06-29 11:43:40.291 16012 16012 F DEBUG : ABI: 'arm64'
06-29 11:43:40.291 16012 16012 F DEBUG : pid: 15940, tid: 15955, name:
CrRendererMain >>> org.chromium.chrome:sandboxed_process1 <<<
06-29 11:43:40.291 16012 16012 F DEBUG : signal 11 (SIGSEGV), code 1
(SEGV_MAPERR), fault addr 0x58
06-29 11:43:40.291 16012 16012 F DEBUG : x0 0000007034aae980 x1
000000000004675d x2 0000000000000001 x3 0000000000000000
06-29 11:43:40.291 16012 16012 F DEBUG : x4 0000000000000021 x5
0000000080000000 x6 0000007065f86189 x7 0000000000000000
06-29 11:43:40.291 16012 16012 F DEBUG : x8 0000007065f860f8 x9
0000000000000001 x10 0000007065f860c8 x11 0000007065f860c8
06-29 11:43:40.291 16012 16012 F DEBUG : x12 0000007065f86110 x13
000000008000002f x14 00000070687f8898 x15 00000070687f853c
06-29 11:43:40.291 16012 16012 F DEBUG : x16 000000704263b4e8 x17
00000070687a8bc0 x18 ffffffffffffffff x19 0000000000000001
06-29 11:43:40.291 16012 16012 F DEBUG : x20 0000000000000000 x21
000000000004675d x22 0000000000000000 x23 dab3756b08ef508c
06-29 11:43:40.291 16012 16012 F DEBUG : x24 000000000004675d x25
0000000044b026f1 x26 000000703643d708 x27 000000005e2229d1
06-29 11:43:40.291 16012 16012 F DEBUG : x28 0000000044b026f1 x29
0000007065f86150 x30 0000007042635470
06-29 11:43:40.291 16012 16012 F DEBUG : sp 0000007065f860f0 pc
00000070687a8c50 pstate 0000000060000000
06-29 11:43:40.299 16012 16012 F DEBUG :
06-29 11:43:40.299 16012 16012 F DEBUG : backtrace:
06-29 11:43:40.299 16012 16012 F DEBUG : #00 pc 000000000005bc50
/system/lib64/libc.so (fwrite+144)
06-29 11:43:40.299 16012 16012 F DEBUG : #01 pc 000000000001e46c
/data/app/org.chromium.chrome-1/lib/arm64/libgin.cr.so (offset 0x15000)
(_ZN3gin10V8Platform22CurrentClockTimeMillisEv+444)
06-29 11:43:40.299 16012 16012 F DEBUG : #02 pc 00000000009901e8
/data/app/org.chromium.chrome-1/lib/arm64/libv8.cr.so (offset 0x366000)
06-29 11:43:40.299 16012 16012 F DEBUG : #03 pc 000000000045feb8
/data/app/org.chromium.chrome-1/lib/arm64/libv8.cr.so (offset 0x366000)
06-29 11:43:40.299 16012 16012 F DEBUG : #04 pc 000000000045fc44
/data/app/org.chromium.chrome-1/lib/arm64/libv8.cr.so (offset 0x366000)
06-29 11:43:40.299 16012 16012 F DEBUG : #05 pc 0000000000027930
<anonymous:0000000045304000>


Is this beacuse chromium cannot create a new file and write into it? I am
trying from v8_platform.cc
Post by Torne (Richard Coles)
You should just be able to read it and write it out again somewhere else,
with normal file IO.
Post by Abhishek Kanike
Torne,
Thanks for detailed information about sandboxing at different levels. It
helped me understand the differences between android sandbox and chromium
own restriction technique (sandbox).
Sorry I meant */proc/<pid>/maps* (not */proc/<pid>/usermap*).
Ah, so logcat length limit might prevent it from printing the entire map.
How can i copy this file and store in different location?
Basically, I am trying to profile on different web benchmarks. For every
testcase in a web benchmark I want to capture the map.
On Fri, Jun 29, 2018 at 10:11 AM Torne (Richard Coles) <
Post by Torne (Richard Coles)
Post by Abhishek Kanike
Hi,​
Yeah. It follows a seccomp-bpf sandbox technique (
https://chromium.googlesource.com/chromium/src/+/lkgr/docs/linux_sandboxing.md
)
We can see different sandbox status at chrome://sandbox.
No, that's not the Android sandbox. Chromium applies its own seccomp-bpf
filters to *renderer* processes specifically, but the browser process is
not sandboxed by Chromium.
The Android operating system itself *already* runs all applications,
including the browser process, in a sandbox, with restrictions enforced by
both a *separate* seccomp-bpf policy, and by SELinux rules. It also has a
*more* restrictive, second sandbox used for isolated processes, which is
what Chromium renderer processes run as, but you said you were doing this
in the browser process so the isolated process rules should not apply. The
status of the Android sandbox will not be shown in chrome://sandbox because
Chromium doesn't manage it, and so can't display any status about it.
--no-sandbox has little (no?) effect on the Android version of Chromium,
which always uses isolated processes for the renderer no matter what.
This is a different /proc file than the one you mentioned in your
initial post, and /proc/$pid/maps should be accessible just fine - we rely
on being able to access this for crash reporting purposes.
Post by Abhishek Kanike
* // Reading process map... start*
size_t datalen_ = 0;
char* data_;
char filename[1024];
sprintf(filename, "/proc/%d/maps", (int) getpid());
FILE* fp = fopen(filename, "r");
if (fp != nullptr) {
for (;;) {
char buffer[256];
size_t n = fread(buffer, 1, sizeof(buffer), fp);
if (n == 0) {
break;
}
datalen_ += n;
}
fclose(fp);
}
* // Read the contents of the cpuinfo file.* data_ = new
char[datalen_ + 1];
fp = fopen(filename, "r");
if (fp != nullptr) {
for (size_t offset = 0; offset < datalen_; ) {
size_t n = fread(data_ + offset, 1, datalen_ - offset, fp);
if (n == 0) {
break;
}
offset += n;
}
fclose(fp);
}
* // Zero-terminate the data.* data_[datalen_] = '\0';
When I redirected this *data_* to adb logcat complete process map was
not outputted.
logcat has length limits that would prevent something as big as
/proc/$pid/maps from being printed in a single call, unless you're
splitting it up into chunks. I don't know why this code isn't working but
it doesn't appear to be anything specific to chromium; nothing in the
browser process is preventing you from accessing these files, as we already
do this in our code anyway.
Post by Abhishek Kanike
Any suggestions in accessing or copy process map (from
/proc/<pid>/maps) to external storage (/sdcard)/?
On Thu, Jun 28, 2018 at 3:10 PM Torne (Richard Coles) <
Post by Torne (Richard Coles)
Android has its own application sandbox which *all* applications on
android are subject to, and you cannot disable this. The Chrome browser
process is just as subject to the general android app sandbox as any other
android app is.
On Thu, 28 Jun 2018 at 14:40 Abhishek Kanike <
Post by Abhishek Kanike
Hi,
I am working in chromium for an application on Android. When i try to
do a system call, i am getting a non zero return value. That means the
system call is not working.
Basically I am just checking (copying to /sdcard/) the usermap of
chromium browser process (from /proc/<pid>/usermap).
I am guessing this is because chrome is running as a sandbox process.
I tried to disable sandbox, by passing --no-sandox as run time
parameter to chrome.
But when i pass this flag, chromium is crashing.
Can anyone please help me in accessing system files?
Regards,
K Abhishek
--
--
http://groups.google.com/a/chromium.org/group/chromium-discuss
--
Cheers,
K Abhishek
--
Cheers,
K Abhishek
--
Cheers,
K Abhishek
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Torne (Richard Coles)
2018-06-29 16:51:24 UTC
Permalink
That's the renderer process, not the browser process. The renderer process
can't create files. V8 doesn't run in the browser process.
Post by Abhishek Kanike
When I tried with *fwrite* to copy process map content, the browser is
crashing.
*--------- beginning of crash*
06-29 11:43:40.156 15940 15955 F libc : Fatal signal 11 (SIGSEGV),
code 1, fault addr 0x58 in tid 15955 (CrRendererMain)
pid=15940 uid=99034 gid=99034 tid=15955
06-29 11:43:40.290 16012 16012 F DEBUG : *** *** *** *** *** *** ***
*** *** *** *** *** *** *** *** ***
'samsung/dreamltexx/dreamlte:7.0/NRD90M/G950FXXU1AQC9:user/release-keys'
06-29 11:43:40.290 16012 16012 F DEBUG : Revision: '10'
06-29 11:43:40.291 16012 16012 F DEBUG : ABI: 'arm64'
CrRendererMain >>> org.chromium.chrome:sandboxed_process1 <<<
06-29 11:43:40.291 16012 16012 F DEBUG : signal 11 (SIGSEGV), code 1
(SEGV_MAPERR), fault addr 0x58
06-29 11:43:40.291 16012 16012 F DEBUG : x0 0000007034aae980 x1
000000000004675d x2 0000000000000001 x3 0000000000000000
06-29 11:43:40.291 16012 16012 F DEBUG : x4 0000000000000021 x5
0000000080000000 x6 0000007065f86189 x7 0000000000000000
06-29 11:43:40.291 16012 16012 F DEBUG : x8 0000007065f860f8 x9
0000000000000001 x10 0000007065f860c8 x11 0000007065f860c8
06-29 11:43:40.291 16012 16012 F DEBUG : x12 0000007065f86110
x13 000000008000002f x14 00000070687f8898 x15 00000070687f853c
06-29 11:43:40.291 16012 16012 F DEBUG : x16 000000704263b4e8
x17 00000070687a8bc0 x18 ffffffffffffffff x19 0000000000000001
06-29 11:43:40.291 16012 16012 F DEBUG : x20 0000000000000000
x21 000000000004675d x22 0000000000000000 x23 dab3756b08ef508c
06-29 11:43:40.291 16012 16012 F DEBUG : x24 000000000004675d
x25 0000000044b026f1 x26 000000703643d708 x27 000000005e2229d1
06-29 11:43:40.291 16012 16012 F DEBUG : x28 0000000044b026f1
x29 0000007065f86150 x30 0000007042635470
06-29 11:43:40.291 16012 16012 F DEBUG : sp 0000007065f860f0 pc
00000070687a8c50 pstate 0000000060000000
06-29 11:43:40.299 16012 16012 F DEBUG : #00 pc 000000000005bc50
/system/lib64/libc.so (fwrite+144)
06-29 11:43:40.299 16012 16012 F DEBUG : #01 pc 000000000001e46c
/data/app/org.chromium.chrome-1/lib/arm64/libgin.cr.so (offset 0x15000)
(_ZN3gin10V8Platform22CurrentClockTimeMillisEv+444)
06-29 11:43:40.299 16012 16012 F DEBUG : #02 pc 00000000009901e8
/data/app/org.chromium.chrome-1/lib/arm64/libv8.cr.so (offset 0x366000)
06-29 11:43:40.299 16012 16012 F DEBUG : #03 pc 000000000045feb8
/data/app/org.chromium.chrome-1/lib/arm64/libv8.cr.so (offset 0x366000)
06-29 11:43:40.299 16012 16012 F DEBUG : #04 pc 000000000045fc44
/data/app/org.chromium.chrome-1/lib/arm64/libv8.cr.so (offset 0x366000)
06-29 11:43:40.299 16012 16012 F DEBUG : #05 pc 0000000000027930
<anonymous:0000000045304000>
Is this beacuse chromium cannot create a new file and write into it? I am
trying from v8_platform.cc
Post by Torne (Richard Coles)
You should just be able to read it and write it out again somewhere else,
with normal file IO.
Post by Abhishek Kanike
Torne,
Thanks for detailed information about sandboxing at different levels. It
helped me understand the differences between android sandbox and chromium
own restriction technique (sandbox).
Sorry I meant */proc/<pid>/maps* (not */proc/<pid>/usermap*).
Ah, so logcat length limit might prevent it from printing the entire
map. How can i copy this file and store in different location?
Basically, I am trying to profile on different web benchmarks. For every
testcase in a web benchmark I want to capture the map.
On Fri, Jun 29, 2018 at 10:11 AM Torne (Richard Coles) <
On Fri, 29 Jun 2018 at 10:26 Abhishek Kanike <
Post by Abhishek Kanike
Hi,​
Yeah. It follows a seccomp-bpf sandbox technique (
https://chromium.googlesource.com/chromium/src/+/lkgr/docs/linux_sandboxing.md
)
We can see different sandbox status at chrome://sandbox.
No, that's not the Android sandbox. Chromium applies its own
seccomp-bpf filters to *renderer* processes specifically, but the browser
process is not sandboxed by Chromium.
The Android operating system itself *already* runs all applications,
including the browser process, in a sandbox, with restrictions enforced by
both a *separate* seccomp-bpf policy, and by SELinux rules. It also has a
*more* restrictive, second sandbox used for isolated processes, which is
what Chromium renderer processes run as, but you said you were doing this
in the browser process so the isolated process rules should not apply. The
status of the Android sandbox will not be shown in chrome://sandbox because
Chromium doesn't manage it, and so can't display any status about it.
--no-sandbox has little (no?) effect on the Android version of
Chromium, which always uses isolated processes for the renderer no matter
what.
This is a different /proc file than the one you mentioned in your
initial post, and /proc/$pid/maps should be accessible just fine - we rely
on being able to access this for crash reporting purposes.
Post by Abhishek Kanike
* // Reading process map... start*
size_t datalen_ = 0;
char* data_;
char filename[1024];
sprintf(filename, "/proc/%d/maps", (int) getpid());
FILE* fp = fopen(filename, "r");
if (fp != nullptr) {
for (;;) {
char buffer[256];
size_t n = fread(buffer, 1, sizeof(buffer), fp);
if (n == 0) {
break;
}
datalen_ += n;
}
fclose(fp);
}
* // Read the contents of the cpuinfo file.* data_ = new
char[datalen_ + 1];
fp = fopen(filename, "r");
if (fp != nullptr) {
for (size_t offset = 0; offset < datalen_; ) {
size_t n = fread(data_ + offset, 1, datalen_ - offset, fp);
if (n == 0) {
break;
}
offset += n;
}
fclose(fp);
}
* // Zero-terminate the data.* data_[datalen_] = '\0';
When I redirected this *data_* to adb logcat complete process map was
not outputted.
logcat has length limits that would prevent something as big as
/proc/$pid/maps from being printed in a single call, unless you're
splitting it up into chunks. I don't know why this code isn't working but
it doesn't appear to be anything specific to chromium; nothing in the
browser process is preventing you from accessing these files, as we already
do this in our code anyway.
Post by Abhishek Kanike
Any suggestions in accessing or copy process map (from
/proc/<pid>/maps) to external storage (/sdcard)/?
On Thu, Jun 28, 2018 at 3:10 PM Torne (Richard Coles) <
Post by Torne (Richard Coles)
Android has its own application sandbox which *all* applications on
android are subject to, and you cannot disable this. The Chrome browser
process is just as subject to the general android app sandbox as any other
android app is.
On Thu, 28 Jun 2018 at 14:40 Abhishek Kanike <
Post by Abhishek Kanike
Hi,
I am working in chromium for an application on Android. When i try
to do a system call, i am getting a non zero return value. That means the
system call is not working.
Basically I am just checking (copying to /sdcard/) the usermap of
chromium browser process (from /proc/<pid>/usermap).
I am guessing this is because chrome is running as a sandbox
process. I tried to disable sandbox, by passing --no-sandox as run
time parameter to chrome.
But when i pass this flag, chromium is crashing.
Can anyone please help me in accessing system files?
Regards,
K Abhishek
--
--
http://groups.google.com/a/chromium.org/group/chromium-discuss
--
Cheers,
K Abhishek
--
Cheers,
K Abhishek
--
Cheers,
K Abhishek
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Abhishek Kanike
2018-07-02 17:31:38 UTC
Permalink
​​
Oh, renderer process cant write files to disk. So is there any way to
communicate through browser process (IPC calls) and perform system call to
copy process map.
When i tried to dump the process map in logcat line by line as below:

char *READ_PROCESSMAP = /proc/<pid>/maps
std::ifstream in(READ_PROCESSMAP);
char str[255];
int lineno = 0;
while (in) {
in.getline(str, 255);
__android_log_print(ANDROID_LOG_INFO, "PROCESSMAP", "%s", str);
}
in.close();
few lines of process map at regular interval is not getting displayed in
the console.
If i m able to print all the logs to logcat, i m thinking to script a
background process to logcat which wlll parse the logcat and save the
usermap.

Any idea with this issue? Or any suggestion to store the process map?
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Torne (Richard Coles)
2018-07-02 17:40:36 UTC
Permalink
There's many different ways to communicate with the browser process; there
are a lot of different examples of this in the code you can imitate. If
this is just for some temporary tracing/debugging purpose and not something
you intend to ship to users, then probably the easiest way is to just have
the browser process open the file and pass the file descriptor to the
renderer process during renderer startup somewhere - the renderer process
can write to already-open writable file handles, it just cannot open new
files. This is what the crash handling system does to produce crash dumps,
for example :)

For the logcat that looks generally reasonable, but if you print too many
lines of log at once then the buffer will fill up and logging will be
dropped. If you are reading the log in realtime with a running "adb logcat"
process then this is okay, because the logging will be passed to the host
PC *before* it's written to the buffer, but if you're just reading the log
after the fact, then that may be why there's data missing.
Post by Abhishek Kanike
​​
Oh, renderer process cant write files to disk. So is there any way to
communicate through browser process (IPC calls) and perform system call to
copy process map.
char *READ_PROCESSMAP = /proc/<pid>/maps
std::ifstream in(READ_PROCESSMAP);
char str[255];
int lineno = 0;
while (in) {
in.getline(str, 255);
__android_log_print(ANDROID_LOG_INFO, "PROCESSMAP", "%s", str);
}
in.close();
few lines of process map at regular interval is not getting displayed in
the console.
If i m able to print all the logs to logcat, i m thinking to script a
background process to logcat which wlll parse the logcat and save the
usermap.
Any idea with this issue? Or any suggestion to store the process map?
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Abhishek Kanike
2018-07-03 00:13:59 UTC
Permalink
​Getting a file descriptor from browser process is a good idea.
Can i get some help in identifying the browser process code.
I want to access and save the file in v8_platform.cc in
CurrentClockTimeMillis
<https://cs.chromium.org/chromium/src/gin/v8_platform.cc?sq=package:chromium&dr&q=v8_platform.cc&g=0&l=398>
.
Basically I backtracked ​the code a little and reached this
<https://cs.chromium.org/chromium/src/gin/shell/gin_main.cc?sq=package:chromium&dr&g=0&l=84>
place.
Is this part of browser process code?
Post by Torne (Richard Coles)
There's many different ways to communicate with the browser process; there
are a lot of different examples of this in the code you can imitate. If
this is just for some temporary tracing/debugging purpose and not something
you intend to ship to users, then probably the easiest way is to just have
the browser process open the file and pass the file descriptor to the
renderer process during renderer startup somewhere - the renderer process
can write to already-open writable file handles, it just cannot open new
files. This is what the crash handling system does to produce crash dumps,
for example :)
For the logcat that looks generally reasonable, but if you print too many
lines of log at once then the buffer will fill up and logging will be
dropped. If you are reading the log in realtime with a running "adb logcat"
process then this is okay, because the logging will be passed to the host
PC *before* it's written to the buffer, but if you're just reading the log
after the fact, then that may be why there's data missing.
Post by Abhishek Kanike
​​
Oh, renderer process cant write files to disk. So is there any way to
communicate through browser process (IPC calls) and perform system call to
copy process map.
char *READ_PROCESSMAP = /proc/<pid>/maps
std::ifstream in(READ_PROCESSMAP);
char str[255];
int lineno = 0;
while (in) {
in.getline(str, 255);
__android_log_print(ANDROID_LOG_INFO, "PROCESSMAP", "%s", str);
}
in.close();
few lines of process map at regular interval is not getting displayed in
the console.
If i m able to print all the logs to logcat, i m thinking to script a
background process to logcat which wlll parse the logcat and save the
usermap.
Any idea with this issue? Or any suggestion to store the process map?
--
Cheers,
K Abhishek
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Torne (Richard Coles)
2018-07-03 16:49:41 UTC
Permalink
The gin shell is test code, not used in the actual browser at all.
Post by Abhishek Kanike
​Getting a file descriptor from browser process is a good idea.
Can i get some help in identifying the browser process code.
I want to access and save the file in v8_platform.cc in
CurrentClockTimeMillis
<https://cs.chromium.org/chromium/src/gin/v8_platform.cc?sq=package:chromium&dr&q=v8_platform.cc&g=0&l=398>
.
Basically I backtracked ​the code a little and reached this
<https://cs.chromium.org/chromium/src/gin/shell/gin_main.cc?sq=package:chromium&dr&g=0&l=84> place.
Is this part of browser process code?
Post by Torne (Richard Coles)
There's many different ways to communicate with the browser process;
there are a lot of different examples of this in the code you can imitate.
If this is just for some temporary tracing/debugging purpose and not
something you intend to ship to users, then probably the easiest way is to
just have the browser process open the file and pass the file descriptor to
the renderer process during renderer startup somewhere - the renderer
process can write to already-open writable file handles, it just cannot
open new files. This is what the crash handling system does to produce
crash dumps, for example :)
For the logcat that looks generally reasonable, but if you print too many
lines of log at once then the buffer will fill up and logging will be
dropped. If you are reading the log in realtime with a running "adb logcat"
process then this is okay, because the logging will be passed to the host
PC *before* it's written to the buffer, but if you're just reading the log
after the fact, then that may be why there's data missing.
Post by Abhishek Kanike
​​
Oh, renderer process cant write files to disk. So is there any way to
communicate through browser process (IPC calls) and perform system call to
copy process map.
char *READ_PROCESSMAP = /proc/<pid>/maps
std::ifstream in(READ_PROCESSMAP);
char str[255];
int lineno = 0;
while (in) {
in.getline(str, 255);
__android_log_print(ANDROID_LOG_INFO, "PROCESSMAP", "%s", str);
}
in.close();
few lines of process map at regular interval is not getting displayed in
the console.
If i m able to print all the logs to logcat, i m thinking to script a
background process to logcat which wlll parse the logcat and save the
usermap.
Any idea with this issue? Or any suggestion to store the process map?
--
Cheers,
K Abhishek
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
c***@yandex-team.ru
2018-07-23 04:48:08 UTC
Permalink
So, is proc/self/maps accessible from renderer process(with enabled
sandboxing) or only from browser process?
Thanks!

пятМОца, 29 ОюМя 2018 г., 22:11:18 UTC+7 пПльзПватель Torne (Richard Coles)
Post by Torne (Richard Coles)
This is a different /proc file than the one you mentioned in your initial
post, and /proc/$pid/maps should be accessible just fine - we rely on being
able to access this for crash reporting purposes.
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Loading...