From: ebiederm@xmission.com (Eric W. Biederman)
To: "Randy.Dunlap" <rdunlap@xenotime.net>
Cc: lkml <linux-kernel@vger.kernel.org>,
drepper@redhat.com, akpm <akpm@osdl.org>,
serue@us.ibm.com, sam@vilain.net, clg@fr.ibm.com, dev@sw.ru
Subject: Re: [PATCH] POSIX-hostname up to 255 characters
Date: Sat, 27 May 2006 07:54:38 -0600 [thread overview]
Message-ID: <m13bev8tep.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0605270027070.29434@shark.he.net> (Randy Dunlap's message of "Sat, 27 May 2006 00:36:23 -0700 (PDT)")
"Randy.Dunlap" <rdunlap@xenotime.net> writes:
>> > "Randy.Dunlap" <rdunlap@xenotime.net> writes:
>> >
>> > > This patch is against 2.6.17-rc5, for review/comments, please.
>> > > It won't apply to -mm since Andrew has merged the uts-namespace patches.
>> > > I'll see about merging it with those patches next.
>> > > ---
>
> Per Eric's comments:
>
> 1. use existing sys_gethostname() and sys_sethostname().
>
> 2. add sys_uname_long() to read struct long_utsname;
>
> 3. removed EXPORT_SYMBOL()s
I have to confess I am still uneasy with sys_uname_long.
The problem is that we have several revisions of this system
call almost always simply to accommodate long string lengths,
and the new interface doesn't seem any less susceptible to
handling longer strings than the old one.
Could we do something like:
long sys_unamev(int count, char __user **name, size_t name_len)
{
char *table[] = {
system_utsname.sysname,
system_utsname.nodename,
system_utsname.release,
system_utsname.version,
system_utsname.machine,
system_utsname.domainname,
};
char __user *data;
long error;
long len;
int i;
down_read(&uts_sem);
error = -EINVAL;
if (count > 6)
goto out;
len = sizeof(char __user *) * count;
for (i = 0; i < count; i++) {
len += strlen(table[i]) + 1;
}
error = -ERANGE;
if (len > name_len)
goto out;
error = -EFAULT;
if (!name)
goto out;
if (!access_ok(VERIFY_WRITE, name, name_len))
goto out;
error = 0;
data = (char __user *)&name[count];
for (i = 0; i < count; i++) {
size_t len = strlen(table[i]) + 1;
error |= __put_user(data, name[i]);
error |= __copy_to_user(data, table[i], len);
data += len;
}
out:
up_read(&uts_sem);
return error;
}
And then in user space we can do.
struct utsname {
char *sysname;
char *nodename;
char *release;
char *version;
char *machine;
char *domainname;
char buf[4096 - (sizeof(char *)*6)];
};
int uname(struct utsname *buf)
{
return sys_unamev(6, buf, sizeof(*buf));
}
Eric
next prev parent reply other threads:[~2006-05-27 13:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-26 3:45 Randy.Dunlap
2006-05-26 9:14 ` Eric W. Biederman
2006-05-26 14:42 ` Jan-Benedict Glaw
2006-05-26 17:28 ` Randy.Dunlap
2006-05-26 18:01 ` Jan-Benedict Glaw
2006-05-26 18:15 ` linux-os (Dick Johnson)
2006-05-26 18:28 ` Ulrich Drepper
2006-05-26 18:35 ` linux-os (Dick Johnson)
2006-05-26 18:55 ` Ulrich Drepper
2006-05-26 19:12 ` Jan Engelhardt
2006-05-26 21:31 ` Eric W. Biederman
2006-05-27 1:39 ` Randy.Dunlap
2006-05-27 7:36 ` Randy.Dunlap
2006-05-27 13:54 ` Eric W. Biederman [this message]
2006-05-28 18:32 ` Randy.Dunlap
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=m13bev8tep.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=akpm@osdl.org \
--cc=clg@fr.ibm.com \
--cc=dev@sw.ru \
--cc=drepper@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@xenotime.net \
--cc=sam@vilain.net \
--cc=serue@us.ibm.com \
/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
Powered by JetHome