From 71fc375d1b5ded31bbe2c7054ca26d693c402afb Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 1 Aug 2007 15:35:08 +0000 Subject: [PATCH] - feeder: created shared mem seg with 0666 rather than 0660. In principle 0660 should work (assuming apache belongs to admin group) but apparently on some Linux systems it doesn't, and the feeder gets "can't attach to shared mem" errors. - scheduler: print uid/gid info if can't attach to shared mem - user web: fix bug in team founder transfer form svn path=/trunk/boinc/; revision=13255 --- checkin_notes | 15 +++++++++++++++ html/user/team_founder_transfer_form.php | 2 +- lib/shmem.C | 14 +++++++++----- sched/main.C | 4 ++++ 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/checkin_notes b/checkin_notes index 5589039abb..55b8103b92 100755 --- a/checkin_notes +++ b/checkin_notes @@ -7591,3 +7591,18 @@ Charlie 31 July 2007 api/ x_opengl.C + +David 1 Aug 2007 + - feeder: created shared mem seg with 0666 rather than 0660. + In principle 0660 should work (assuming apache belongs to admin group) + but apparently on some Linux systems it doesn't, + and the feeder gets "can't attach to shared mem" errors. + - scheduler: print uid/gid info if can't attach to shared mem + - user web: fix bug in team founder transfer form + + sched/ + main.C + html/user/ + team_founder_transfer_form.php + lib/ + shmem.C diff --git a/html/user/team_founder_transfer_form.php b/html/user/team_founder_transfer_form.php index 505797c818..1081f79684 100644 --- a/html/user/team_founder_transfer_form.php +++ b/html/user/team_founder_transfer_form.php @@ -39,7 +39,7 @@ if (new_transfer_request_ok($team, $now)) { echo "

You have already requested to take over the founder position of $team->name. "; - if (transfer_ok($team, $now) { + if (transfer_ok($team, $now)) { echo "

diff --git a/lib/shmem.C b/lib/shmem.C index c8e8bac59a..3648b908e8 100755 --- a/lib/shmem.C +++ b/lib/shmem.C @@ -162,15 +162,19 @@ int detach_shmem(void* p) { int create_shmem(key_t key, int size, gid_t gid, void** pp) { int id; - // try 0660, then SHM_R|SHM_W + // try 0666, then SHM_R|SHM_W // seems like some platforms require one or the other // (this may be superstition) // -#ifdef EINSTEIN_AT_HOME + // NOTE: in principle it should be 0660, not 0666 + // (i.e. Apache should belong to the same group as the + // project admin user, and should therefore be able to access the seg. + // However, this doesn't seem to work on some Linux systems. + // I don't have time to figure this out (31 July 07) + // it's a big headache for anyone it affects, + // and it's not a significant security issue. + // id = shmget(key, size, IPC_CREAT|0666); -#else - id = shmget(key, size, IPC_CREAT|0660); -#endif if (id < 0) { id = shmget(key, size, IPC_CREAT|SHM_R|SHM_W); } diff --git a/sched/main.C b/sched/main.C index 9e630cc13f..14a17291c1 100644 --- a/sched/main.C +++ b/sched/main.C @@ -266,6 +266,10 @@ void attach_to_feeder_shmem() { "Can't attach shmem: %d (feeder not running?)\n", retval ); + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "uid %d euid %d gid %d eguid%d\n", + getuid(), geteuid(), getgid(), getegid() + ); } else { ssp = (SCHED_SHMEM*)p; retval = ssp->verify();