From: Heiko Carstens <hca@linux.ibm.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Harald Freudenberger <freude@linux.ibm.com>,
linux-s390@vger.kernel.org
Subject: Re: [PATCH 4/4] s390/uaccess: remove set_fs() interface
Date: Tue, 15 Sep 2020 18:49:09 +0200 [thread overview]
Message-ID: <20200915164909.GB11180@osiris> (raw)
In-Reply-To: <20200915160243.GB22056@lst.de>
On Tue, Sep 15, 2020 at 06:02:43PM +0200, Christoph Hellwig wrote:
> > int oldval = 0, newval, ret;
> > - mm_segment_t old_fs;
> > + bool old;
> >
> > - old_fs = enable_sacf_uaccess();
> > + old = enable_sacf_uaccess();
> > switch (op) {
> > case FUTEX_OP_SET:
> > __futex_atomic_op("lr %2,%5\n",
> > @@ -53,7 +53,7 @@ static inline int arch_futex_atomic_op_inuser(int op, int oparg, int *oval,
> > default:
> > ret = -ENOSYS;
> > }
> > - disable_sacf_uaccess(old_fs);
> > + disable_sacf_uaccess(old);
>
> Do we need to return the old value here? The way I understand it
> this is context switched with the thread, and given that only small
> isolated code bases now use it, sacf use can't nest, can it?
Right, that should not happen. I think I'll change both functions to
void and add a WARN_ON_ONCE() to both of them, so that nested calls
will be catched.
> > @@ -116,7 +114,7 @@ struct thread_struct {
> > unsigned long hardirq_timer; /* task cputime in hardirq context */
> > unsigned long softirq_timer; /* task cputime in softirq context */
> > unsigned long sys_call_table; /* system call table address */
> > - mm_segment_t mm_segment;
> > + bool sacf_uaccess; /* uaccess with sacf enabled */
>
> Isn't there a flags field somewhere where this could be folded into?
Hmm, a TIF flag will probably do.
> > -void set_fs_fixup(void)
> > -{
> > - struct pt_regs *regs = current_pt_regs();
> > - static bool warned;
> > -
> > - set_fs(USER_DS);
> > - if (warned)
> > - return;
> > - WARN(1, "Unbalanced set_fs - int code: 0x%x\n", regs->int_code);
> > - show_registers(regs);
> > - warned = true;
>
> Would a warning about an unbalanced sacf flag still make sense? Or
> just objtool for compile time checks similar to the unsafe uaccess
> routines on x86?
Yes, I was not sure to keep it or drop it. But now that you ask for
it, I'll add it back. FWIW, there is no objtool for s390 (yet).
> > EXPORT_SYMBOL(enable_sacf_uaccess);
>
> Neither enable_sacf_uaccess nor disable_sacf_uaccess appear to be
> used in modular code, so these exports can probably be dropped.
Ah, I wanted to check, and forgot that.
next prev parent reply other threads:[~2020-09-15 17:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-15 15:43 [PATCH 0/4] s390: set_fs() removal Heiko Carstens
2020-09-15 15:43 ` [PATCH 1/4] s390/zcrypt: remove set_fs() invocation in zcrypt device driver Heiko Carstens
2020-09-15 15:43 ` [PATCH 2/4] s390/dis: get rid of set_fs() usage Heiko Carstens
2020-09-15 15:52 ` Christoph Hellwig
2020-09-15 16:55 ` Heiko Carstens
2020-09-15 15:43 ` [PATCH 3/4] s390/uaccess: implement HAVE_GET_KERNEL_NOFAULT support Heiko Carstens
2020-09-15 15:43 ` [PATCH 4/4] s390/uaccess: remove set_fs() interface Heiko Carstens
2020-09-15 16:02 ` Christoph Hellwig
2020-09-15 16:49 ` Heiko Carstens [this message]
2020-09-15 19:37 ` Heiko Carstens
2020-09-16 12:36 ` Heiko Carstens
2020-11-25 8:38 ` Christoph Hellwig
2020-11-25 8:51 ` Christian Borntraeger
2020-11-25 16:36 ` Christoph Hellwig
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=20200915164909.GB11180@osiris \
--to=hca@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=freude@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hch@lst.de \
--cc=linux-s390@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.